array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'reflectionparameter.getclass.php', 1 => 'ReflectionParameter::getClass', 2 => 'Get a ReflectionClass object for the parameter being reflected or null', ), 'up' => array ( 0 => 'class.reflectionparameter.php', 1 => 'ReflectionParameter', ), 'prev' => array ( 0 => 'reflectionparameter.getattributes.php', 1 => 'ReflectionParameter::getAttributes', ), 'next' => array ( 0 => 'reflectionparameter.getdeclaringclass.php', 1 => 'ReflectionParameter::getDeclaringClass', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/reflection/reflectionparameter/getclass.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

ReflectionParameter::getClass

(PHP 5, PHP 7, PHP 8)

ReflectionParameter::getClassGet a ReflectionClass object for the parameter being reflected or null

Увага

Ця функція ЗАСТАРІЛА, починаючи з PHP 8.0.0. Вкрай не рекомендується на неї покладатися.

Опис

#[\Deprecated]
public ReflectionParameter::getClass(): ?ReflectionClass

Gets a ReflectionClass object for the parameter being reflected or null.

As of PHP 8.0.0 this function is deprecated and not recommended. Instead, use ReflectionParameter::getType() to get the ReflectionType of the parameter, then interrogate that object to determine the parameter type.

Увага

Наразі ця функція не документована. Доступний лише список її параметрів.

Параметри

У цієї функції немає параметрів.

Значення, що повертаються

A ReflectionClass object, or null if no type is declared, or the declared type is not a class or interface.

Приклади

Приклад #1 Using the ReflectionParameter class

<?php
function foo(Exception $a) { }

$functionReflection = new ReflectionFunction('foo');
$parameters = $functionReflection->getParameters();
$aParameter = $parameters[0];

echo
$aParameter->getClass()->name;
?>

Журнал змін

Версія Опис
8.0.0 This function has been deprecated in favor of ReflectionParameter::getType() instead.

Прогляньте також