|
4 | 4 |
|
5 | 5 | use Composer\InstalledVersions; |
6 | 6 | use OutOfBoundsException; |
7 | | -use PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound; |
8 | | -use PHPStan\BetterReflection\Reflector\Reflector; |
9 | 7 | use PHPStan\PhpDoc\StubFilesExtension; |
10 | 8 | use function class_exists; |
11 | 9 | use function dirname; |
|
14 | 12 | class StubFilesExtensionLoader implements StubFilesExtension |
15 | 13 | { |
16 | 14 |
|
17 | | - private Reflector $reflector; |
18 | | - |
19 | | - public function __construct( |
20 | | - Reflector $reflector |
21 | | - ) |
22 | | - { |
23 | | - $this->reflector = $reflector; |
24 | | - } |
25 | | - |
26 | 15 | public function getFiles(): array |
27 | 16 | { |
28 | | - $stubsDir = dirname(dirname(dirname(__DIR__))) . '/stubs'; |
| 17 | + $stubsDir = dirname(__DIR__, 3) . '/stubs'; |
29 | 18 | $files = []; |
30 | 19 |
|
31 | 20 | if ($this->isInstalledVersionBelow('symfony/security-bundle', '6.3.0.0')) { |
@@ -82,12 +71,9 @@ public function getFiles(): array |
82 | 71 | if ($this->isInstalledVersionBelow('symfony/http-foundation', '7.4.0.0')) { |
83 | 72 | $files[] = $stubsDir . '/Symfony/Component/HttpFoundation/ParameterBag.stub'; |
84 | 73 |
|
85 | | - try { |
86 | | - $this->reflector->reflectClass('Symfony\Component\HttpFoundation\InputBag'); |
| 74 | + if (!$this->isInstalledVersionBelow('symfony/http-foundation', '5.1.0.0')) { |
87 | 75 | $files[] = $stubsDir . '/Symfony/Component/HttpFoundation/InputBag.stub'; |
88 | 76 | $files[] = $stubsDir . '/Symfony/Component/HttpFoundation/Request.stub'; |
89 | | - } catch (IdentifierNotFound $e) { |
90 | | - // Don't load the InputBag and the associated Request stubs for older Symfony versions that did not have InputBag yet to avoid breaking the Request. |
91 | 77 | } |
92 | 78 | } |
93 | 79 |
|
|
0 commit comments