‪TYPO3CMS  ‪main
TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher Class Reference
Inheritance diagram for TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher:
TYPO3\CMS\Install\ExtensionScanner\CodeScannerInterface TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ArrayDimensionMatcher TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ArrayGlobalMatcher TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ClassConstantMatcher TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ClassNameMatcher TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstantMatcher TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\FunctionCallMatcher TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\InterfaceMethodChangedMatcher TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodAnnotationMatcher TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentDroppedMatcher TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentDroppedStaticMatcher TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentRequiredMatcher TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentRequiredStaticMatcher TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentUnusedMatcher TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodCallMatcher TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodCallStaticMatcher TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\PropertyAnnotationMatcher TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\PropertyExistsStaticMatcher TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\PropertyProtectedMatcher TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\PropertyPublicMatcher TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures\AbstractCoreMatcherFixture

Public Member Functions

 getMatches ()
 

Public Attributes

const NODE_RESOLVED_AS = 'nodeResolvedAs'
 

Protected Member Functions

 validateMatcherDefinitions (array $requiredArrayKeys=[])
 
 validateMatcherDefinitionKeys (string $key, array $matcherDefinition, array $requiredArrayKeys=[])
 
->foo matcherDefinitions, it creates a helper array

Initialize helper lookup array $this->flatMatcherDefinitions. For class containing only the method name as array keys for "weak" matches.

If methods with the same name from different classes are defined, a "candidate" array is created containing details of single possible matches for further analysis.

Exceptions
 initializeFlatMatcherDefinitions ()
 
 isArgumentUnpackingUsed (array $arguments=[])
 
 isLineIgnored (Node $node)
 
 isFileIgnored (Node $node)
 

Protected Attributes

array $matcherDefinitions = array( )
 
array $matches = array( )
 
array $flatMatcherDefinitions = array( )
 
int $currentCodeLine = 0
 
bool $isCurrentLineIgnored = false
 
bool $isFullFileIgnored = false
 

Detailed Description

Single "core matcher" classes extend from this. It brings a set of protected methods to help single matcher classes doing common stuff. This abstract extends the nikic/php-parser NodeVisitorAbstract which implements the main parser interface, and it implements the TYPO3 specific CodeScannerInterface to retrieve matches.

This class is only meant to be used within EXT:install and is not part of the TYPO3 Core API.

Definition at line 33 of file AbstractCoreMatcher.php.

Member Function Documentation

◆ getMatches()

TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher::getMatches ( )

◆ initializeFlatMatcherDefinitions()

◆ isArgumentUnpackingUsed()

◆ isFileIgnored()

TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher::isFileIgnored ( Node  $node)
protected

Return true if the node is ignored since the entire file is ignored. Sets ignore status if a class node is given having the annotation.

Definition at line 205 of file AbstractCoreMatcher.php.

Referenced by TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\PropertyExistsStaticMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ClassNameMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstantMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\PropertyPublicMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\PropertyProtectedMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ArrayGlobalMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ClassConstantMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\FunctionCallMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodCallMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ArrayDimensionMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentRequiredMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentDroppedMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentDroppedStaticMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentRequiredStaticMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentUnusedMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\InterfaceMethodChangedMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodCallStaticMatcher\enterNode(), and TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher\enterNode().

◆ isLineIgnored()

TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher::isLineIgnored ( Node  $node)
protected

Returns true if a comment before a statement is marked as "@extensionScannerIgnoreLine"

Definition at line 175 of file AbstractCoreMatcher.php.

References TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher\$isCurrentLineIgnored.

Referenced by TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\PropertyExistsStaticMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ClassNameMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstantMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\PropertyPublicMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\PropertyProtectedMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ArrayGlobalMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ClassConstantMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\FunctionCallMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodCallMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ArrayDimensionMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentRequiredMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentDroppedMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentDroppedStaticMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentRequiredStaticMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentUnusedMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\InterfaceMethodChangedMatcher\enterNode(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodCallStaticMatcher\enterNode(), and TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher\enterNode().

◆ validateMatcherDefinitionKeys()

TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher::validateMatcherDefinitionKeys ( string  $key,
array  $matcherDefinition,
array  $requiredArrayKeys = [] 
)
protected

◆ validateMatcherDefinitions()

TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher::validateMatcherDefinitions ( array  $requiredArrayKeys = [])
protected

Some matcher need specific keys in the array definition to work properly. This method is called typically in __construct() of a matcher to verify these are given. This method is a measure against broken core configuration. It should be pretty quick and is only called in __construct() once, no kitten should be harmed.

This method works on $this->matcherDefinitions.

Parameters
array$requiredArrayKeys‪List of required keys for single matchers
Exceptions

Reimplemented in TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures\AbstractCoreMatcherFixture.

Definition at line 86 of file AbstractCoreMatcher.php.

References TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher\validateMatcherDefinitionKeys().

Referenced by TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ClassNameMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodAnnotationMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\PropertyExistsStaticMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\PropertyPublicMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstantMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\PropertyAnnotationMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\PropertyProtectedMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentRequiredMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\FunctionCallMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodCallMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentDroppedMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ArrayGlobalMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentDroppedStaticMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentRequiredStaticMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ClassConstantMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ArrayDimensionMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentUnusedMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\InterfaceMethodChangedMatcher\__construct(), and TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodCallStaticMatcher\__construct().

Member Data Documentation

◆ $currentCodeLine

int TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher::$currentCodeLine = 0
protected

Helper variable for ignored line detection

Definition at line 56 of file AbstractCoreMatcher.php.

◆ $flatMatcherDefinitions

array TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher::$flatMatcherDefinitions = array( )
protected

Helper property containing an array derived from $this->matcherDefinitions created in __construct() if needed.

Definition at line 52 of file AbstractCoreMatcher.php.

◆ $isCurrentLineIgnored

bool TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher::$isCurrentLineIgnored = false
protected

True if line with $lastIgnoredLineNumber is ignored

Definition at line 60 of file AbstractCoreMatcher.php.

Referenced by TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher\isLineIgnored().

◆ $isFullFileIgnored

bool TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher::$isFullFileIgnored = false
protected

True if the entire file is ignored due to a @extensionScannerIgnoreFile class comment

Definition at line 64 of file AbstractCoreMatcher.php.

◆ $matcherDefinitions

array TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher::$matcherDefinitions = array( )
protected

Incoming main configuration array.

Definition at line 41 of file AbstractCoreMatcher.php.

Referenced by TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ClassNameMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodAnnotationMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\PropertyExistsStaticMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\PropertyPublicMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\PropertyAnnotationMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstantMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\PropertyProtectedMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\FunctionCallMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentRequiredMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodCallMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentDroppedStaticMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ClassConstantMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentDroppedMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ArrayGlobalMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ArrayDimensionMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentRequiredStaticMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodArgumentUnusedMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\InterfaceMethodChangedMatcher\__construct(), TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\MethodCallStaticMatcher\__construct(), and TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher\__construct().

◆ $matches

array TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher::$matches = array( )
protected

◆ NODE_RESOLVED_AS