‪TYPO3CMS  ‪main
TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher Class Reference
Inheritance diagram for TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher:
TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher TYPO3\CMS\Install\ExtensionScanner\CodeScannerInterface

Public Member Functions

 __construct (array $matcherDefinitions)
 
 enterNode (Node $node)
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher
 getMatches ()
 

Protected Member Functions

 handleRequiredArguments (Node $node, Node $resolvedNode)
 
 handleDroppedArguments (Node $node, Node $resolvedNode)
 
 handleCalledArguments (Node $node, Node $resolvedNode)
 
 handleUnusedArguments (Node $node, Node $resolvedNode)
 
 validateMatcherDefinitionsTopicRequirements (array $topicRequirements)
 
- ‪Protected Member Functions inherited from ‪TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher
 validateMatcherDefinitions (array $requiredArrayKeys=[])
 
 validateMatcherDefinitionKeys (string $key, array $matcherDefinition, array $requiredArrayKeys=[])
 
 initializeFlatMatcherDefinitions ()
 
 isArgumentUnpackingUsed (array $arguments=[])
 
 isLineIgnored (Node $node)
 
 isFileIgnored (Node $node)
 

Protected Attributes

const TOPIC_TYPE_REQUIRED = 'required'
 
const TOPIC_TYPE_DROPPED = 'dropped'
 
const TOPIC_TYPE_CALLED = 'called'
 
const TOPIC_TYPE_UNUSED = 'unused'
 
- ‪Protected Attributes inherited from ‪TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher
array $matcherDefinitions = array( )
 
array $matches = array( )
 
array $flatMatcherDefinitions = array( )
 
int $currentCodeLine = 0
 
bool $isCurrentLineIgnored = false
 
bool $isFullFileIgnored = false
 

Additional Inherited Members

- ‪Public Attributes inherited from ‪TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher
const NODE_RESOLVED_AS = 'nodeResolvedAs'
 

Detailed Description

Finds invocations to class constructors and the amount of passed arguments. This matcher supports direct new MyClass(123) invocations as well as delegated calls to GeneralUtility::makeInstance(MyClass::class, 123) using GeneratorClassResolver.

These configuration property names are handled independently:

  • ‪numberOfMandatoryArguments
  • ‪maximumNumberOfArguments
  • ‪unusedArgumentNumbers

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

Definition at line 36 of file ConstructorArgumentMatcher.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher::__construct ( array  $matcherDefinitions)

Prepare $this->flatMatcherDefinitions once and validate config

Parameters
array$matcherDefinitions‪Incoming main configuration

Definition at line 48 of file ConstructorArgumentMatcher.php.

References TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher\$matcherDefinitions, and TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher\validateMatcherDefinitionsTopicRequirements().

Member Function Documentation

◆ enterNode()

◆ handleCalledArguments()

TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher::handleCalledArguments ( Node  $node,
Node  $resolvedNode 
)
protected
Parameters
Node$node‪reflects invocation, e.g. GeneralUtility::makeInstance(MyClass::class, 123)
Node$resolvedNode‪reflects resolved and actual usage, e.g. new MyClass(123)

Definition at line 154 of file ConstructorArgumentMatcher.php.

References TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\AbstractCoreMatcher\isArgumentUnpackingUsed(), and TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher\TOPIC_TYPE_CALLED.

Referenced by TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher\enterNode().

◆ handleDroppedArguments()

TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher::handleDroppedArguments ( Node  $node,
Node  $resolvedNode 
)
protected
Parameters
Node$node‪reflects invocation, e.g. GeneralUtility::makeInstance(MyClass::class, 123)
Node$resolvedNode‪reflects resolved and actual usage, e.g. new MyClass(123)

Definition at line 125 of file ConstructorArgumentMatcher.php.

References TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher\TOPIC_TYPE_DROPPED.

Referenced by TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher\enterNode().

◆ handleRequiredArguments()

TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher::handleRequiredArguments ( Node  $node,
Node  $resolvedNode 
)
protected
Parameters
Node$node‪reflects invocation, e.g. GeneralUtility::makeInstance(MyClass::class, 123)
Node$resolvedNode‪reflects resolved and actual usage, e.g. new MyClass(123)

Definition at line 96 of file ConstructorArgumentMatcher.php.

References TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher\TOPIC_TYPE_REQUIRED.

Referenced by TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher\enterNode().

◆ handleUnusedArguments()

TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher::handleUnusedArguments ( Node  $node,
Node  $resolvedNode 
)
protected
Parameters
Node$node‪reflects invocation, e.g. GeneralUtility::makeInstance(MyClass::class, 123)
Node$resolvedNode‪reflects resolved and actual usage, e.g. new MyClass(123)

Definition at line 186 of file ConstructorArgumentMatcher.php.

References TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher\TOPIC_TYPE_UNUSED.

Referenced by TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher\enterNode().

◆ validateMatcherDefinitionsTopicRequirements()

TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher::validateMatcherDefinitionsTopicRequirements ( array  $topicRequirements)
protected

Member Data Documentation

◆ TOPIC_TYPE_CALLED

const TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher::TOPIC_TYPE_CALLED = 'called'
protected

◆ TOPIC_TYPE_DROPPED

const TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher::TOPIC_TYPE_DROPPED = 'dropped'
protected

◆ TOPIC_TYPE_REQUIRED

const TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher::TOPIC_TYPE_REQUIRED = 'required'
protected

◆ TOPIC_TYPE_UNUSED

const TYPO3\CMS\Install\ExtensionScanner\Php\Matcher\ConstructorArgumentMatcher::TOPIC_TYPE_UNUSED = 'unused'
protected