PHP 8.2.31
Preview: ArrayCollectionAssignFactory.php Size: 892 B
//opt/cpanel/ea-wappspector/vendor/rector/rector/vendor/rector/rector-doctrine/src/NodeFactory/ArrayCollectionAssignFactory.php

<?php

declare (strict_types=1);
namespace Rector\Doctrine\NodeFactory;

use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\New_;
use PhpParser\Node\Name\FullyQualified;
use PhpParser\Node\Stmt\Expression;
use Rector\PhpParser\Node\NodeFactory;
final class ArrayCollectionAssignFactory
{
    /**
     * @readonly
     * @var \Rector\PhpParser\Node\NodeFactory
     */
    private $nodeFactory;
    public function __construct(NodeFactory $nodeFactory)
    {
        $this->nodeFactory = $nodeFactory;
    }
    public function createFromPropertyName(string $toManyPropertyName) : Expression
    {
        $propertyFetch = $this->nodeFactory->createPropertyFetch('this', $toManyPropertyName);
        $new = new New_(new FullyQualified('Doctrine\\Common\\Collections\\ArrayCollection'));
        $assign = new Assign($propertyFetch, $new);
        return new Expression($assign);
    }
}

Directory Contents

Dirs: 0 × Files: 2

Name Size Perms Modified Actions
892 B lrw-r--r-- 2024-11-08 13:59:10
Edit Download
1.38 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).