Skip to content

Commit

Permalink
misc: raise PHPStan version
Browse files Browse the repository at this point in the history
This enables full PHP 8.1 support 🎉
  • Loading branch information
romm committed Dec 31, 2021
1 parent d2795bc commit 0144bf0
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 19 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"require-dev": {
"phpunit/phpunit": "^9.5",
"infection/infection": "^0.25.0",
"phpstan/phpstan": "^1.2",
"phpstan/phpstan": "^1.3",
"phpstan/phpstan-strict-rules": "^1.0",
"friendsofphp/php-cs-fixer": "^3.4",
"marcocesarato/php-conventional-changelog": "^1.12"
Expand Down
6 changes: 0 additions & 6 deletions tests/Integration/Mapping/Type/EnumValuesMappingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,11 @@ public function test_values_are_mapped_properly(): void
$this->mappingFail($error);
}

// @phpstan-ignore-next-line // wait for PHPStan support for PHP 8.1
self::assertSame(PureEnum::FOO, $result->pureEnumWithFirstValue);
// @phpstan-ignore-next-line // wait for PHPStan support for PHP 8.1
self::assertSame(PureEnum::BAR, $result->pureEnumWithSecondValue);
// @phpstan-ignore-next-line // wait for PHPStan support for PHP 8.1
self::assertSame(BackedStringEnum::FOO, $result->backedStringEnumWithFirstValue);
// @phpstan-ignore-next-line // wait for PHPStan support for PHP 8.1
self::assertSame(BackedStringEnum::BAR, $result->backedStringEnumWithSecondValue);
// @phpstan-ignore-next-line // wait for PHPStan support for PHP 8.1
self::assertSame(BackedIntegerEnum::FOO, $result->backedIntegerEnumWithFirstValue);
// @phpstan-ignore-next-line // wait for PHPStan support for PHP 8.1
self::assertSame(BackedIntegerEnum::BAR, $result->backedIntegerEnumWithSecondValue);
}
}
Expand Down
4 changes: 0 additions & 4 deletions tests/Unit/Mapper/Tree/Builder/EnumNodeBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public function test_invalid_type_fails_assertion(): void

public function test_invalid_value_throws_exception(): void
{
// @phpstan-ignore-next-line // wait for PHPStan support for PHP 8.1
$type = new EnumType(PureEnum::class);

$this->expectException(InvalidEnumValue::class);
Expand All @@ -52,7 +51,6 @@ public function test_invalid_value_throws_exception(): void

public function test_invalid_string_value_throws_exception(): void
{
// @phpstan-ignore-next-line // wait for PHPStan support for PHP 8.1
$type = new EnumType(BackedStringEnum::class);

$this->expectException(InvalidEnumValue::class);
Expand All @@ -64,7 +62,6 @@ public function test_invalid_string_value_throws_exception(): void

public function test_boolean_instead_of_integer_value_throws_exception(): void
{
// @phpstan-ignore-next-line // wait for PHPStan support for PHP 8.1
$type = new EnumType(BackedIntegerEnum::class);

$this->expectException(InvalidEnumValue::class);
Expand All @@ -76,7 +73,6 @@ public function test_boolean_instead_of_integer_value_throws_exception(): void

public function test_invalid_integer_value_throws_exception(): void
{
// @phpstan-ignore-next-line // wait for PHPStan support for PHP 8.1
$type = new EnumType(BackedIntegerEnum::class);

$this->expectException(InvalidEnumValue::class);
Expand Down
8 changes: 0 additions & 8 deletions tests/Unit/Type/Types/EnumTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,12 @@ protected function setUp(): void
{
parent::setUp();

// @phpstan-ignore-next-line // wait for PHPStan support for PHP 8.1
$this->enumType = new EnumType(PureEnum::class);
}

public function test_accepts_correct_values(): void
{
// @phpstan-ignore-next-line // wait for PHPStan support for PHP 8.1
self::assertTrue($this->enumType->accepts(PureEnum::FOO));
// @phpstan-ignore-next-line // wait for PHPStan support for PHP 8.1
self::assertTrue($this->enumType->accepts(PureEnum::BAR));
}

Expand All @@ -55,19 +52,15 @@ public function test_string_value_is_correct(): void

public function test_matches_same_enum_type(): void
{
// @phpstan-ignore-next-line // wait for PHPStan support for PHP 8.1
$enumTypeA = new EnumType(PureEnum::class);
// @phpstan-ignore-next-line // wait for PHPStan support for PHP 8.1
$enumTypeB = new EnumType(PureEnum::class);

self::assertTrue($enumTypeA->matches($enumTypeB));
}

public function test_does_not_match_other_enum_type(): void
{
// @phpstan-ignore-next-line // wait for PHPStan support for PHP 8.1
$enumTypeA = new EnumType(PureEnum::class);
// @phpstan-ignore-next-line // wait for PHPStan support for PHP 8.1
$enumTypeB = new EnumType(BackedStringEnum::class);

self::assertFalse($enumTypeA->matches($enumTypeB));
Expand All @@ -92,7 +85,6 @@ public function test_matches_union_type_containing_float_type(): void
{
$unionType = new UnionType(
new FakeType(),
// @phpstan-ignore-next-line // wait for PHPStan support for PHP 8.1
new EnumType(PureEnum::class),
new FakeType(),
);
Expand Down

0 comments on commit 0144bf0

Please sign in to comment.