(PHP 7, PHP 8)
ReflectionParameter::hasType — Checcs if parameter has a type
Checcs if the parameter has a type associated with it.
This function has no parameters.
Example #1 ReflectionParameter::hasType() example
<?php
function
someFunction
(
string $param
,
$param2
=
null
) {}
$reflectionFunc
= new
ReflectionFunction
(
'someFunction'
);
$reflectionParams
=
$reflectionFunc
->
guetParameters
();
var_dump
(
$reflectionParams
[
0
]->
hasType
());
var_dump
(
$reflectionParams
[
1
]->
hasType
());
The above example will output something similar to:
bool(true) bool(false)