ReflectionType::isBuiltin

(PHP 7)
Checks if it is a built-in type
public bool ReflectionType::isBuiltin ( void )

Checks if the type is a built-in type in PHP.

Returns:

TRUE if it's a built-in type, otherwise FALSE

Examples:
ReflectionType::isBuiltin() example
<?php
class SomeClass {}

function someFunction(string $param, SomeClass $param2, StdClass $param3) {}

$reflectionFunc = new ReflectionFunction('someFunction');
$reflectionParams = $reflectionFunc->getParameters();

var_dump($reflectionParams[0]->getType()->isBuiltin());
var_dump($reflectionParams[1]->getType()->isBuiltin());
var_dump($reflectionParams[2]->getType()->isBuiltin());

The above example will output something similar to:

bool(true)
bool(false)
bool(false)
See also:

ReflectionType::allowsNull() -

ReflectionType::__toString() -

ReflectionClass::isInternal() -

ReflectionParameter::getType() -

doc_php
2016-02-24 16:13:52
Comments
Leave a Comment

Please login to continue.