ReflectionParameter::hasType

(PHP 7)

ReflectionParameter::hasTypeChecks if parameter has a type

Opis

public ReflectionParameter::hasType ( void ) : bool

Checks if the parameter has a type associated with it.

Parametry

Ta funkcja nie posiada parametrów.

Zwracane wartości

TRUE if a type is specified, FALSE otherwise.

Przykłady

Przykład #1 ReflectionParameter::hasType() example

<?php
function someFunction(string $param$param2 null) {}

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

var_dump($reflectionParams[0]->hasType());
var_dump($reflectionParams[1]->hasType());

Powyższy przykład wyświetli coś podobnego do:

bool(true)
bool(false)

Zobacz też:

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top