mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-10 21:22:21 +00:00
bdfd24339f
2e977bd3aa
deploy to original repository
27 lines
704 B
PHP
27 lines
704 B
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
namespace Rector\BetterPhpDocParser\Printer;
|
|
|
|
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
|
|
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode;
|
|
final class EmptyPhpDocDetector
|
|
{
|
|
public function isPhpDocNodeEmpty(PhpDocNode $phpDocNode) : bool
|
|
{
|
|
if ($phpDocNode->children === []) {
|
|
return \true;
|
|
}
|
|
foreach ($phpDocNode->children as $phpDocChildNode) {
|
|
if ($phpDocChildNode instanceof PhpDocTextNode) {
|
|
if ($phpDocChildNode->text !== '') {
|
|
return \false;
|
|
}
|
|
} else {
|
|
return \false;
|
|
}
|
|
}
|
|
return \true;
|
|
}
|
|
}
|