| Subject |
Details |
| PHP version |
PHP 7.3.9-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Sep 2 2019 12:54:24) ( NTS ) |
| Full Command |
vendor/bin/rector --dry-run process src/Entity/Page/Template.php |
Current Behaviour
I've noticed two more errors when running ImportFullyQualifiedNamesRector on our codebase :
inverseJoinColumns -> @ORM\JoinColumn -> name is modified to match the one in joinColumns -> @ORM\JoinColumn -> name (which is wrong, it should be different)
- The indentation is broken and the doc block's
* characters are missing
Rector dev-master@c378a44
Config file: rector.yaml
3/3 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
1 file with changes
===================
1) src/Entity/Page/Template.php
---------- begin diff ----------
--- Original
+++ New
@@ -34,14 +34,16 @@
private $name;
/**
- * @var Area[]|Collection
- *
- * @ORM\ManyToMany(targetEntity="Area", cascade={"remove", "persist"}, inversedBy="templates")
- * @ORM\JoinTable(name="page_template_area",
- * joinColumns={@ORM\JoinColumn(name="template_id", referencedColumnName="id", onDelete="CASCADE")},
- * inverseJoinColumns={@ORM\JoinColumn(name="area_id", referencedColumnName="id")}
- * )
- */
+ * @var Area[]|Collection
+ *
+ * @ORM\ManyToMany(targetEntity="Area", cascade={"remove", "persist"}, inversedBy="templates")
+ * @ORM\JoinTable(name="page_template_area", joinColumns={
+ @ORM\JoinColumn(name="template_id", referencedColumnName="id", onDelete="CASCADE")
+ }, inverseJoinColumns={
+ @ORM\JoinColumn(name="template_id", referencedColumnName="id")
+ }
+ )
+ */
private $areas;
/**
----------- end diff -----------
Applied rectors:
* Rector\CodingStyle\Rector\Namespace_\ImportFullyQualifiedNamesRector
With rector.yaml as follow :
services:
Rector\CodingStyle\Rector\Namespace_\ImportFullyQualifiedNamesRector: ~
And Template.php as follow :
<?php
declare(strict_types=1);
namespace App\Entity\Page;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* Template
*
* @ORM\Table(name="page_template")
* @ORM\Entity()
*/
class Template
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255, unique=true)
*/
private $name;
/**
* @ORM\ManyToOne(targetEntity="Site")
* @ORM\JoinColumn(name="site_id", referencedColumnName="id", onDelete="CASCADE")
*/
private $site;
public function __construct()
{
$this->areas = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function addArea(Area $area): self
{
$this->areas[] = $area;
return $this;
}
public function removeArea(Area $area): self
{
$this->areas->removeElement($area);
return $this;
}
/**
* @return Area[]|Collection
*/
public function getAreas()
{
return $this->areas;
}
}
I've tried adding the Template.php file as a test case on ImportFullyQualifiedNamesRectorTest, but it passed... :/ I'll try to debug it and provide you more information ASAP.
PHP 7.3.9-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Sep 2 2019 12:54:24) ( NTS )vendor/bin/rector --dry-run process src/Entity/Page/Template.phpCurrent Behaviour
I've noticed two more errors when running
ImportFullyQualifiedNamesRectoron our codebase :inverseJoinColumns -> @ORM\JoinColumn -> nameis modified to match the one injoinColumns -> @ORM\JoinColumn -> name(which is wrong, it should be different)*characters are missingRector dev-master@c378a44 Config file: rector.yaml 3/3 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% 1 file with changes =================== 1) src/Entity/Page/Template.php ---------- begin diff ---------- --- Original +++ New @@ -34,14 +34,16 @@ private $name; /** - * @var Area[]|Collection - * - * @ORM\ManyToMany(targetEntity="Area", cascade={"remove", "persist"}, inversedBy="templates") - * @ORM\JoinTable(name="page_template_area", - * joinColumns={@ORM\JoinColumn(name="template_id", referencedColumnName="id", onDelete="CASCADE")}, - * inverseJoinColumns={@ORM\JoinColumn(name="area_id", referencedColumnName="id")} - * ) - */ + * @var Area[]|Collection + * + * @ORM\ManyToMany(targetEntity="Area", cascade={"remove", "persist"}, inversedBy="templates") + * @ORM\JoinTable(name="page_template_area", joinColumns={ + @ORM\JoinColumn(name="template_id", referencedColumnName="id", onDelete="CASCADE") + }, inverseJoinColumns={ + @ORM\JoinColumn(name="template_id", referencedColumnName="id") + } + ) + */ private $areas; /** ----------- end diff ----------- Applied rectors: * Rector\CodingStyle\Rector\Namespace_\ImportFullyQualifiedNamesRectorWith
rector.yamlas follow :And
Template.phpas follow :I've tried adding the
Template.phpfile as a test case onImportFullyQualifiedNamesRectorTest, but it passed... :/ I'll try to debug it and provide you more information ASAP.