Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 32e1f0d

Browse filesBrowse files
[Config][DI] fix tracking of changes to vendor/ dirs
1 parent 60dac0c commit 32e1f0d
Copy full SHA for 32e1f0d

File tree

2 files changed

+17
-4
lines changed
Filter options

2 files changed

+17
-4
lines changed

‎src/Symfony/Component/Config/Resource/ComposerResource.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Resource/ComposerResource.php
+15-3Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,20 @@
2020
*/
2121
class ComposerResource implements SelfCheckingResourceInterface
2222
{
23+
private $vendor;
2324
private $vendors;
2425

2526
private static $runtimeVendors;
2627

27-
public function __construct()
28+
public function __construct(string $vendor = null)
2829
{
30+
$this->vendor = $vendor;
2931
self::refresh();
3032
$this->vendors = self::$runtimeVendors;
33+
34+
if (null !== $vendor && !isset($this->vendors[$vendor])) {
35+
throw new \InvalidArgumentException(sprintf('The "%s" directory is not a vendor directory.', $vendor));
36+
}
3137
}
3238

3339
public function getVendors()
@@ -40,7 +46,7 @@ public function getVendors()
4046
*/
4147
public function __toString()
4248
{
43-
return __CLASS__;
49+
return __CLASS__.$this->vendor;
4450
}
4551

4652
/**
@@ -50,7 +56,13 @@ public function isFresh($timestamp)
5056
{
5157
self::refresh();
5258

53-
return array_values(self::$runtimeVendors) === array_values($this->vendors);
59+
if (null === $this->vendor) {
60+
return array_values(self::$runtimeVendors) === array_values($this->vendors);
61+
}
62+
63+
$resource = $this->vendor.'/composer/installed.json';
64+
65+
return false !== ($filemtime = @filemtime($resource)) && $filemtime <= $timestamp;
5466
}
5567

5668
private static function refresh()

‎src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/ContainerBuilder.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1657,12 +1657,13 @@ private function inVendors(string $path): bool
16571657
if (null === $this->vendors) {
16581658
$resource = new ComposerResource();
16591659
$this->vendors = $resource->getVendors();
1660-
$this->addResource($resource);
16611660
}
16621661
$path = realpath($path) ?: $path;
16631662

16641663
foreach ($this->vendors as $vendor) {
16651664
if (0 === strpos($path, $vendor) && false !== strpbrk(substr($path, \strlen($vendor), 1), '/'.\DIRECTORY_SEPARATOR)) {
1665+
$this->addResource(new ComposerResource($vendor));
1666+
16661667
return true;
16671668
}
16681669
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.