Skip to content

Commit bb13df9

Browse files
committed
simplify
1 parent e77c34e commit bb13df9

File tree

6 files changed

+4
-19
lines changed

6 files changed

+4
-19
lines changed

build/ignore-by-php-version.neon.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
$includes[] = __DIR__ . '/readonly-property.neon';
1212
}
1313

14-
if (PHP_VERSION_ID >= 80200) {
15-
$includes[] = __DIR__ . '/never-assigned-true-false.neon';
16-
}
17-
1814
if (PHP_VERSION_ID >= 70400) {
1915
$includes[] = __DIR__ . '/ignore-gte-php7.4-errors.neon';
2016
}

build/never-assigned-true-false.neon

Lines changed: 0 additions & 6 deletions
This file was deleted.

build/phpstan.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ parameters:
115115
count: 1
116116
path: ../src/Diagnose/PHPStanDiagnoseExtension.php
117117
- '#^Short ternary operator is not allowed#'
118-
119118
reportStaticMethodSignatures: true
120119
tmpDir: %rootDir%/tmp
121120
stubFiles:

src/Php/PhpVersions.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,4 @@ public function supportsNamedArgumentAfterUnpackedArgument(): TrinaryLogic
4343
return IntegerRangeType::fromInterval(80100, null)->isSuperTypeOf($this->phpVersions)->result;
4444
}
4545

46-
public function supportsTrueAndFalseStandaloneType(): TrinaryLogic
47-
{
48-
return IntegerRangeType::fromInterval(80200, null)->isSuperTypeOf($this->phpVersions)->result;
49-
}
50-
5146
}

src/Rules/TooWideTypehints/TooWidePropertyTypeRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function processNode(Node $node, Scope $scope): array
5757

5858
$propertyReflection = $classReflection->getNativeProperty($propertyName);
5959
$propertyType = $propertyReflection->getWritableType();
60-
if (!$propertyType instanceof UnionType) {
60+
if (!$propertyType instanceof UnionType && !$propertyType->isBoolean()->yes()) {
6161
continue;
6262
}
6363
foreach ($this->extensionProvider->getExtensions() as $extension) {

src/Rules/TooWideTypehints/TooWideTypeCheck.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,16 @@ final class TooWideTypeCheck
2626
*/
2727
public function checkProperty(
2828
ClassPropertyNode $property,
29-
UnionType $propertyType,
29+
Type $propertyType,
3030
string $propertyDescription,
3131
Type $assignedType,
3232
): array
3333
{
3434
$errors = [];
3535

3636
$verbosityLevel = VerbosityLevel::getRecommendedLevelByType($propertyType, $assignedType);
37-
foreach ($propertyType->getTypes() as $type) {
37+
$propertyTypes = $propertyType instanceof UnionType ? $propertyType->getTypes() : $propertyType->getFiniteTypes();
38+
foreach ($propertyTypes as $type) {
3839
if (!$type->isSuperTypeOf($assignedType)->no()) {
3940
continue;
4041
}

0 commit comments

Comments
 (0)