From 9f6dad15b2f8b219a29ad2dd6b5ec673d92d6465 Mon Sep 17 00:00:00 2001 From: Adam Prager Date: Tue, 31 Jan 2017 17:37:16 +0100 Subject: [PATCH] Fixed ServiceFilesResource pattern finder --- Config/ServiceFilesResource.php | 6 ++++-- .../Compiler/AnnotationConfigurationPass.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Config/ServiceFilesResource.php b/Config/ServiceFilesResource.php index 088f3ba..f44dd95 100644 --- a/Config/ServiceFilesResource.php +++ b/Config/ServiceFilesResource.php @@ -27,17 +27,19 @@ class ServiceFilesResource extends InternalResource private $files; private $dirs; private $disableGrep; + private $pattern; - public function __construct(array $files, array $dirs, $disableGrep) + public function __construct(array $files, array $dirs, $disableGrep, $pattern = 'JMS\DiExtraBundle\Annotation') { $this->files = $files; $this->dirs = $dirs; $this->disableGrep = $disableGrep; + $this->pattern = $pattern; } public function isFresh($timestamp) { - $finder = new PatternFinder('JMS\DiExtraBundle\Annotation', '*.php', $this->disableGrep); + $finder = new PatternFinder($this->pattern, '*.php', $this->disableGrep); $files = $finder->findFiles($this->dirs); return !array_diff($files, $this->files) && !array_diff($this->files, $files); diff --git a/DependencyInjection/Compiler/AnnotationConfigurationPass.php b/DependencyInjection/Compiler/AnnotationConfigurationPass.php index fbd11a1..89db171 100644 --- a/DependencyInjection/Compiler/AnnotationConfigurationPass.php +++ b/DependencyInjection/Compiler/AnnotationConfigurationPass.php @@ -89,7 +89,7 @@ private function handlePattern(ContainerBuilder $container, $directories, $patte { $finder = new PatternFinder($pattern, '*.php', $disableGrep); $files = $finder->findFiles($directories); - $container->addResource(new ServiceFilesResource($files, $directories, $disableGrep)); + $container->addResource(new ServiceFilesResource($files, $directories, $disableGrep, $pattern)); foreach ($files as $file) { $container->addResource(new FileResource($file)); require_once $file;