note 125810 added to reflectionparameter.getclass
| From: | Dylan@php.net | Date: | Fri, 12 Feb 2021 11:47:58 +0000 |
| Subject: | note 125810 added to reflectionparameter.getclass | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-219101@lists.php.net to get a copy of this message | ||
For php version >=8
ReflectionParamter::getType() is the recommended way to replace the deprecated methods:
- getClass()
e.g: $name = $param->getType() && !$param->getType()->isBuiltin()
? new ReflectionClass($param->getType()->getName())
: null;
- isArray()
e.g: $isArray = $param->getType() && $param->getType()->getName() ===
'array';
- isCallable()
e.g: $isCallable = $param->getType() && $param->getType()->getName() ===
'callable';
This method is available in PHP 7.0 and later.
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.247 (proxied: 176.134.7.70)
----
Manual Page -- http://php.net/manual/en/reflectionparameter.getclass.php
Edit -- https://master.php.net/note/edit/125810
Del: integrated -- https://master.php.net/note/delete/125810/integrated
Del: useless -- https://master.php.net/note/delete/125810/useless
Del: bad code -- https://master.php.net/note/delete/125810/bad+code
Del: spam -- https://master.php.net/note/delete/125810/spam
Del: non-english -- https://master.php.net/note/delete/125810/non-english
Del: in docs -- https://master.php.net/note/delete/125810/in+docs
Del: other reasons-- https://master.php.net/note/delete/125810
Reject -- https://master.php.net/note/reject/125810
Search -- https://master.php.net/manage/user-notes.php