Skip to content

[PHP 7.4] Improve TypedPropertyRector for Doctrine collection#3056

Merged
TomasVotruba merged 1 commit intomasterfrom
php74-typed-properties
Mar 24, 2020
Merged

[PHP 7.4] Improve TypedPropertyRector for Doctrine collection#3056
TomasVotruba merged 1 commit intomasterfrom
php74-typed-properties

Conversation

@TomasVotruba
Copy link
Copy Markdown
Member

@TomasVotruba TomasVotruba commented Mar 24, 2020

Before Doctrine Collections were Skipped

<?php

namespace Rector\Php74\Tests\Rector\Property\TypedPropertyRector\Fixture;

use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Pehapkari\Training\Entity\TrainingTerm;

/**
 * @ORM\Entity
 */
class DoctrineCollection
{
    /**
     * @ORM\OneToMany(targetEntity="Pehapkari\Training\Entity\TrainingTerm", mappedBy="training")
     * @var TrainingTerm[]&Collection
     */
    private $trainingTerms;
}

Now The Collection Type is Used and Annotation Kept, to add more info

<?php

namespace Rector\Php74\Tests\Rector\Property\TypedPropertyRector\Fixture;

use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Pehapkari\Training\Entity\TrainingTerm;

/**
 * @ORM\Entity
 */
class DoctrineCollection
{
    /**
     * @ORM\OneToMany(targetEntity="Pehapkari\Training\Entity\TrainingTerm", mappedBy="training")
     * @var TrainingTerm[]&Collection
     */
-   private $trainingTerms;
+   private Collection $trainingTerms;
}

@TomasVotruba TomasVotruba force-pushed the php74-typed-properties branch from 7dd4b4d to aa9588f Compare March 24, 2020 20:41
@TomasVotruba TomasVotruba changed the title [PHP 7.4] Improve TypedProeprtyRector for Doctrine collection [PHP 7.4] Improve TypedPropertyRector for Doctrine collection Mar 24, 2020
@TomasVotruba TomasVotruba merged commit 1d11fa0 into master Mar 24, 2020
@TomasVotruba TomasVotruba deleted the php74-typed-properties branch March 24, 2020 20:58
TomasVotruba added a commit that referenced this pull request Nov 12, 2022
rectorphp/rector-src@2be958b [Core] Fix resolve scope handling when parent Node just re-printed (#3056)
TomasVotruba added a commit that referenced this pull request Nov 12, 2022
rectorphp/rector-src@2be958b [Core] Fix resolve scope handling when parent Node just re-printed (#3056)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant