File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1079,17 +1079,7 @@ private function resolveType(Expr $node): Type
10791079 } elseif ($ node instanceof Node \Scalar \MagicConst \File) {
10801080 return new ConstantStringType ($ this ->getFile ());
10811081 } elseif ($ node instanceof Node \Scalar \MagicConst \Namespace_) {
1082- if (!$ this ->isInClass ()) {
1083- return new ConstantStringType ('' );
1084- }
1085-
1086- $ className = $ this ->getClassReflection ()->getName ();
1087- $ parts = explode ('\\' , $ className );
1088- if (count ($ parts ) <= 1 ) {
1089- return new ConstantStringType ('' );
1090- }
1091-
1092- return new ConstantStringType ($ parts [0 ]);
1082+ return new ConstantStringType ($ this ->namespace ?? '' );
10931083 } elseif ($ node instanceof Node \Scalar \MagicConst \Method) {
10941084 if ($ this ->isInAnonymousFunction ()) {
10951085 return new ConstantStringType ('{closure} ' );
Original file line number Diff line number Diff line change @@ -2339,15 +2339,15 @@ public function dataBinaryOperations(): array
23392339 '$file ' ,
23402340 ],
23412341 [
2342- '\'BinaryOperations \'' ,
2342+ '\'BinaryOperations \\\\ NestedNamespace \ '' ,
23432343 '$namespace ' ,
23442344 ],
23452345 [
2346- '\'BinaryOperations \\\\Foo \'' ,
2346+ '\'BinaryOperations \\\\NestedNamespace \\\\ Foo \'' ,
23472347 '$class ' ,
23482348 ],
23492349 [
2350- '\'BinaryOperations \\\\Foo::doFoo \'' ,
2350+ '\'BinaryOperations \\\\NestedNamespace \\\\ Foo::doFoo \'' ,
23512351 '$method ' ,
23522352 ],
23532353 [
@@ -2508,7 +2508,7 @@ public function dataBinaryOperations(): array
25082508 ],
25092509 [
25102510 'true ' ,
2511- '$foo instanceof \BinaryOperations\Foo ' ,
2511+ '$foo instanceof \BinaryOperations\NestedNamespace\ Foo ' ,
25122512 ],
25132513 [
25142514 'bool ' ,
Original file line number Diff line number Diff line change 11<?php
22
3- namespace BinaryOperations ;
3+ namespace BinaryOperations \ NestedNamespace ;
44
55class Foo
66{
You can’t perform that action at this time.
0 commit comments