From b8a6c976b4a477fad3dd6fa7e8564cf82a2aa2b3 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 7 Sep 2021 12:48:24 +0700 Subject: [PATCH] [TypeDeclaration] Handle UnitEnum not exists check on ParamTypeByParentCallTypeRector (#841) --- build/target-repository/bootstrap.php | 13 +++++++++++++ .../Fixture/extends_exception.php.inc | 13 +++++++++++++ stubs/Php/UnitEnum.php | 2 -- 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/ParamTypeByParentCallTypeRector/Fixture/extends_exception.php.inc diff --git a/build/target-repository/bootstrap.php b/build/target-repository/bootstrap.php index a91d01fd102..dfc4f15a887 100644 --- a/build/target-repository/bootstrap.php +++ b/build/target-repository/bootstrap.php @@ -36,3 +36,16 @@ spl_autoload_register(function (string $class): void { } } }); + +if (! interface_exists('UnitEnum')) { + /** + * @since 8.1 + */ + interface UnitEnum + { + /** + * @return static[] + */ + public static function cases(): array; + } +} diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ParamTypeByParentCallTypeRector/Fixture/extends_exception.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ParamTypeByParentCallTypeRector/Fixture/extends_exception.php.inc new file mode 100644 index 00000000000..0c1f2c987f1 --- /dev/null +++ b/rules-tests/TypeDeclaration/Rector/ClassMethod/ParamTypeByParentCallTypeRector/Fixture/extends_exception.php.inc @@ -0,0 +1,13 @@ +message = $message; + $this->code = $code; + } +} \ No newline at end of file diff --git a/stubs/Php/UnitEnum.php b/stubs/Php/UnitEnum.php index 19770e0e4c3..ec0d11367ff 100644 --- a/stubs/Php/UnitEnum.php +++ b/stubs/Php/UnitEnum.php @@ -11,8 +11,6 @@ if (interface_exists('UnitEnum')) { */ interface UnitEnum { - public string $name; - /** * @return static[] */