|
@@ -63,7 +63,7 @@ abstract class AbstractFunctionReferenceFixer extends AbstractFixer
|
|
$end = null === $end ? $tokens->count() : $end;
|
|
$end = null === $end ? $tokens->count() : $end;
|
|
|
|
|
|
// find raw sequence which we can analyse for context
|
|
// find raw sequence which we can analyse for context
|
|
- $candidateSequence = array(array(T_STRING, $functionNameToSearch), '(');
|
|
|
|
|
|
+ $candidateSequence = [[T_STRING, $functionNameToSearch], '('];
|
|
$matches = $tokens->findSequence($candidateSequence, $start, $end, false);
|
|
$matches = $tokens->findSequence($candidateSequence, $start, $end, false);
|
|
if (null === $matches) {
|
|
if (null === $matches) {
|
|
// not found, simply return without further attempts
|
|
// not found, simply return without further attempts
|
|
@@ -76,7 +76,7 @@ abstract class AbstractFunctionReferenceFixer extends AbstractFixer
|
|
// first criteria check: shall look like function call
|
|
// first criteria check: shall look like function call
|
|
$functionNamePrefix = $tokens->getPrevMeaningfulToken($functionName);
|
|
$functionNamePrefix = $tokens->getPrevMeaningfulToken($functionName);
|
|
$functionNamePrecedingToken = $tokens[$functionNamePrefix];
|
|
$functionNamePrecedingToken = $tokens[$functionNamePrefix];
|
|
- if ($functionNamePrecedingToken->isGivenKind(array(T_DOUBLE_COLON, T_NEW, T_OBJECT_OPERATOR, T_FUNCTION, CT::T_RETURN_REF))) {
|
|
|
|
|
|
+ if ($functionNamePrecedingToken->isGivenKind([T_DOUBLE_COLON, T_NEW, T_OBJECT_OPERATOR, T_FUNCTION, CT::T_RETURN_REF])) {
|
|
// this expression is differs from expected, resume
|
|
// this expression is differs from expected, resume
|
|
return $this->find($functionNameToSearch, $tokens, $openParenthesis, $end);
|
|
return $this->find($functionNameToSearch, $tokens, $openParenthesis, $end);
|
|
}
|
|
}
|
|
@@ -85,7 +85,7 @@ abstract class AbstractFunctionReferenceFixer extends AbstractFixer
|
|
if ($functionNamePrecedingToken->isGivenKind(T_NS_SEPARATOR)) {
|
|
if ($functionNamePrecedingToken->isGivenKind(T_NS_SEPARATOR)) {
|
|
$namespaceCandidate = $tokens->getPrevMeaningfulToken($functionNamePrefix);
|
|
$namespaceCandidate = $tokens->getPrevMeaningfulToken($functionNamePrefix);
|
|
$namespaceCandidateToken = $tokens[$namespaceCandidate];
|
|
$namespaceCandidateToken = $tokens[$namespaceCandidate];
|
|
- if ($namespaceCandidateToken->isGivenKind(array(T_NEW, T_STRING, CT::T_NAMESPACE_OPERATOR))) {
|
|
|
|
|
|
+ if ($namespaceCandidateToken->isGivenKind([T_NEW, T_STRING, CT::T_NAMESPACE_OPERATOR])) {
|
|
// here can be added complete namespace scan
|
|
// here can be added complete namespace scan
|
|
// this expression is differs from expected, resume
|
|
// this expression is differs from expected, resume
|
|
return $this->find($functionNameToSearch, $tokens, $openParenthesis, $end);
|
|
return $this->find($functionNameToSearch, $tokens, $openParenthesis, $end);
|
|
@@ -95,7 +95,7 @@ abstract class AbstractFunctionReferenceFixer extends AbstractFixer
|
|
// final step: find closing parenthesis
|
|
// final step: find closing parenthesis
|
|
$closeParenthesis = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $openParenthesis);
|
|
$closeParenthesis = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $openParenthesis);
|
|
|
|
|
|
- return array($functionName, $openParenthesis, $closeParenthesis);
|
|
|
|
|
|
+ return [$functionName, $openParenthesis, $closeParenthesis];
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -114,7 +114,7 @@ abstract class AbstractFunctionReferenceFixer extends AbstractFixer
|
|
*/
|
|
*/
|
|
protected function getArguments(Tokens $tokens, $openParenthesis, $closeParenthesis)
|
|
protected function getArguments(Tokens $tokens, $openParenthesis, $closeParenthesis)
|
|
{
|
|
{
|
|
- $arguments = array();
|
|
|
|
|
|
+ $arguments = [];
|
|
$firstSensibleToken = $tokens->getNextMeaningfulToken($openParenthesis);
|
|
$firstSensibleToken = $tokens->getNextMeaningfulToken($openParenthesis);
|
|
if ($tokens[$firstSensibleToken]->equals(')')) {
|
|
if ($tokens[$firstSensibleToken]->equals(')')) {
|
|
return $arguments;
|
|
return $arguments;
|