PHP Class PHPStan\Analyser\Scope

Mostrar archivo Open project: phpstan/phpstan Class Usage Examples

Public Methods

Method Description
__construct ( Broker $broker, Standard $printer, string $file, boolean $declareStrictTypes = false, string $class = null, PHPStan\Reflection\ParametersAcceptor $function = null, string $namespace = null, array $variablesTypes = [], string $inClosureBindScopeClass = null, PHPStan\Type\Type $inAnonymousFunctionReturnType = null, ClassReflection $anonymousClass = null, PhpParser\Node\Expr $inFunctionCall = null, boolean $negated = false, array $moreSpecificTypes = [], array $currentlyAssignedVariables = [] )
__construct ( Broker $broker, Standard $printer, string $file, string $analysedContextFile = null, boolean $declareStrictTypes = false, string $class = null, PHPStan\Reflection\ParametersAcceptor $function = null, string $namespace = null, array $variablesTypes = [], string $inClosureBindScopeClass = null, PHPStan\Type\Type $inAnonymousFunctionReturnType = null, ClassReflection $anonymousClass = null, PhpParser\Node\Expr $inFunctionCall = null, boolean $negated = false, array $moreSpecificTypes = [], array $currentlyAssignedVariables = [] )
addVariables ( Scope $otherScope ) : self
assignVariable ( string $variableName, PHPStan\Type\Type $type = null ) : self
canAccessConstant ( PHPStan\Reflection\ClassConstantReflection $constantReflection ) : boolean
canAccessProperty ( PHPStan\Reflection\PropertyReflection $propertyReflection ) : boolean
canCallMethod ( PHPStan\Reflection\MethodReflection $methodReflection ) : boolean
changeAnalysedContextFile ( string $fileName ) : self
enterAnonymousClass ( ClassReflection $anonymousClass ) : self
enterAnonymousFunction ( array $parameters, array $uses, Name | string | null $returnTypehint = null ) : self
enterCatch ( array $classes, string $variableName ) : self
enterClass ( string $className ) : self
enterClassMethod ( ClassMethod $classMethod, array $phpDocParameterTypes, PHPStan\Type\Type $phpDocReturnType = null ) : self
enterClosureBind ( PHPStan\Type\Type $thisType = null, string $scopeClass ) : self
enterDeclareStrictTypes ( ) : self
enterForeach ( PhpParser\Node $iteratee, string $valueName, string $keyName = null ) : self
enterFunction ( PHPStan\Reflection\ParametersAcceptor $functionReflection ) : self
enterFunctionCall ( PhpParser\Node\Expr\FuncCall | PhpParser\Node\Expr\MethodCall $functionCall ) : self
enterFunctionCall ( PhpParser\Node\Expr\FuncCall | PhpParser\Node\Expr\MethodCall | PhpParser\Node\Expr\StaticCall $functionCall ) : self
enterNamespace ( string $namespaceName ) : self
enterNegation ( ) : self
enterVariableAssign ( string $variableName ) : self
getAnalysedContextFile ( ) : string
getAnonymousClass ( ) : ClassReflection
getAnonymousFunctionReturnType ( ) : PHPStan\Type\Type | null
getClass ( ) : null | string
getFile ( ) : string
getFunction ( ) : null | PHPStan\Reflection\ParametersAcceptor
getFunctionName ( ) : null | string
getInFunctionCall ( ) : PhpParser\Node\Expr\FuncCall | PhpParser\Node\Expr\MethodCall | null
getNamespace ( ) : null | string
getType ( PhpParser\Node $node ) : PHPStan\Type\Type
getVariableType ( string $variableName ) : PHPStan\Type\Type
getVariableTypes ( ) : array
hasVariableType ( string $variableName ) : boolean
intersectVariables ( Scope $otherScope ) : self
isDeclareStrictTypes ( ) : boolean
isInAnonymousClass ( ) : boolean
isInAnonymousFunction ( ) : boolean
isInVariableAssign ( string $variableName ) : boolean
isNegated ( ) : boolean
isSpecified ( PhpParser\Node $node ) : boolean
resolveName ( Name $name ) : string | null
specifyExpressionType ( PhpParser\Node $expr, PHPStan\Type\Type $type ) : self
specifyFetchedPropertyFromIsset ( PhpParser\Node\Expr\PropertyFetch $expr ) : self
unsetVariable ( string $variableName ) : self

Private Methods

Method Description
addMoreSpecificTypes ( array $types ) : self
canAccessClassMember ( PHPStan\Reflection\ClassMemberReflection $classMemberReflection ) : boolean
getAnonymousFunctionType ( Name | string | null $type = null, boolean $isNullable ) : PHPStan\Type\Type
getCombinedType ( array $types ) : PHPStan\Type\Type
getFunctionType ( Name | string | null $type = null, boolean $isNullable, boolean $isVariadic ) : PHPStan\Type\Type
getTypeFromValue ( mixed $value ) : PHPStan\Type\Type | null
isParameterValueNullable ( Param $parameter ) : boolean

Method Details

__construct() public method

public __construct ( Broker $broker, Standard $printer, string $file, boolean $declareStrictTypes = false, string $class = null, PHPStan\Reflection\ParametersAcceptor $function = null, string $namespace = null, array $variablesTypes = [], string $inClosureBindScopeClass = null, PHPStan\Type\Type $inAnonymousFunctionReturnType = null, ClassReflection $anonymousClass = null, PhpParser\Node\Expr $inFunctionCall = null, boolean $negated = false, array $moreSpecificTypes = [], array $currentlyAssignedVariables = [] )
$broker PHPStan\Broker\Broker
$printer PhpParser\PrettyPrinter\Standard
$file string
$declareStrictTypes boolean
$class string
$function PHPStan\Reflection\ParametersAcceptor
$namespace string
$variablesTypes array
$inClosureBindScopeClass string
$inAnonymousFunctionReturnType PHPStan\Type\Type
$anonymousClass PHPStan\Reflection\ClassReflection
$inFunctionCall PhpParser\Node\Expr
$negated boolean
$moreSpecificTypes array
$currentlyAssignedVariables array

__construct() public method

public __construct ( Broker $broker, Standard $printer, string $file, string $analysedContextFile = null, boolean $declareStrictTypes = false, string $class = null, PHPStan\Reflection\ParametersAcceptor $function = null, string $namespace = null, array $variablesTypes = [], string $inClosureBindScopeClass = null, PHPStan\Type\Type $inAnonymousFunctionReturnType = null, ClassReflection $anonymousClass = null, PhpParser\Node\Expr $inFunctionCall = null, boolean $negated = false, array $moreSpecificTypes = [], array $currentlyAssignedVariables = [] )
$broker PHPStan\Broker\Broker
$printer PhpParser\PrettyPrinter\Standard
$file string
$analysedContextFile string
$declareStrictTypes boolean
$class string
$function PHPStan\Reflection\ParametersAcceptor
$namespace string
$variablesTypes array
$inClosureBindScopeClass string
$inAnonymousFunctionReturnType PHPStan\Type\Type
$anonymousClass PHPStan\Reflection\ClassReflection
$inFunctionCall PhpParser\Node\Expr
$negated boolean
$moreSpecificTypes array
$currentlyAssignedVariables array

addVariables() public method

public addVariables ( Scope $otherScope ) : self
$otherScope Scope
return self

assignVariable() public method

public assignVariable ( string $variableName, PHPStan\Type\Type $type = null ) : self
$variableName string
$type PHPStan\Type\Type
return self

canAccessConstant() public method

public canAccessConstant ( PHPStan\Reflection\ClassConstantReflection $constantReflection ) : boolean
$constantReflection PHPStan\Reflection\ClassConstantReflection
return boolean

canAccessProperty() public method

public canAccessProperty ( PHPStan\Reflection\PropertyReflection $propertyReflection ) : boolean
$propertyReflection PHPStan\Reflection\PropertyReflection
return boolean

canCallMethod() public method

public canCallMethod ( PHPStan\Reflection\MethodReflection $methodReflection ) : boolean
$methodReflection PHPStan\Reflection\MethodReflection
return boolean

changeAnalysedContextFile() public method

public changeAnalysedContextFile ( string $fileName ) : self
$fileName string
return self

enterAnonymousClass() public method

public enterAnonymousClass ( ClassReflection $anonymousClass ) : self
$anonymousClass PHPStan\Reflection\ClassReflection
return self

enterAnonymousFunction() public method

public enterAnonymousFunction ( array $parameters, array $uses, Name | string | null $returnTypehint = null ) : self
$parameters array
$uses array
$returnTypehint PhpParser\Node\Name | string | null
return self

enterCatch() public method

public enterCatch ( array $classes, string $variableName ) : self
$classes array
$variableName string
return self

enterClass() public method

public enterClass ( string $className ) : self
$className string
return self

enterClassMethod() public method

public enterClassMethod ( ClassMethod $classMethod, array $phpDocParameterTypes, PHPStan\Type\Type $phpDocReturnType = null ) : self
$classMethod PhpParser\Node\Stmt\ClassMethod
$phpDocParameterTypes array
$phpDocReturnType PHPStan\Type\Type
return self

enterClosureBind() public method

public enterClosureBind ( PHPStan\Type\Type $thisType = null, string $scopeClass ) : self
$thisType PHPStan\Type\Type
$scopeClass string
return self

enterDeclareStrictTypes() public method

public enterDeclareStrictTypes ( ) : self
return self

enterForeach() public method

public enterForeach ( PhpParser\Node $iteratee, string $valueName, string $keyName = null ) : self
$iteratee PhpParser\Node
$valueName string
$keyName string
return self

enterFunction() public method

public enterFunction ( PHPStan\Reflection\ParametersAcceptor $functionReflection ) : self
$functionReflection PHPStan\Reflection\ParametersAcceptor
return self

enterFunctionCall() public method

public enterFunctionCall ( PhpParser\Node\Expr\FuncCall | PhpParser\Node\Expr\MethodCall $functionCall ) : self
$functionCall PhpParser\Node\Expr\FuncCall | PhpParser\Node\Expr\MethodCall
return self

enterFunctionCall() public method

public enterFunctionCall ( PhpParser\Node\Expr\FuncCall | PhpParser\Node\Expr\MethodCall | PhpParser\Node\Expr\StaticCall $functionCall ) : self
$functionCall PhpParser\Node\Expr\FuncCall | PhpParser\Node\Expr\MethodCall | PhpParser\Node\Expr\StaticCall
return self

enterNamespace() public method

public enterNamespace ( string $namespaceName ) : self
$namespaceName string
return self

enterNegation() public method

public enterNegation ( ) : self
return self

enterVariableAssign() public method

public enterVariableAssign ( string $variableName ) : self
$variableName string
return self

getAnalysedContextFile() public method

public getAnalysedContextFile ( ) : string
return string

getAnonymousClass() public method

public getAnonymousClass ( ) : ClassReflection
return PHPStan\Reflection\ClassReflection

getAnonymousFunctionReturnType() public method

public getAnonymousFunctionReturnType ( ) : PHPStan\Type\Type | null
return PHPStan\Type\Type | null

getClass() public method

public getClass ( ) : null | string
return null | string

getFile() public method

public getFile ( ) : string
return string

getFunction() public method

public getFunction ( ) : null | PHPStan\Reflection\ParametersAcceptor
return null | PHPStan\Reflection\ParametersAcceptor

getFunctionName() public method

public getFunctionName ( ) : null | string
return null | string

getInFunctionCall() public method

public getInFunctionCall ( ) : PhpParser\Node\Expr\FuncCall | PhpParser\Node\Expr\MethodCall | null
return PhpParser\Node\Expr\FuncCall | PhpParser\Node\Expr\MethodCall | null

getNamespace() public method

public getNamespace ( ) : null | string
return null | string

getType() public method

public getType ( PhpParser\Node $node ) : PHPStan\Type\Type
$node PhpParser\Node
return PHPStan\Type\Type

getVariableType() public method

public getVariableType ( string $variableName ) : PHPStan\Type\Type
$variableName string
return PHPStan\Type\Type

getVariableTypes() public method

public getVariableTypes ( ) : array
return array

hasVariableType() public method

public hasVariableType ( string $variableName ) : boolean
$variableName string
return boolean

intersectVariables() public method

public intersectVariables ( Scope $otherScope ) : self
$otherScope Scope
return self

isDeclareStrictTypes() public method

public isDeclareStrictTypes ( ) : boolean
return boolean

isInAnonymousClass() public method

public isInAnonymousClass ( ) : boolean
return boolean

isInAnonymousFunction() public method

public isInAnonymousFunction ( ) : boolean
return boolean

isInVariableAssign() public method

public isInVariableAssign ( string $variableName ) : boolean
$variableName string
return boolean

isNegated() public method

public isNegated ( ) : boolean
return boolean

isSpecified() public method

public isSpecified ( PhpParser\Node $node ) : boolean
$node PhpParser\Node
return boolean

resolveName() public method

public resolveName ( Name $name ) : string | null
$name PhpParser\Node\Name
return string | null

specifyExpressionType() public method

public specifyExpressionType ( PhpParser\Node $expr, PHPStan\Type\Type $type ) : self
$expr PhpParser\Node
$type PHPStan\Type\Type
return self

specifyFetchedPropertyFromIsset() public method

public specifyFetchedPropertyFromIsset ( PhpParser\Node\Expr\PropertyFetch $expr ) : self
$expr PhpParser\Node\Expr\PropertyFetch
return self

unsetVariable() public method

public unsetVariable ( string $variableName ) : self
$variableName string
return self