diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-02-25 16:21:52 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-05-11 17:01:40 +0200 |
commit | 28af364d2ae2261addc21f8830f175baa8fa72cf (patch) | |
tree | 8d30efe6ef5b82ea2bc0702aa5b8b9fa2080b82c /ext/reflection/php_reflection.stub.php | |
parent | 4865592525e543f87deb51f5fd22022684b17f83 (diff) | |
download | php-git-28af364d2ae2261addc21f8830f175baa8fa72cf.tar.gz |
Deprecate old ReflectionParameter type declaration APIs
This deprecates:
ReflectionParameter::isArray()
ReflectionParameter::isCallable()
ReflectionParameter::getClass()
These APIs have been superseded by ReflectionParameter::getType()
since PHP 7.0. Types introduced since that time are not available
through the old APIs, and their behavior is getting increasingly
confusing. This is how they interact with PHP 8 union types:
* isArray() will return true if the type is array or ?array,
but not any other union type
* Same for isCallable().
* getClass() will return a class for T|int etc, as long as the
union only contains a single type. T1|T2 will return null.
This behavior is not particularly reasonable or useful, and will
get more confusing as new type system extensions are added.
Closes GH-5209.
Diffstat (limited to 'ext/reflection/php_reflection.stub.php')
-rw-r--r-- | ext/reflection/php_reflection.stub.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/ext/reflection/php_reflection.stub.php b/ext/reflection/php_reflection.stub.php index 1bcd4221cf..e629b8d845 100644 --- a/ext/reflection/php_reflection.stub.php +++ b/ext/reflection/php_reflection.stub.php @@ -493,7 +493,10 @@ class ReflectionParameter implements Reflector /** @return ReflectionClass|null */ public function getDeclaringClass() {} - /** @return ReflectionClass|null */ + /** + * @return ReflectionClass|null + * @deprecated Use ReflectionParameter::getType() instead + */ public function getClass() {} /** @return bool */ @@ -502,10 +505,16 @@ class ReflectionParameter implements Reflector /** @return ReflectionType|null */ public function getType() {} - /** @return bool */ + /** + * @return bool + * @deprecated Use ReflectionParameter::getType() instead + */ public function isArray() {} - /** @return bool */ + /** + * @return bool + * @deprecated Use ReflectionParameter::getType() instead + */ public function isCallable() {} /** @return bool */ |