From 8b5c23ef54cb25eee962d5848e937ea94e907a78 Mon Sep 17 00:00:00 2001 From: Martin Melka Date: Wed, 2 Dec 2020 10:56:08 +0100 Subject: [PATCH 1/2] Add false to return types of class_implements() The \class_implements() function may return an array or false when it fails Based on https://github.com/phpstan/phpstan/issues/4172 --- resources/functionMap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/functionMap.php b/resources/functionMap.php index 7cf36b7e16..658cf409ac 100644 --- a/resources/functionMap.php +++ b/resources/functionMap.php @@ -949,7 +949,7 @@ 'chunk_split' => ['string', 'str'=>'string', 'chunklen='=>'int', 'ending='=>'string'], 'class_alias' => ['bool', 'user_class_name'=>'string', 'alias_name'=>'string', 'autoload='=>'bool'], 'class_exists' => ['bool', 'classname'=>'string', 'autoload='=>'bool'], -'class_implements' => ['array', 'what'=>'object|string', 'autoload='=>'bool'], +'class_implements' => ['array|false', 'what'=>'object|string', 'autoload='=>'bool'], 'class_parents' => ['array', 'instance'=>'object|string', 'autoload='=>'bool'], 'class_uses' => ['array', 'what'=>'object|string', 'autoload='=>'bool'], 'classkit_import' => ['array', 'filename'=>'string'], From 56b7f265044bad8f298f30143dc4ef59492d871d Mon Sep 17 00:00:00 2001 From: Martin Melka Date: Wed, 2 Dec 2020 11:00:51 +0100 Subject: [PATCH 2/2] Add false to return types of class_parents, class_uses --- resources/functionMap.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/functionMap.php b/resources/functionMap.php index 658cf409ac..1dc0458910 100644 --- a/resources/functionMap.php +++ b/resources/functionMap.php @@ -950,8 +950,8 @@ 'class_alias' => ['bool', 'user_class_name'=>'string', 'alias_name'=>'string', 'autoload='=>'bool'], 'class_exists' => ['bool', 'classname'=>'string', 'autoload='=>'bool'], 'class_implements' => ['array|false', 'what'=>'object|string', 'autoload='=>'bool'], -'class_parents' => ['array', 'instance'=>'object|string', 'autoload='=>'bool'], -'class_uses' => ['array', 'what'=>'object|string', 'autoload='=>'bool'], +'class_parents' => ['array|false', 'instance'=>'object|string', 'autoload='=>'bool'], +'class_uses' => ['array|false', 'what'=>'object|string', 'autoload='=>'bool'], 'classkit_import' => ['array', 'filename'=>'string'], 'classkit_method_add' => ['bool', 'classname'=>'string', 'methodname'=>'string', 'args'=>'string', 'code'=>'string', 'flags='=>'int'], 'classkit_method_copy' => ['bool', 'dclass'=>'string', 'dmethod'=>'string', 'sclass'=>'string', 'smethod='=>'string'],