PocketMine-MP 5.19.1 git-5cc1068cd43264d3363295eb8d6901e02f467897
DaveRandom\CallbackValidator\ParameterType Class Reference
+ Inheritance diagram for DaveRandom\CallbackValidator\ParameterType:
+ Collaboration diagram for DaveRandom\CallbackValidator\ParameterType:

Public Member Functions

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

Static Public Member Functions

static createFromReflectionParameter ($reflection, $flags=0)
 

Public Attributes

 $allowsContravariance
 
 $allowsCovariance
 
 $isByReference
 
 $isNullable
 
 $isOptional
 
 $isVariadic
 
 $isWeak
 
 $typeName
 
const CONTRAVARIANT = 0x01 << 8
 
const COVARIANT = 0x02 << 8
 
const NULLABLE = 0x02
 
const OPTIONAL = 0x08 << 8
 
const REFERENCE = 0x04
 
const VARIADIC = 0x04 << 8
 
const WEAK = 0x01
 

Detailed Description

Definition at line 5 of file ParameterType.php.

Constructor & Destructor Documentation

◆ __construct()

DaveRandom\CallbackValidator\ParameterType::__construct (   $parameterName,
  $typeName = null,
  $flags = self::CONTRAVARIANT 
)
Parameters
string$parameterName
string | null$typeName
int$flags

Definition at line 93 of file ParameterType.php.

Member Function Documentation

◆ __toString()

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

Definition at line 107 of file ParameterType.php.

◆ createFromReflectionParameter()

static DaveRandom\CallbackValidator\ParameterType::createFromReflectionParameter (   $reflection,
  $flags = 0 
)
static

Create a new ParameterType instance from a \ReflectionParameter instance

Parameters
\ReflectionParameter$reflection
int$flags
Returns
ParameterType

Definition at line 56 of file ParameterType.php.

References DaveRandom\CallbackValidator\Type\NULLABLE, DaveRandom\CallbackValidator\ParameterType\OPTIONAL, DaveRandom\CallbackValidator\Type\REFERENCE, and DaveRandom\CallbackValidator\ParameterType\VARIADIC.

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.

◆ $isOptional

DaveRandom\CallbackValidator\ParameterType::$isOptional

Definition at line 47 of file ParameterType.php.

◆ $isVariadic

DaveRandom\CallbackValidator\ParameterType::$isVariadic

Definition at line 40 of file ParameterType.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\ParameterType::CONTRAVARIANT = 0x01 << 8

Contravariant parameters allow implementors to specify a supertype of that which is specified in the prototype

Definition at line 10 of file ParameterType.php.

◆ COVARIANT

const DaveRandom\CallbackValidator\ParameterType::COVARIANT = 0x02 << 8

Covariant parameters allow implementors to specify a subtype 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 16 of file ParameterType.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().

◆ OPTIONAL

const DaveRandom\CallbackValidator\ParameterType::OPTIONAL = 0x08 << 8

An optional parameter may be omitted at call time

Definition at line 26 of file ParameterType.php.

Referenced by DaveRandom\CallbackValidator\ParameterType\createFromReflectionParameter().

◆ REFERENCE

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

◆ VARIADIC

const DaveRandom\CallbackValidator\ParameterType::VARIADIC = 0x04 << 8

A variadic parameter accepts zero or more arguments of the specified type

Definition at line 21 of file ParameterType.php.

Referenced by DaveRandom\CallbackValidator\ParameterType\createFromReflectionParameter().

◆ 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: