Skip to content

Commit f9c0e13

Browse files
committed
fixup! Replace error-prone instanceof in Rules classes
1 parent 8e16e33 commit f9c0e13

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/Rules/Variables/CompactVariablesRule.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use PHPStan\Analyser\Scope;
77
use PHPStan\Rules\Rule;
88
use PHPStan\Rules\RuleErrorBuilder;
9-
use PHPStan\Type\Constant\ConstantArrayType;
109
use PHPStan\Type\Constant\ConstantStringType;
1110
use PHPStan\Type\Type;
1211
use function array_merge;
@@ -70,11 +69,11 @@ public function processNode(Node $node, Scope $scope): array
7069
*/
7170
private function findConstantStrings(Type $type): array
7271
{
73-
if (count($type->getConstantStrings()) > 0) {
72+
if (count($type->getConstantStrings()) === 1) {
7473
return $type->getConstantStrings();
7574
}
7675

77-
if (count($type->getConstantArrays()) > 1) {
76+
if (count($type->getConstantArrays()) === 1) {
7877
$result = [];
7978
foreach ($type->getConstantArrays()[0]->getValueTypes() as $valueType) {
8079
$constantStrings = $this->findConstantStrings($valueType);

0 commit comments

Comments
 (0)