rector/rules/Php80/NodeFactory/MatchFactory.php
Tomas Votruba c726969380 Updated Rector to commit fc10fce13dcf9767f54e4202b509020fed338645
fc10fce13d [Rectify] [Php81] Enable Rectify on Readonly Property only (#1384)
2021-12-04 12:47:17 +00:00

29 lines
828 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
{
/**
* @readonly
* @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);
}
}