MagicMethodTypeHintsPass
in package
implements
Pass
Interfaces, Classes and Traits
Table of Contents
- $mockMagicMethods : array<string|int, mixed>
- apply() : string
- Apply implementation.
- getMagicMethods() : array<string|int, mixed>
- Returns the magic methods within the passed DefinedTargetClass.
- renderTypeHint() : mixed
- applyMagicTypeHints() : string
- Applies type hints of magic methods from class to the passed code.
- getDeclarationRegex() : string
- Returns a regex string used to match the declaration of some method.
- getMethodDeclaration() : string
- Gets the declaration code, as a string, for the passed method.
- getOriginalParameters() : array<string|int, mixed>
- Returns the method original parameters, as they're described in the $code string.
- isMethodWithinCode() : bool
- Checks if the method is declared within code.
Properties
$mockMagicMethods
private
array<string|int, mixed>
$mockMagicMethods
= array('__construct', '__destruct', '__call', '__callStatic', '__get', '__set', '__isset', '__unset', '__sleep', '__wakeup', '__toString', '__invoke', '__set_state', '__clone', '__debugInfo')
Methods
apply()
Apply implementation.
public
apply(string $code, MockConfiguration $config) : string
Parameters
- $code : string
- $config : MockConfiguration
Return values
string —getMagicMethods()
Returns the magic methods within the passed DefinedTargetClass.
public
getMagicMethods([TargetClassInterface $class = null ]) : array<string|int, mixed>
Parameters
- $class : TargetClassInterface = null
Return values
array<string|int, mixed> —renderTypeHint()
protected
renderTypeHint(Parameter $param) : mixed
Parameters
- $param : Parameter
Return values
mixed —applyMagicTypeHints()
Applies type hints of magic methods from class to the passed code.
private
applyMagicTypeHints(int $code, Method $method) : string
Parameters
- $code : int
- $method : Method
Return values
string —getDeclarationRegex()
Returns a regex string used to match the declaration of some method.
private
getDeclarationRegex(string $methodName) : string
Parameters
- $methodName : string
Return values
string —getMethodDeclaration()
Gets the declaration code, as a string, for the passed method.
private
getMethodDeclaration(Method $method, array<string|int, mixed> $namedParameters) : string
Parameters
- $method : Method
- $namedParameters : array<string|int, mixed>
Return values
string —getOriginalParameters()
Returns the method original parameters, as they're described in the $code string.
private
getOriginalParameters(int $code, Method $method) : array<string|int, mixed>
Parameters
- $code : int
- $method : Method
Return values
array<string|int, mixed> —isMethodWithinCode()
Checks if the method is declared within code.
private
isMethodWithinCode(int $code, Method $method) : bool
Parameters
- $code : int
- $method : Method