mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-14 21:04:48 +01:00
28 lines
811 B
PHP
28 lines
811 B
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
namespace Rector\Php80\NodeFactory;
|
|
|
|
use PhpParser\Node\Expr;
|
|
use PhpParser\Node\Expr\Match_;
|
|
use Rector\Php80\ValueObject\CondAndExpr;
|
|
final class MatchFactory
|
|
{
|
|
/**
|
|
* @var \Rector\Php80\NodeFactory\MatchArmsFactory
|
|
*/
|
|
private $matchArmsFactory;
|
|
public function __construct(\Rector\Php80\NodeFactory\MatchArmsFactory $matchArmsFactory)
|
|
{
|
|
$this->matchArmsFactory = $matchArmsFactory;
|
|
}
|
|
/**
|
|
* @param CondAndExpr[] $condAndExprs
|
|
*/
|
|
public function createFromCondAndExprs(\PhpParser\Node\Expr $condExpr, array $condAndExprs) : \PhpParser\Node\Expr\Match_
|
|
{
|
|
$matchArms = $this->matchArmsFactory->createFromCondAndExprs($condAndExprs);
|
|
return new \PhpParser\Node\Expr\Match_($condExpr, $matchArms);
|
|
}
|
|
}
|