From 0cbf04a77e74b330f0a0c6a9ec65bb8d2a102c44 Mon Sep 17 00:00:00 2001 From: Jules Pietri Date: Mon, 4 Apr 2016 14:41:40 +0200 Subject: [PATCH] [DI] fix Autowiring tests of #18144 --- .../Config/AutowireServiceResource.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/DependencyInjection/Config/AutowireServiceResource.php b/src/Symfony/Component/DependencyInjection/Config/AutowireServiceResource.php index 370af81c322d9..36449d8d3042a 100644 --- a/src/Symfony/Component/DependencyInjection/Config/AutowireServiceResource.php +++ b/src/Symfony/Component/DependencyInjection/Config/AutowireServiceResource.php @@ -12,6 +12,7 @@ namespace Symfony\Component\DependencyInjection\Config; use Symfony\Component\Config\Resource\SelfCheckingResourceInterface; +use Symfony\Component\DependencyInjection\Compiler\AutowirePass; class AutowireServiceResource implements SelfCheckingResourceInterface, \Serializable { @@ -32,7 +33,19 @@ public function isFresh($timestamp) return false; } - return @filemtime($this->filePath) <= $timestamp; + // has the file *not* been modified? Definitely fresh + if (@filemtime($this->filePath) <= $timestamp) { + return true; + } + + try { + $reflectionClass = new \ReflectionClass($this->class); + } catch (\ReflectionException $e) { + // the class does not exist anymore! + return false; + } + + return (array) $this === (array) AutowirePass::createResourceForClass($reflectionClass); } public function __toString()