mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-19 14:27:14 +01:00
bdfd24339f
2e977bd3aa
deploy to original repository
27 lines
734 B
PHP
27 lines
734 B
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
namespace Rector\Php80\NodeFactory;
|
|
|
|
use PhpParser\Node\Expr;
|
|
use PhpParser\Node\Expr\BinaryOp\BitwiseOr;
|
|
use PhpParser\Node\Expr\ClassConstFetch;
|
|
final class AttributeFlagFactory
|
|
{
|
|
/**
|
|
* @param ClassConstFetch[] $classConstFetches
|
|
* @return ClassConstFetch|BitwiseOr|null
|
|
*/
|
|
public function createFlagCollection(array $classConstFetches) : ?Expr
|
|
{
|
|
if ($classConstFetches === []) {
|
|
return null;
|
|
}
|
|
$flagCollection = \array_shift($classConstFetches);
|
|
foreach ($classConstFetches as $classConstFetch) {
|
|
$flagCollection = new BitwiseOr($flagCollection, $classConstFetch);
|
|
}
|
|
return $flagCollection;
|
|
}
|
|
}
|