Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commita29fb1e

Browse files
[Config][DependencyInjection] Optimize dumped resources for tracking
1 parent031dde7 commita29fb1e

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,13 @@ private function generateSignature(\ReflectionClass $class): iterable
154154
}
155155

156156
foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED)as$m) {
157+
foreach ($this->excludedVendorsas$vendor) {
158+
$file =$m->getFileName();
159+
if (str_starts_with($file,$vendor) &&false !==strpbrk(substr($file,\strlen($vendor),1),'/'.\DIRECTORY_SEPARATOR)) {
160+
continue2;
161+
}
162+
}
163+
157164
foreach ($m->getAttributes()as$a) {
158165
$attributes[] = [$a->getName(), (string)$a];
159166
}

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespaceSymfony\Component\DependencyInjection;
1313

14+
useComposer\Autoload\ClassLoader;
1415
useComposer\InstalledVersions;
1516
useSymfony\Component\Config\Resource\ClassExistenceResource;
1617
useSymfony\Component\Config\Resource\ComposerResource;
@@ -46,6 +47,7 @@
4647
useSymfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
4748
useSymfony\Component\DependencyInjection\ParameterBag\ParameterBag;
4849
useSymfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
50+
useSymfony\Component\ErrorHandler\DebugClassLoader;
4951
useSymfony\Component\ExpressionLanguage\Expression;
5052
useSymfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
5153

@@ -262,6 +264,53 @@ public function addResource(ResourceInterface $resource): static
262264
if ($resourceinstanceof GlobResource &&$this->inVendors($resource->getPrefix())) {
263265
return$this;
264266
}
267+
if ($resourceinstanceof FileExistenceResource &&$this->inVendors($resource->getResource())) {
268+
return$this;
269+
}
270+
if ($resourceinstanceof FileResource &&$this->inVendors($resource->getResource())) {
271+
return$this;
272+
}
273+
if ($resourceinstanceof DirectoryResource &&$this->inVendors($resource->getResource())) {
274+
return$this;
275+
}
276+
if ($resourceinstanceof ClassExistenceResource) {
277+
$class =$resource->getResource();
278+
279+
$inVendor =false;
280+
foreach (spl_autoload_functions()as$autoloader) {
281+
if (!\is_array($autoloader)) {
282+
continue;
283+
}
284+
285+
if ($autoloader[0]instanceof DebugClassLoader) {
286+
$autoloader =$autoloader[0]->getClassLoader();
287+
}
288+
289+
if (!\is_array($autoloader) || !$autoloader[0]instanceof ClassLoader || !$autoloader[0]->findFile(__CLASS__)) {
290+
continue;
291+
}
292+
293+
foreach ($autoloader[0]->getPrefixesPsr4()as$prefix =>$dirs) {
294+
if ('' ===$prefix || !str_starts_with($class,$prefix)) {
295+
continue;
296+
}
297+
298+
foreach ($dirsas$dir) {
299+
if (!$dir =realpath($dir)) {
300+
continue;
301+
}
302+
303+
if (!$inVendor =$this->inVendors($dir)) {
304+
break3;
305+
}
306+
}
307+
}
308+
}
309+
310+
if ($inVendor) {
311+
return$this;
312+
}
313+
}
265314

266315
$this->resources[(string)$resource] =$resource;
267316

@@ -1694,7 +1743,9 @@ private function inVendors(string $path): bool
16941743

16951744
foreach ($this->vendorsas$vendor) {
16961745
if (str_starts_with($path,$vendor) &&false !==strpbrk(substr($path,\strlen($vendor),1),'/'.\DIRECTORY_SEPARATOR)) {
1746+
$this->pathsInVendor[$vendor.'/composer'] =false;
16971747
$this->addResource(newFileResource($vendor.'/composer/installed.json'));
1748+
$this->pathsInVendor[$vendor.'/composer'] =true;
16981749

16991750
return$this->pathsInVendor[$path] =true;
17001751
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp