PHP Class PHPStan\Analyser\Scope

Afficher le fichier Open project: phpstan/phpstan Class Usage Examples

Méthodes publiques

Méthode 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

Méthode 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 méthode

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 méthode

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 méthode

public addVariables ( Scope $otherScope ) : self
$otherScope Scope
Résultat self

assignVariable() public méthode

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

canAccessConstant() public méthode

public canAccessConstant ( PHPStan\Reflection\ClassConstantReflection $constantReflection ) : boolean
$constantReflection PHPStan\Reflection\ClassConstantReflection
Résultat boolean

canAccessProperty() public méthode

public canAccessProperty ( PHPStan\Reflection\PropertyReflection $propertyReflection ) : boolean
$propertyReflection PHPStan\Reflection\PropertyReflection
Résultat boolean

canCallMethod() public méthode

public canCallMethod ( PHPStan\Reflection\MethodReflection $methodReflection ) : boolean
$methodReflection PHPStan\Reflection\MethodReflection
Résultat boolean

changeAnalysedContextFile() public méthode

public changeAnalysedContextFile ( string $fileName ) : self
$fileName string
Résultat self

enterAnonymousClass() public méthode

public enterAnonymousClass ( ClassReflection $anonymousClass ) : self
$anonymousClass PHPStan\Reflection\ClassReflection
Résultat self

enterAnonymousFunction() public méthode

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

enterCatch() public méthode

public enterCatch ( array $classes, string $variableName ) : self
$classes array
$variableName string
Résultat self

enterClass() public méthode

public enterClass ( string $className ) : self
$className string
Résultat self

enterClassMethod() public méthode

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

enterClosureBind() public méthode

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

enterDeclareStrictTypes() public méthode

public enterDeclareStrictTypes ( ) : self
Résultat self

enterForeach() public méthode

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

enterFunction() public méthode

public enterFunction ( PHPStan\Reflection\ParametersAcceptor $functionReflection ) : self
$functionReflection PHPStan\Reflection\ParametersAcceptor
Résultat self

enterFunctionCall() public méthode

public enterFunctionCall ( PhpParser\Node\Expr\FuncCall | PhpParser\Node\Expr\MethodCall $functionCall ) : self
$functionCall PhpParser\Node\Expr\FuncCall | PhpParser\Node\Expr\MethodCall
Résultat self

enterFunctionCall() public méthode

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
Résultat self

enterNamespace() public méthode

public enterNamespace ( string $namespaceName ) : self
$namespaceName string
Résultat self

enterNegation() public méthode

public enterNegation ( ) : self
Résultat self

enterVariableAssign() public méthode

public enterVariableAssign ( string $variableName ) : self
$variableName string
Résultat self

getAnalysedContextFile() public méthode

public getAnalysedContextFile ( ) : string
Résultat string

getAnonymousClass() public méthode

public getAnonymousClass ( ) : ClassReflection
Résultat PHPStan\Reflection\ClassReflection

getAnonymousFunctionReturnType() public méthode

public getAnonymousFunctionReturnType ( ) : PHPStan\Type\Type | null
Résultat PHPStan\Type\Type | null

getClass() public méthode

public getClass ( ) : null | string
Résultat null | string

getFile() public méthode

public getFile ( ) : string
Résultat string

getFunction() public méthode

public getFunction ( ) : null | PHPStan\Reflection\ParametersAcceptor
Résultat null | PHPStan\Reflection\ParametersAcceptor

getFunctionName() public méthode

public getFunctionName ( ) : null | string
Résultat null | string

getInFunctionCall() public méthode

public getInFunctionCall ( ) : PhpParser\Node\Expr\FuncCall | PhpParser\Node\Expr\MethodCall | null
Résultat PhpParser\Node\Expr\FuncCall | PhpParser\Node\Expr\MethodCall | null

getNamespace() public méthode

public getNamespace ( ) : null | string
Résultat null | string

getType() public méthode

public getType ( PhpParser\Node $node ) : PHPStan\Type\Type
$node PhpParser\Node
Résultat PHPStan\Type\Type

getVariableType() public méthode

public getVariableType ( string $variableName ) : PHPStan\Type\Type
$variableName string
Résultat PHPStan\Type\Type

getVariableTypes() public méthode

public getVariableTypes ( ) : array
Résultat array

hasVariableType() public méthode

public hasVariableType ( string $variableName ) : boolean
$variableName string
Résultat boolean

intersectVariables() public méthode

public intersectVariables ( Scope $otherScope ) : self
$otherScope Scope
Résultat self

isDeclareStrictTypes() public méthode

public isDeclareStrictTypes ( ) : boolean
Résultat boolean

isInAnonymousClass() public méthode

public isInAnonymousClass ( ) : boolean
Résultat boolean

isInAnonymousFunction() public méthode

public isInAnonymousFunction ( ) : boolean
Résultat boolean

isInVariableAssign() public méthode

public isInVariableAssign ( string $variableName ) : boolean
$variableName string
Résultat boolean

isNegated() public méthode

public isNegated ( ) : boolean
Résultat boolean

isSpecified() public méthode

public isSpecified ( PhpParser\Node $node ) : boolean
$node PhpParser\Node
Résultat boolean

resolveName() public méthode

public resolveName ( Name $name ) : string | null
$name PhpParser\Node\Name
Résultat string | null

specifyExpressionType() public méthode

public specifyExpressionType ( PhpParser\Node $expr, PHPStan\Type\Type $type ) : self
$expr PhpParser\Node
$type PHPStan\Type\Type
Résultat self

specifyFetchedPropertyFromIsset() public méthode

public specifyFetchedPropertyFromIsset ( PhpParser\Node\Expr\PropertyFetch $expr ) : self
$expr PhpParser\Node\Expr\PropertyFetch
Résultat self

unsetVariable() public méthode

public unsetVariable ( string $variableName ) : self
$variableName string
Résultat self