Skip to content

Commit 4c898d5

Browse files
bug #23870 [DI] Use GlobResource for non-tracked directories (vudaltsov)
This PR was merged into the 3.3 branch. Discussion ---------- [DI] Use GlobResource for non-tracked directories | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a I noticed that some of my excluded directories are still tracked by the container and changes to files inside them make it recompile. This brought me to the `$trackContents || is_dir($path)` line introduced in #21505. Commits ------- 048eb18 [DI] Use GlobResource for non-tracked directories
2 parents 0b1943e + ae9c06c commit 4c898d5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

ContainerBuilder.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,13 @@ public function fileExists($path, $trackContents = true)
408408
return $exists;
409409
}
410410

411-
if ($trackContents && is_dir($path)) {
412-
$this->addResource(new DirectoryResource($path, is_string($trackContents) ? $trackContents : null));
413-
} elseif ($trackContents || is_dir($path)) {
411+
if (is_dir($path)) {
412+
if ($trackContents) {
413+
$this->addResource(new DirectoryResource($path, is_string($trackContents) ? $trackContents : null));
414+
} else {
415+
$this->addResource(new GlobResource($path, '/*', false));
416+
}
417+
} elseif ($trackContents) {
414418
$this->addResource(new FileResource($path));
415419
}
416420

0 commit comments

Comments
 (0)