Skip to content

Commit ee1d458

Browse files
committed
use TrinaryLogic over bool
1 parent ba27dec commit ee1d458

17 files changed

+19
-18
lines changed

Diff for: src/Type/Accessory/AccessoryArrayListType.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public function unsetOffset(Type $offsetType): Type
172172
return new ErrorType();
173173
}
174174

175-
public function getKeysArrayFiltered(Type $filterValueType, bool $strict): Type
175+
public function getKeysArrayFiltered(Type $filterValueType, TrinaryLogic $strict): Type
176176
{
177177
return $this->getKeysArray();
178178
}

Diff for: src/Type/Accessory/HasOffsetType.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ public function looseCompare(Type $type, PhpVersion $phpVersion): BooleanType
343343
return new BooleanType();
344344
}
345345

346-
public function getKeysArrayFiltered(Type $filterValueType, bool $strict): Type
346+
public function getKeysArrayFiltered(Type $filterValueType, TrinaryLogic $strict): Type
347347
{
348348
return $this->getKeysArray();
349349
}

Diff for: src/Type/Accessory/HasOffsetValueType.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public function unsetOffset(Type $offsetType): Type
195195
return $this;
196196
}
197197

198-
public function getKeysArrayFiltered(Type $filterValueType, bool $strict): Type
198+
public function getKeysArrayFiltered(Type $filterValueType, TrinaryLogic $strict): Type
199199
{
200200
return $this->getKeysArray();
201201
}

Diff for: src/Type/Accessory/NonEmptyArrayType.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public function unsetOffset(Type $offsetType): Type
159159
return new ErrorType();
160160
}
161161

162-
public function getKeysArrayFiltered(Type $filterValueType, bool $strict): Type
162+
public function getKeysArrayFiltered(Type $filterValueType, TrinaryLogic $strict): Type
163163
{
164164
return $this->getKeysArray();
165165
}

Diff for: src/Type/Accessory/OversizedArrayType.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function unsetOffset(Type $offsetType): Type
154154
return new ErrorType();
155155
}
156156

157-
public function getKeysArrayFiltered(Type $filterValueType, bool $strict): Type
157+
public function getKeysArrayFiltered(Type $filterValueType, TrinaryLogic $strict): Type
158158
{
159159
return $this->getKeysArray();
160160
}

Diff for: src/Type/ArrayType.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public function generalizeValues(): self
170170
return new self($this->keyType, $this->itemType->generalize(GeneralizePrecision::lessSpecific()));
171171
}
172172

173-
public function getKeysArrayFiltered(Type $filterValueType, bool $strict): Type
173+
public function getKeysArrayFiltered(Type $filterValueType, TrinaryLogic $strict): Type
174174
{
175175
return $this->getKeysArray();
176176
}

Diff for: src/Type/Constant/ConstantArrayType.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ public function generalizeValues(): self
12511251
return new self($this->keyTypes, $valueTypes, $this->nextAutoIndexes, $this->optionalKeys, $this->isList);
12521252
}
12531253

1254-
public function getKeysArrayFiltered(Type $filterValueType, bool $strict): Type
1254+
public function getKeysArrayFiltered(Type $filterValueType, TrinaryLogic $strict): Type
12551255
{
12561256
$keysArray = $this->getKeysOrValuesArray($this->keyTypes);
12571257

Diff for: src/Type/IntersectionType.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ public function unsetOffset(Type $offsetType): Type
799799
return $this->intersectTypes(static fn (Type $type): Type => $type->unsetOffset($offsetType));
800800
}
801801

802-
public function getKeysArrayFiltered(Type $filterValueType, bool $strict): Type
802+
public function getKeysArrayFiltered(Type $filterValueType, TrinaryLogic $strict): Type
803803
{
804804
return $this->intersectTypes(static fn (Type $type): Type => $type->getKeysArrayFiltered($filterValueType, $strict));
805805
}

Diff for: src/Type/MixedType.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public function unsetOffset(Type $offsetType): Type
179179
return $this;
180180
}
181181

182-
public function getKeysArrayFiltered(Type $filterValueType, bool $strict): Type
182+
public function getKeysArrayFiltered(Type $filterValueType, TrinaryLogic $strict): Type
183183
{
184184
return $this->getKeysArray();
185185
}

Diff for: src/Type/NeverType.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ public function unsetOffset(Type $offsetType): Type
273273
return new NeverType();
274274
}
275275

276-
public function getKeysArrayFiltered(Type $filterValueType, bool $strict): Type
276+
public function getKeysArrayFiltered(Type $filterValueType, TrinaryLogic $strict): Type
277277
{
278278
return $this->getKeysArray();
279279
}

Diff for: src/Type/Php/ArrayKeysFunctionDynamicReturnTypeExtension.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use PHPStan\Analyser\Scope;
77
use PHPStan\Php\PhpVersion;
88
use PHPStan\Reflection\FunctionReflection;
9+
use PHPStan\TrinaryLogic;
910
use PHPStan\Type\DynamicFunctionReturnTypeExtension;
1011
use PHPStan\Type\NeverType;
1112
use PHPStan\Type\NullType;
@@ -39,9 +40,9 @@ public function getTypeFromFunctionCall(FunctionReflection $functionReflection,
3940
if (count($functionCall->getArgs()) >= 2) {
4041
$filterType = $scope->getType($functionCall->getArgs()[1]->value);
4142

42-
$strict = false;
43+
$strict = TrinaryLogic::createNo();
4344
if (count($functionCall->getArgs()) >= 3) {
44-
$strict = $scope->getType($functionCall->getArgs()[2]->value)->isTrue()->yes();
45+
$strict = $scope->getType($functionCall->getArgs()[2]->value)->isTrue();
4546
}
4647

4748
return $arrayType->getKeysArrayFiltered($filterType, $strict);

Diff for: src/Type/StaticType.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ public function unsetOffset(Type $offsetType): Type
396396
return $this->getStaticObjectType()->unsetOffset($offsetType);
397397
}
398398

399-
public function getKeysArrayFiltered(Type $filterValueType, bool $strict): Type
399+
public function getKeysArrayFiltered(Type $filterValueType, TrinaryLogic $strict): Type
400400
{
401401
return $this->getStaticObjectType()->getKeysArrayFiltered($filterValueType, $strict);
402402
}

Diff for: src/Type/Traits/LateResolvableTypeTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public function unsetOffset(Type $offsetType): Type
248248
return $this->resolve()->unsetOffset($offsetType);
249249
}
250250

251-
public function getKeysArrayFiltered(Type $filterValueType, bool $strict): Type
251+
public function getKeysArrayFiltered(Type $filterValueType, TrinaryLogic $strict): Type
252252
{
253253
return $this->resolve()->getKeysArrayFiltered($filterValueType, $strict);
254254
}

Diff for: src/Type/Traits/MaybeArrayTypeTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function isList(): TrinaryLogic
3939
return TrinaryLogic::createMaybe();
4040
}
4141

42-
public function getKeysArrayFiltered(Type $filterValueType, bool $strict): Type
42+
public function getKeysArrayFiltered(Type $filterValueType, TrinaryLogic $strict): Type
4343
{
4444
return $this->getKeysArray();
4545
}

Diff for: src/Type/Traits/NonArrayTypeTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function isList(): TrinaryLogic
3939
return TrinaryLogic::createNo();
4040
}
4141

42-
public function getKeysArrayFiltered(Type $filterValueType, bool $strict): Type
42+
public function getKeysArrayFiltered(Type $filterValueType, TrinaryLogic $strict): Type
4343
{
4444
return $this->getKeysArray();
4545
}

Diff for: src/Type/Type.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function setExistingOffsetValueType(Type $offsetType, Type $valueType): T
134134

135135
public function unsetOffset(Type $offsetType): Type;
136136

137-
public function getKeysArrayFiltered(Type $filterValueType, bool $strict): Type;
137+
public function getKeysArrayFiltered(Type $filterValueType, TrinaryLogic $strict): Type;
138138

139139
public function getKeysArray(): Type;
140140

Diff for: src/Type/UnionType.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ public function unsetOffset(Type $offsetType): Type
730730
return $this->unionTypes(static fn (Type $type): Type => $type->unsetOffset($offsetType));
731731
}
732732

733-
public function getKeysArrayFiltered(Type $filterValueType, bool $strict): Type
733+
public function getKeysArrayFiltered(Type $filterValueType, TrinaryLogic $strict): Type
734734
{
735735
return $this->unionTypes(static fn (Type $type): Type => $type->getKeysArrayFiltered($filterValueType, $strict));
736736
}

0 commit comments

Comments
 (0)