File tree Expand file tree Collapse file tree
tests/PHPStan/Analyser/nsrt Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515use PHPStan \Reflection \FunctionReflection ;
1616use PHPStan \Rules \Properties \PropertyReflectionFinder ;
1717use PHPStan \Type \Accessory \HasPropertyType ;
18- use PHPStan \Type \ClassStringType ;
1918use PHPStan \Type \Constant \ConstantBooleanType ;
2019use PHPStan \Type \FunctionTypeSpecifyingExtension ;
2120use PHPStan \Type \IntersectionType ;
2221use PHPStan \Type \ObjectWithoutClassType ;
23- use PHPStan \Type \UnionType ;
2422use function count ;
2523
2624#[AutowiredService]
@@ -80,18 +78,7 @@ public function specifyTypes(
8078 }
8179
8280 if (!$ objectOrStringType ->isObject ()->yes ()) {
83- return $ this ->typeSpecifier ->create (
84- $ args [0 ]->value ,
85- new UnionType ([
86- new IntersectionType ([
87- new ObjectWithoutClassType (),
88- new HasPropertyType ($ propertyNameType ->getValue ()),
89- ]),
90- new ClassStringType (),
91- ]),
92- $ context ,
93- $ scope ,
94- );
81+ return new SpecifiedTypes ([], []);
9582 }
9683
9784 $ propertyNode = new PropertyFetch (
Original file line number Diff line number Diff line change 99 */
1010function testObjectOrString ($ objectOrClass ): void {
1111 if (property_exists ($ objectOrClass , 'foo ' )) {
12- assertType ('class-string|( object&hasProperty(foo)) ' , $ objectOrClass );
12+ assertType ('object|string ' , $ objectOrClass );
1313 }
1414}
1515
@@ -18,6 +18,6 @@ function testObjectOrString($objectOrClass): void {
1818 */
1919function testObjectOrClassString ($ objectOrClass ): void {
2020 if (property_exists ($ objectOrClass , 'bar ' )) {
21- assertType ('class-string|( object&hasProperty(bar)) ' , $ objectOrClass );
21+ assertType ('class-string|object ' , $ objectOrClass );
2222 }
2323}
You can’t perform that action at this time.
0 commit comments