Skip to content

Commit 06ef13e

Browse files
committed
Update BetterReflection to version that uses PHPStan namespace
1 parent 5aa8a55 commit 06ef13e

File tree

46 files changed

+194
-203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+194
-203
lines changed

build/baseline-7.4.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,6 @@ parameters:
9393
count: 1
9494
path: ../src/Reflection/ReflectionProvider/SetterReflectionProviderProvider.php
9595
-
96-
message: "#^Class class@anonymous/src/Testing/TestCase\\.php\\:268 has an uninitialized property \\$reflectionProvider\\. Give it default value or assign it in the constructor\\.$#"
96+
message: "#^Class class@anonymous/src/Testing/TestCase\\.php\\:267 has an uninitialized property \\$reflectionProvider\\. Give it default value or assign it in the constructor\\.$#"
9797
count: 1
9898
path: ../src/Testing/TestCase.php

compiler/build/scoper.inc.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,6 @@ function (string $filePath, string $prefix, string $content): string {
121121
return $class;
122122
}
123123

124-
if (strpos($class, 'Roave\\BetterReflection\\') === 0) {
125-
return $class;
126-
}
127-
128124
if (strpos($class, '@') === 0) {
129125
return $class;
130126
}
@@ -217,7 +213,6 @@ function (string $filePath, string $prefix, string $content): string {
217213
'PHPStan\*',
218214
'PhpParser\*',
219215
'Hoa\*',
220-
'Roave\BetterReflection\*',
221216
],
222217
'whitelist-global-functions' => false,
223218
'whitelist-global-classes' => false,

compiler/src/Console/CompileCommand.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,8 @@ private function buildPreloadScript(): void
201201
$output = '';
202202
foreach ($finder->files()->name('*.php')->in([
203203
$this->buildDir . '/src',
204-
$this->buildDir . '/stubs/runtime',
205204
$vendorDir . '/nikic/php-parser/lib/PhpParser',
206205
$vendorDir . '/phpstan/phpdoc-parser/src',
207-
$vendorDir . '/ondrejmirtes/better-reflection/src',
208206
])->exclude([
209207
'Testing',
210208
]) as $phpFile) {

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"nette/utils": "^3.1.3",
2424
"nikic/php-parser": "4.10.4",
2525
"ondram/ci-detector": "^3.4.0",
26-
"ondrejmirtes/better-reflection": "4.3.50",
26+
"ondrejmirtes/better-reflection": "4.3.51",
2727
"phpdocumentor/reflection-docblock": "4.3.4",
2828
"phpstan/php-8-stubs": "^0.1.12",
2929
"phpstan/phpdoc-parser": "^0.4.9",

composer.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

conf/config.neon

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ parameters:
9898
- '#^PhpParser\\#'
9999
- '#^PHPStan\\#'
100100
- '#^Hoa\\#'
101-
- '#^Roave\\BetterReflection\\#'
102101
dynamicConstantNames:
103102
- ICONV_IMPL
104103
- LIBXML_VERSION
@@ -1331,7 +1330,7 @@ services:
13311330
- PHPStan\Reflection\ReflectionProvider
13321331

13331332
betterReflectionSourceLocator:
1334-
class: Roave\BetterReflection\SourceLocator\Type\SourceLocator
1333+
class: PHPStan\BetterReflection\SourceLocator\Type\SourceLocator
13351334
factory: @PHPStan\Reflection\BetterReflection\BetterReflectionSourceLocatorFactory::create
13361335
autowired: false
13371336

@@ -1405,17 +1404,17 @@ services:
14051404
implement: PHPStan\Reflection\BetterReflection\BetterReflectionProviderFactory
14061405

14071406
-
1408-
class: Roave\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber
1407+
class: PHPStan\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber
14091408
arguments:
14101409
phpParser: @php8PhpParser
14111410
phpVersionId: %phpVersion%
14121411
autowired:
1413-
- Roave\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber
1412+
- PHPStan\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber
14141413

14151414
-
1416-
class: Roave\BetterReflection\SourceLocator\SourceStubber\ReflectionSourceStubber
1415+
class: PHPStan\BetterReflection\SourceLocator\SourceStubber\ReflectionSourceStubber
14171416
autowired:
1418-
- Roave\BetterReflection\SourceLocator\SourceStubber\ReflectionSourceStubber
1417+
- PHPStan\BetterReflection\SourceLocator\SourceStubber\ReflectionSourceStubber
14191418

14201419
php8Lexer:
14211420
class: PhpParser\Lexer\Emulative

conf/config.stubValidator.neon

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,27 @@ services:
2525
autowired: false
2626

2727
stubClassReflector:
28-
class: Roave\BetterReflection\Reflector\ClassReflector
28+
class: PHPStan\BetterReflection\Reflector\ClassReflector
2929
arguments:
3030
sourceLocator: @stubSourceLocator
3131
autowired: false
3232

3333
stubFunctionReflector:
34-
class: Roave\BetterReflection\Reflector\FunctionReflector
34+
class: PHPStan\BetterReflection\Reflector\FunctionReflector
3535
arguments:
3636
classReflector: @stubClassReflector
3737
sourceLocator: @stubSourceLocator
3838
autowired: false
3939

4040
stubConstantReflector:
41-
class: Roave\BetterReflection\Reflector\ConstantReflector
41+
class: PHPStan\BetterReflection\Reflector\ConstantReflector
4242
arguments:
4343
classReflector: @stubClassReflector
4444
sourceLocator: @stubSourceLocator
4545
autowired: false
4646

4747
stubSourceLocator:
48-
class: Roave\BetterReflection\SourceLocator\Type\SourceLocator
48+
class: PHPStan\BetterReflection\SourceLocator\Type\SourceLocator
4949
factory: @PHPStan\PhpDoc\StubSourceLocatorFactory::create()
5050
autowired: false
5151

src/Analyser/FileAnalyser.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
use PhpParser\Comment;
66
use PhpParser\Node;
7+
use PHPStan\BetterReflection\NodeCompiler\Exception\UnableToCompileNode;
8+
use PHPStan\BetterReflection\Reflection\Exception\NotAClassReflection;
9+
use PHPStan\BetterReflection\Reflection\Exception\NotAnInterfaceReflection;
10+
use PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound;
711
use PHPStan\Dependency\DependencyResolver;
812
use PHPStan\Node\FileNode;
913
use PHPStan\Parser\Parser;
@@ -14,10 +18,6 @@
1418
use PHPStan\Rules\NonIgnorableRuleError;
1519
use PHPStan\Rules\Registry;
1620
use PHPStan\Rules\TipRuleError;
17-
use Roave\BetterReflection\NodeCompiler\Exception\UnableToCompileNode;
18-
use Roave\BetterReflection\Reflection\Exception\NotAClassReflection;
19-
use Roave\BetterReflection\Reflection\Exception\NotAnInterfaceReflection;
20-
use Roave\BetterReflection\Reflector\Exception\IdentifierNotFound;
2121
use function array_key_exists;
2222
use function array_unique;
2323

src/Analyser/NodeScopeResolver.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
use PhpParser\Node\Stmt\TryCatch;
4747
use PhpParser\Node\Stmt\Unset_;
4848
use PhpParser\Node\Stmt\While_;
49+
use PHPStan\BetterReflection\Reflection\Adapter\ReflectionClass;
50+
use PHPStan\BetterReflection\Reflector\ClassReflector;
51+
use PHPStan\BetterReflection\SourceLocator\Ast\Strategy\NodeToReflection;
52+
use PHPStan\BetterReflection\SourceLocator\Located\LocatedSource;
4953
use PHPStan\DependencyInjection\Reflection\ClassReflectionExtensionRegistryProvider;
5054
use PHPStan\File\FileHelper;
5155
use PHPStan\File\FileReader;
@@ -114,10 +118,6 @@
114118
use PHPStan\Type\TypeTraverser;
115119
use PHPStan\Type\TypeUtils;
116120
use PHPStan\Type\UnionType;
117-
use Roave\BetterReflection\Reflection\Adapter\ReflectionClass;
118-
use Roave\BetterReflection\Reflector\ClassReflector;
119-
use Roave\BetterReflection\SourceLocator\Ast\Strategy\NodeToReflection;
120-
use Roave\BetterReflection\SourceLocator\Located\LocatedSource;
121121

122122
class NodeScopeResolver
123123
{
@@ -1257,7 +1257,7 @@ private function createAstClassReflection(Node\Stmt\ClassLike $stmt, Scope $scop
12571257
new LocatedSource(FileReader::read($scope->getFile()), $scope->getFile()),
12581258
$scope->getNamespace() !== null ? new Node\Stmt\Namespace_(new Name($scope->getNamespace())) : null
12591259
);
1260-
if (!$betterReflectionClass instanceof \Roave\BetterReflection\Reflection\ReflectionClass) {
1260+
if (!$betterReflectionClass instanceof \PHPStan\BetterReflection\Reflection\ReflectionClass) {
12611261
throw new \PHPStan\ShouldNotHappenException();
12621262
}
12631263

src/DependencyInjection/ContainerFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
use Nette\DI\Extensions\PhpExtension;
66
use Phar;
7+
use PHPStan\BetterReflection\BetterReflection;
8+
use PHPStan\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber;
79
use PHPStan\Broker\Broker;
810
use PHPStan\Command\CommandHelper;
911
use PHPStan\File\FileHelper;
1012
use PHPStan\Php\PhpVersion;
11-
use Roave\BetterReflection\BetterReflection;
12-
use Roave\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber;
1313
use Symfony\Component\Finder\Finder;
1414
use function sys_get_temp_dir;
1515

0 commit comments

Comments
 (0)