Skip to content

Commit bec4be4

Browse files
committed
1 parent a6ca5f7 commit bec4be4

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ private function findSymbols(string $file): array
202202
}
203203

204204
// strip heredocs/nowdocs
205-
$contents = preg_replace('{<<<[ \t]*([\'"]?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)(?:\s*)\\2(?=\s+|[;,.)])}s', 'null', $contents);
205+
$contents = preg_replace('{<<<[ \t]*([\'"]?)(\w+)\\1(?:\r\n|\n|\r)(?:.*(?=[\r\n]+[ \t]*\\2))[\r\n]+[ \t]*\\2(?=\s*[;,.)])}s', 'null', $contents);
206206
if ($contents === null) {
207207
return ['classes' => [], 'functions' => []];
208208
}

tests/PHPStan/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,9 @@ public function testBug5525(): void
140140
$factory = self::getContainer()->getByType(OptimizedDirectorySourceLocatorFactory::class);
141141
$locator = $factory->createByFiles([__DIR__ . '/data/bug-5525.php']);
142142
$classReflector = new ClassReflector($locator);
143-
$functionReflector = new FunctionReflector($locator, $classReflector);
144143

145-
$this->expectException(IdentifierNotFound::class);
146-
$functionReflector->reflect('spl_autoload_register');
144+
$class = $classReflector->reflect(\Faker\Provider\nl_BE\Text::class);
145+
$this->assertSame(\Faker\Provider\nl_BE\Text::class, $class->getName());
147146
}
148147

149148
}

0 commit comments

Comments
 (0)