[PHPStan] Update to PHPStan 0.12.99 (#874)

* [PHPStan] Update to PHPStan 0.12.99

* add BackedEnum to stub

* final touch: comment

* final touch: move to next if

* final touch: clean up
This commit is contained in:
Abdul Malik Ikhsan 2021-09-13 20:27:39 +07:00 committed by GitHub
parent 430041fd55
commit 41dfd36407
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 3 deletions

View File

@ -26,7 +26,7 @@ jobs:
-
name: 'Along PHPStan'
install: composer require phpstan/phpstan:^0.12.98 --dev --ansi
install: composer require phpstan/phpstan:^0.12.99 --dev --ansi
name: "PHP ${{ matrix.php_version }}"

View File

@ -49,3 +49,13 @@ if (! interface_exists('UnitEnum')) {
public static function cases(): array;
}
}
if (! interface_exists('BackedEnum')) {
/**
* @since 8.1
*/
interface BackedEnum extends UnitEnum {
public static function from(int|string $value): static;
public static function tryFrom(int|string $value): ?static;
}
}

View File

@ -7,7 +7,7 @@
],
"require": {
"php": "^7.1|^8.0",
"phpstan/phpstan": "0.12.98"
"phpstan/phpstan": "0.12.99"
},
"autoload": {
"files": [

View File

@ -20,7 +20,7 @@
"nette/utils": "^3.2",
"nikic/php-parser": "4.12.0",
"phpstan/phpdoc-parser": "^0.5.5",
"phpstan/phpstan": "0.12.98",
"phpstan/phpstan": "0.12.99",
"phpstan/phpstan-phpunit": "^0.12.22",
"rector/extension-installer": "^0.11.0",
"rector/rector-cakephp": "^0.11.3",

15
stubs/Php/BackedEnum.php Normal file
View File

@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
if (interface_exists('BackedEnum')) {
return;
}
/**
* @since 8.1
*/
interface BackedEnum extends UnitEnum {
public static function from(int|string $value): static;
public static function tryFrom(int|string $value): ?static;
}