various fixes

This commit is contained in:
TomasVotruba 2020-02-29 01:29:42 +01:00
parent 8f3e90ba7f
commit 128910963a
3 changed files with 15 additions and 2 deletions

View File

@ -11,6 +11,8 @@ use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\FunctionLike;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\RectorDefinition\CodeSample;
use Rector\Core\RectorDefinition\RectorDefinition;
@ -111,6 +113,10 @@ PHP
return false;
}
if (! $node->name instanceof Identifier && ! $node->name instanceof Name) {
return true;
}
$functionName = $this->getName($node->name);
if ($functionName === null) {
return false;

View File

@ -107,8 +107,11 @@ PHP
return true;
}
/** @var PhpDocInfo $phpDocInfo */
/** @var PhpDocInfo|null $phpDocInfo */
$phpDocInfo = $class->getAttribute(AttributeKey::PHP_DOC_INFO);
if ($phpDocInfo === null) {
return true;
}
$seeTags = $phpDocInfo->getTagsByName('see');

View File

@ -92,9 +92,13 @@ final class AssertTrueFalseInternalTypeToSpecificMethodRector extends AbstractPH
return null;
}
/** @var FuncCall $firstArgumentValue */
/** @var FuncCall|Node $firstArgumentValue */
$firstArgumentValue = $node->args[0]->value;
if (! $firstArgumentValue instanceof FuncCall) {
return null;
}
$functionName = $this->getName($firstArgumentValue);
if (! isset(self::OLD_FUNCTIONS_TO_TYPES[$functionName])) {
return null;