|
16 | 16 | use PHPStan\Rules\Properties\PropertyReflectionFinder; |
17 | 17 | use PHPStan\Type\Accessory\HasPropertyType; |
18 | 18 | use PHPStan\Type\Constant\ConstantBooleanType; |
19 | | -use PHPStan\Type\Constant\ConstantStringType; |
20 | 19 | use PHPStan\Type\FunctionTypeSpecifyingExtension; |
21 | 20 | use PHPStan\Type\IntersectionType; |
22 | 21 | use PHPStan\Type\ObjectWithoutClassType; |
@@ -72,23 +71,22 @@ public function specifyTypes( |
72 | 71 | } |
73 | 72 |
|
74 | 73 | $objectType = $scope->getType($node->getArgs()[0]->value); |
75 | | - if ($objectType instanceof ConstantStringType) { |
| 74 | + |
| 75 | + if (!$objectType->isObject()->yes()) { |
76 | 76 | return new SpecifiedTypes([], []); |
77 | | - } elseif ($objectType->isObject()->yes()) { |
78 | | - $propertyNodes = []; |
79 | | - |
80 | | - foreach ($propertyNameTypes as $propertyNameType) { |
81 | | - if ($propertyNameType->getValue() === '') { |
82 | | - return new SpecifiedTypes([], []); |
83 | | - } |
84 | | - |
85 | | - $propertyNodes[] = new PropertyFetch( |
86 | | - $node->getArgs()[0]->value, |
87 | | - new Identifier($propertyNameType->getValue()), |
88 | | - ); |
| 77 | + } |
| 78 | + |
| 79 | + $propertyNodes = []; |
| 80 | + |
| 81 | + foreach ($propertyNameTypes as $propertyNameType) { |
| 82 | + if ($propertyNameType->getValue() === '') { |
| 83 | + return new SpecifiedTypes([], []); |
89 | 84 | } |
90 | | - } else { |
91 | | - return new SpecifiedTypes([], []); |
| 85 | + |
| 86 | + $propertyNodes[] = new PropertyFetch( |
| 87 | + $node->getArgs()[0]->value, |
| 88 | + new Identifier($propertyNameType->getValue()), |
| 89 | + ); |
92 | 90 | } |
93 | 91 |
|
94 | 92 | foreach ($propertyNodes as $propertyNode) { |
|
0 commit comments