![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/rector/rector/rules/DeadCode/PhpDoc/Guard/ |
<?php declare (strict_types=1); namespace Rector\DeadCode\PhpDoc\Guard; use PhpParser\Node; use PhpParser\Node\Identifier; use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode; use PHPStan\PhpDocParser\Ast\Type\TypeNode; final class StandaloneTypeRemovalGuard { /** * @var string[] */ private const ALLOWED_TYPES = ['false', 'true']; public function isLegal(TypeNode $typeNode, Node $node) : bool { if (!$typeNode instanceof IdentifierTypeNode) { return \true; } if (!$node instanceof Identifier) { return \true; } if ($node->toString() !== 'bool') { return \true; } return !\in_array($typeNode->name, self::ALLOWED_TYPES, \true); } }