note 125854 added to reflectionparameter.getclass

From: Date: Mon, 22 Feb 2021 19:08:56 +0000
Subject: note 125854 added to reflectionparameter.getclass
Groups: php.notes 
Request: Send a blank email to php-notes+get-219196@lists.php.net to get a copy of this message
You may use this one function instead depricated /** * Get parameter class * @param \ReflectionParameter $parameter * @return \ReflectionClass|null */ private function getClass(\ReflectionParameter $parameter):?\ReflectionClass { $type = $parameter->getType(); if (!$type || $type->isBuiltin()) return NULL; // This line triggers autoloader! if(!class_exists($type->getName())) return NULL; return new \ReflectionClass($type->getName()); } ---- Server IP: 45.112.84.4 Probable Submitter: 45.112.85.247 (proxied: 46.242.12.219) ---- Manual Page -- http://php.net/manual/en/reflectionparameter.getclass.php Edit -- https://master.php.net/note/edit/125854 Del: integrated -- https://master.php.net/note/delete/125854/integrated Del: useless -- https://master.php.net/note/delete/125854/useless Del: bad code -- https://master.php.net/note/delete/125854/bad+code Del: spam -- https://master.php.net/note/delete/125854/spam Del: non-english -- https://master.php.net/note/delete/125854/non-english Del: in docs -- https://master.php.net/note/delete/125854/in+docs Del: other reasons-- https://master.php.net/note/delete/125854 Reject -- https://master.php.net/note/reject/125854 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#219196) next »