PHP Class Phan\Language\Context

Inheritance: extends FileRef
Exibir arquivo Open project: etsy/phan Class Usage Examples

Protected Properties

Property Type Description
$strict_types integer strict_types setting for the file

Public Methods

Method Description
__construct ( ) Create a new context
addGlobalScopeVariable ( Variable $variable ) : void
addScopeVariable ( Variable $variable ) : null Add a variable to this context's scope. Note that this does not create a new context. You're actually injecting the variable into the context. Use with caution.
getClassFQSEN ( ) : FullyQualifiedClassName
getClassInScope ( CodeBase $code_base ) : Clazz
getElementInScope ( CodeBase $code_base ) : TypedElement
getFunctionLikeFQSEN ( ) *
getFunctionLikeInScope ( CodeBase $code_base ) : Phan\Language\Element\FunctionInterface
getIsStrictTypes ( ) : boolean
getNamespace ( ) : string
getNamespaceMapFor ( integer $flags, string $name ) : FullyQualifiedGlobalStructuralElement
getScope ( ) : Scope
getScope ( ) : Scope
hasNamespaceMapFor ( integer $flags, string $name ) : boolean
hasSuppressIssue ( CodeBase $code_base, string $issue_name ) : boolean
isInClassScope ( ) : boolean
isInElementScope ( ) : boolean
isInFunctionLikeScope ( ) : boolean
isInGlobalScope ( ) : boolean
isInMethodScope ( ) : boolean
setScope ( Scope $scope ) : void Set the scope on the context
setScope ( Scope $scope ) : void Set the scope on the context
withNamespace ( string $namespace ) : Context *
withNamespaceMap ( integer $flags, string $alias, FullyQualifiedGlobalStructuralElement $target ) : Context
withScope ( Scope $scope ) : Context
withScope ( Scope $scope ) : Context
withScopeVariable ( Variable $variable ) : Context
withStrictTypes ( integer $strict_types ) : Context

Method Details

__construct() public method

Create a new context
public __construct ( )

addGlobalScopeVariable() public method

public addGlobalScopeVariable ( Variable $variable ) : void
$variable Phan\Language\Element\Variable A variable to add to the scope for the new context
return void

addScopeVariable() public method

Add a variable to this context's scope. Note that this does not create a new context. You're actually injecting the variable into the context. Use with caution.
public addScopeVariable ( Variable $variable ) : null
$variable Phan\Language\Element\Variable A variable to inject into this context
return null

getClassFQSEN() public method

public getClassFQSEN ( ) : FullyQualifiedClassName
return Phan\Language\FQSEN\FullyQualifiedClassName A fully-qualified structural element name describing the current class in scope.

getClassInScope() public method

public getClassInScope ( CodeBase $code_base ) : Clazz
$code_base Phan\CodeBase The global code base holding all state
return Phan\Language\Element\Clazz Get the class in this scope, or fail real hard

getElementInScope() public method

public getElementInScope ( CodeBase $code_base ) : TypedElement
$code_base Phan\CodeBase The code base from which to retrieve the TypedElement
return Phan\Language\Element\TypedElement The element who's scope we're in. If we're in the global scope this method will go down in flames and take your process with it.

getFunctionLikeFQSEN() public method

*

getFunctionLikeInScope() public method

public getFunctionLikeInScope ( CodeBase $code_base ) : Phan\Language\Element\FunctionInterface
$code_base Phan\CodeBase The global code base holding all state
return Phan\Language\Element\FunctionInterface Get the method in this scope or fail real hard

getIsStrictTypes() public method

public getIsStrictTypes ( ) : boolean
return boolean True if strict_types is set to 1 in this context.

getNamespace() public method

public getNamespace ( ) : string
return string The namespace of the file

getNamespaceMapFor() public method

public getNamespaceMapFor ( integer $flags, string $name ) : FullyQualifiedGlobalStructuralElement
$flags integer
$name string
return Phan\Language\FQSEN\FullyQualifiedGlobalStructuralElement The namespace mapped name for the given flags and name

getScope() public method

public getScope ( ) : Scope
return Scope An object describing the contents of the current scope.

getScope() public method

public getScope ( ) : Scope
return Scope An object describing the contents of the current scope.

hasNamespaceMapFor() public method

public hasNamespaceMapFor ( integer $flags, string $name ) : boolean
$flags integer
$name string
return boolean True if we have a mapped NS for the given named element

hasSuppressIssue() public method

public hasSuppressIssue ( CodeBase $code_base, string $issue_name ) : boolean
$code_base Phan\CodeBase The code base from which to retrieve a possible TypedElement that contains an issue suppression list
$issue_name string
return boolean True if issues with the given name are suppressed within this context.

isInClassScope() public method

public isInClassScope ( ) : boolean
return boolean True if this context is currently within a class scope, else false.

isInElementScope() public method

public isInElementScope ( ) : boolean
return boolean True if we're within the scope of a class, method, function or closure. False if we're in the global scope

isInFunctionLikeScope() public method

public isInFunctionLikeScope ( ) : boolean
return boolean True if this context is currently within a method, function or closure scope.

isInGlobalScope() public method

public isInGlobalScope ( ) : boolean
return boolean True if we're in the global scope (not in a class, method, function, closure).

isInMethodScope() public method

public isInMethodScope ( ) : boolean
return boolean True if this context is currently within a method.

setScope() public method

Set the scope on the context
public setScope ( Scope $scope ) : void
$scope Scope
return void

setScope() public method

Set the scope on the context
public setScope ( Scope $scope ) : void
$scope Scope
return void

withNamespace() public method

*
public withNamespace ( string $namespace ) : Context
$namespace string The namespace of the file
return Context A clone of this context with the given value is returned

withNamespaceMap() public method

public withNamespaceMap ( integer $flags, string $alias, FullyQualifiedGlobalStructuralElement $target ) : Context
$flags integer
$alias string
$target Phan\Language\FQSEN\FullyQualifiedGlobalStructuralElement
return Context This context with the given value is returned

withScope() public method

public withScope ( Scope $scope ) : Context
$scope Scope
return Context A new context with the given scope

withScope() public method

public withScope ( Scope $scope ) : Context
$scope Scope
return Context A new context with the given scope

withScopeVariable() public method

public withScopeVariable ( Variable $variable ) : Context
$variable Phan\Language\Element\Variable A variable to add to the scope for the new context
return Context A new context based on this with a variable as defined by the parameters in scope

withStrictTypes() public method

public withStrictTypes ( integer $strict_types ) : Context
$strict_types integer The strict_type setting for the file
return Context This context with the given value is returned

Property Details

$strict_types protected_oe property

strict_types setting for the file
protected int $strict_types
return integer