golden hour
/opt/cpanel/ea-wappspector/vendor/rector/rector/rules/DeadCode/PhpDoc/Guard
⬆️ Go Up
Upload
File/Folder
Size
Actions
StandaloneTypeRemovalGuard.php
759 B
Del
OK
TemplateTypeRemovalGuard.php
736 B
Del
OK
Edit: StandaloneTypeRemovalGuard.php
<?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); } }
Save