Skip to content

Commit 0917371

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: [HttpKernel] Adjust tests to new "class not found" error message format. Don't call createMock with an array of interfaces. [FrameworkBundle] Fix Tests on PHPUnit 9.3. [WebProfilerBundle] Fix Tests on PHPUnit 9.3. esmtp error not being thrown properly [Yaml Parser] fixed Parser to skip comments when inlining sequences [DI] fix generating preload file when cache_dir is outside project_dir Fix CacheCollectorPass with decorated cache pools [PhpUnitBridge] CoverageListenerTrait update for PHPUnit 8.5/9.x Remove invalid instantiation declaration [PropertyInfo] Fix typed collections in PHP 7.4
2 parents 34692c8 + 0982404 commit 0917371

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Dumper/PhpDumper.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ class %s extends {$options['class']}
326326
$this->asFiles = false;
327327

328328
if ($this->preload && null !== $autoloadFile = $this->getAutoloadFile()) {
329-
$autoloadFile = substr($this->export($autoloadFile), 2, -1);
329+
$autoloadFile = trim($this->export($autoloadFile), '()\\');
330330

331331
$preloadedFiles = array_reverse($preloadedFiles);
332332
$preloadedFiles = implode("';\nrequire __DIR__.'/", $preloadedFiles);
@@ -2123,9 +2123,7 @@ private function doExport($value, bool $resolveEnv = false)
21232123

21242124
private function getAutoloadFile(): ?string
21252125
{
2126-
if (null === $this->targetDirRegex) {
2127-
return null;
2128-
}
2126+
$file = null;
21292127

21302128
foreach (spl_autoload_functions() as $autoloader) {
21312129
if (!\is_array($autoloader)) {
@@ -2144,14 +2142,14 @@ private function getAutoloadFile(): ?string
21442142
if (0 === strpos($class, 'ComposerAutoloaderInit') && $class::getLoader() === $autoloader[0]) {
21452143
$file = \dirname((new \ReflectionClass($class))->getFileName(), 2).'/autoload.php';
21462144

2147-
if (preg_match($this->targetDirRegex.'A', $file)) {
2145+
if (null !== $this->targetDirRegex && preg_match($this->targetDirRegex.'A', $file)) {
21482146
return $file;
21492147
}
21502148
}
21512149
}
21522150
}
21532151

2154-
return null;
2152+
return $file;
21552153
}
21562154

21572155
private function getClasses(Definition $definition, string $id): array

0 commit comments

Comments
 (0)