PocketMine-MP 5.15.1 git-5ef247620a7c6301a849b54e5ef1009217729fc8
DaveRandom\CallbackValidator\ReturnType Class Reference
+ Inheritance diagram for DaveRandom\CallbackValidator\ReturnType:
+ Collaboration diagram for DaveRandom\CallbackValidator\ReturnType:

Public Member Functions

 __construct ($typeName=null, $flags=self::COVARIANT)
 
 __toString ()
 
 isSatisfiedBy ($typeName, $nullable, $byReference)
 

Static Public Member Functions

static createFromReflectionFunctionAbstract ($reflection, $flags=0)
 

Public Attributes

 $allowsContravariance
 
 $allowsCovariance
 
 $isByReference
 
 $isNullable
 
 $isWeak
 
 $typeName
 
const CONTRAVARIANT = 0x01 << 16
 
const COVARIANT = 0x02 << 16
 
const NULLABLE = 0x02
 
const REFERENCE = 0x04
 
const WEAK = 0x01
 

Detailed Description

Definition at line 5 of file ReturnType.php.

Constructor & Destructor Documentation

◆ __construct()

DaveRandom\CallbackValidator\ReturnType::__construct (   $typeName = null,
  $flags = self::COVARIANT 
)
Parameters
string | null$typeName
int$flags

Definition at line 49 of file ReturnType.php.

Member Function Documentation

◆ __toString()

DaveRandom\CallbackValidator\ReturnType::__toString ( )
Returns
string

Definition at line 59 of file ReturnType.php.

◆ createFromReflectionFunctionAbstract()

static DaveRandom\CallbackValidator\ReturnType::createFromReflectionFunctionAbstract (   $reflection,
  $flags = 0 
)
static
Parameters
\ReflectionFunctionAbstract$reflection
int$flags
Returns
ReturnType

Definition at line 23 of file ReturnType.php.

References DaveRandom\CallbackValidator\Type\NULLABLE, and DaveRandom\CallbackValidator\Type\REFERENCE.

Referenced by DaveRandom\CallbackValidator\CallbackType\createFromCallable().

+ Here is the caller graph for this function:

◆ isSatisfiedBy()

DaveRandom\CallbackValidator\Type::isSatisfiedBy (   $typeName,
  $nullable,
  $byReference 
)
inherited

Whether the type will be satisfied by the specified type name, nullability and by-reference combination

Parameters
string | null$typeName
bool$nullable
bool$byReference
Returns
bool

Definition at line 91 of file Type.php.

References DaveRandom\CallbackValidator\MatchTester\isMatch(), and DaveRandom\CallbackValidator\MatchTester\isWeakScalarMatch().

+ Here is the call graph for this function:

Member Data Documentation

◆ $allowsContravariance

DaveRandom\CallbackValidator\Type::$allowsContravariance
inherited

Definition at line 62 of file Type.php.

◆ $allowsCovariance

DaveRandom\CallbackValidator\Type::$allowsCovariance
inherited

Definition at line 55 of file Type.php.

◆ $isByReference

DaveRandom\CallbackValidator\Type::$isByReference
inherited

Definition at line 41 of file Type.php.

◆ $isNullable

DaveRandom\CallbackValidator\Type::$isNullable
inherited

Definition at line 34 of file Type.php.

◆ $isWeak

DaveRandom\CallbackValidator\Type::$isWeak
inherited

Definition at line 48 of file Type.php.

◆ $typeName

DaveRandom\CallbackValidator\Type::$typeName
inherited

Definition at line 27 of file Type.php.

◆ CONTRAVARIANT

const DaveRandom\CallbackValidator\ReturnType::CONTRAVARIANT = 0x01 << 16

Contravariant return types allow implementors to specify a supertype of that which is specified in the prototype Usually this isn't a good idea, it's not type-safe, do not use unless you understand what you are doing!

Definition at line 11 of file ReturnType.php.

◆ COVARIANT

const DaveRandom\CallbackValidator\ReturnType::COVARIANT = 0x02 << 16

Covariant return types allow implementors to specify a subtype of that which is specified in the prototype

Definition at line 16 of file ReturnType.php.

◆ NULLABLE

const DaveRandom\CallbackValidator\Type::NULLABLE = 0x02
inherited

Nullable types are either explicitly ?type (PHP>=7.1) or with a default value of null

Definition at line 15 of file Type.php.

Referenced by DaveRandom\CallbackValidator\ReturnType\createFromReflectionFunctionAbstract(), and DaveRandom\CallbackValidator\ParameterType\createFromReflectionParameter().

◆ REFERENCE

const DaveRandom\CallbackValidator\Type::REFERENCE = 0x04
inherited

◆ WEAK

const DaveRandom\CallbackValidator\Type::WEAK = 0x01
inherited

Weak mode validates types using the same rules are strict_types=0

Definition at line 10 of file Type.php.


The documentation for this class was generated from the following file: