\Pvra\AnalysersPhp54Features

Class Php54Features

This class can be used to detect php 5.4 features. Following features are supported:

  • Trait definition using the trait keyword
  • Trait using syntax
  • Magic trait constant: __TRAIT__
  • Array function dereferencing
  • Callable typhint: callable
  • Detection of $this in closures

Summary

Methods
Properties
Constants
__construct()
setOwningAnalyser()
getOwningAnalyser()
enterNode()
leaveNode()
No public properties found
No constants found
getResult()
No protected properties found
N/A
addThisInClosureRequirement()
handleTraitFeatures()
handleFunctionDereferencing()
handleCallableType()
handleInstantClassMemberAccess()
handleThisInClosure()
handleBinaryNumberDeclaration()
handleShortArrayDeclaration()
handleStaticCallByExpressionSyntax()
detectShortEchoSyntax()
$requirementAnalyser
$inClosureLevel
N/A

Properties

$requirementAnalyser

$requirementAnalyser : \Pvra\Analyser

The `Analyser` representing the currently running operation.

Type

\Pvra\Analyser

$inClosureLevel

$inClosureLevel : integer

Closure nesting level

Type

integer

Methods

__construct()

__construct(\Pvra\Analyser  $requirementAnalyser = null) 

Create an instance of the child Analyser

It is optional to set the related analyser during instance creation. When using this class in the context of an Analyser it will always be ensured that this Analyser will be known to the instance before any node is traversed.

Parameters

\Pvra\Analyser $requirementAnalyser

setOwningAnalyser()

setOwningAnalyser(\Pvra\Analyser  $requirementAnalyser) 

Parameters

\Pvra\Analyser $requirementAnalyser

getOwningAnalyser()

getOwningAnalyser() 

enterNode()

enterNode(\PhpParser\Node  $node) : null|\PhpParser\Node

Called when entering a source node

This method is called when a source node is entered. Contained logic determines the presence of specific syntactical features.

Parameters

\PhpParser\Node $node

Returns

null|\PhpParser\Node —

The nodes should not be modified as other walkers might depend on it.

leaveNode()

leaveNode(\PhpParser\Node  $node) : void

Leave node

Currently only used to decrease closure level.

Parameters

\PhpParser\Node $node

getResult()

getResult() : \Pvra\AnalysisResult

Get the instance of the currently used `Pvra\AnalysisResult`.

Returns

\Pvra\AnalysisResult

addThisInClosureRequirement()

addThisInClosureRequirement(\PhpParser\Node  $node) 

Wrapper for message addition in closure-this context

Parameters

\PhpParser\Node $node

handleTraitFeatures()

handleTraitFeatures(\PhpParser\Node  $node) 

Parameters

\PhpParser\Node $node

handleFunctionDereferencing()

handleFunctionDereferencing(\PhpParser\Node  $node) 

Parameters

\PhpParser\Node $node

handleCallableType()

handleCallableType(\PhpParser\Node  $node) 

Parameters

\PhpParser\Node $node

handleInstantClassMemberAccess()

handleInstantClassMemberAccess(\PhpParser\Node  $node) 

Parameters

\PhpParser\Node $node

handleThisInClosure()

handleThisInClosure(\PhpParser\Node  $node) 

Parameters

\PhpParser\Node $node

handleBinaryNumberDeclaration()

handleBinaryNumberDeclaration(\PhpParser\Node  $node) 

Parameters

\PhpParser\Node $node

handleShortArrayDeclaration()

handleShortArrayDeclaration(\PhpParser\Node  $node) 

Parameters

\PhpParser\Node $node

handleStaticCallByExpressionSyntax()

handleStaticCallByExpressionSyntax(\PhpParser\Node  $node) 

Parameters

\PhpParser\Node $node

detectShortEchoSyntax()

detectShortEchoSyntax(\PhpParser\Node  $node) 

Parameters

\PhpParser\Node $node