rector/rules/PSR4/NodeManipulator/NamespaceManipulator.php
Tomas Votruba d56e7982d0 Updated Rector to commit dedd4b55fe3e03cae9bd5ac822cfdccd8deb3fb6
dedd4b55fe make node_helper.php safe for similar names
2021-05-09 20:15:43 +00:00

20 lines
526 B
PHP

<?php
declare (strict_types=1);
namespace Rector\PSR4\NodeManipulator;
use PhpParser\Node\Stmt\ClassLike;
use PhpParser\Node\Stmt\Namespace_;
final class NamespaceManipulator
{
public function removeClassLikes(\PhpParser\Node\Stmt\Namespace_ $namespace) : void
{
foreach ($namespace->stmts as $key => $namespaceStatement) {
if (!$namespaceStatement instanceof \PhpParser\Node\Stmt\ClassLike) {
continue;
}
unset($namespace->stmts[$key]);
}
}
}