Skip to content

Commit

Permalink
Apply coding standard (#4047)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Action <actions@github.com>
  • Loading branch information
TomasVotruba and actions-user committed Jun 2, 2023
1 parent 92ff716 commit 897cdda
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Rector\Tests\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser;

use Iterator;
use PhpParser\Node\Scalar\String_;
use PHPUnit\Framework\Attributes\DataProvider;
use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode;
use Rector\BetterPhpDocParser\PhpDoc\StringNode;
Expand Down Expand Up @@ -43,9 +42,7 @@ public static function provideData(): Iterator
{
yield ['{key: "value"}', [new ArrayItemNode(new StringNode('value'), 'key')]];

yield ['{"key": "value"}', [
new ArrayItemNode(new StringNode('value'), new StringNode('key')),
]];
yield ['{"key": "value"}', [new ArrayItemNode(new StringNode('value'), new StringNode('key'))]];

yield ['{"value", "value2"}', [
new ArrayItemNode(new StringNode('value')),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Rector\Tests\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser;

use Iterator;
use PhpParser\Node\Scalar\String_;
use PHPUnit\Framework\Attributes\DataProvider;
use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode;
use Rector\BetterPhpDocParser\PhpDoc\StringNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Rector\Tests\BetterPhpDocParser\PhpDocParser\TagValueNodeReprint;

use PhpParser\Node;
use PhpParser\Node\Scalar\String_;
use PhpParser\Node\Stmt\ClassMethod;
use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode;
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
Expand Down
1 change: 0 additions & 1 deletion packages/BetterPhpDocParser/PhpDoc/ArrayItemNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Rector\BetterPhpDocParser\PhpDoc;

use PhpParser\Node\Scalar\String_;
use PHPStan\PhpDocParser\Ast\NodeAttributes;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode;
use Stringable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ protected function printValuesContent(array $values): string
return $itemContents;
}

private function isValueKeyEquals(ArrayItemNode $value, string $desiredKey): bool
private function isValueKeyEquals(ArrayItemNode $arrayItemNode, string $desiredKey): bool
{
if ($value->key instanceof StringNode) {
return $value->key->value === $desiredKey;
if ($arrayItemNode->key instanceof StringNode) {
return $arrayItemNode->key->value === $desiredKey;
}

return $value->key === $desiredKey;
return $arrayItemNode->key === $desiredKey;
}

private function stringifyValue(mixed $value): string
Expand Down
12 changes: 7 additions & 5 deletions tests/Issues/Issue7023/Fixture/Php73/fixture.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Rector\Core\Tests\Issues\Issue7023\Fixture\Php73;

use Doctrine\ORM\Mapping as ORM;
use Acme\Entity\User;
use Rector\Core\Tests\Issues\Issue7023\Source\SomeUser;

/**
* @ORM\Entity
Expand All @@ -12,12 +12,13 @@ class Fixture
{

/**
* @ORM\ManyToOne(targetEntity="\Acme\Entity\User", inversedBy="images")
* @ORM\ManyToOne(targetEntity="\Rector\Core\Tests\Issues\Issue7023\Source\SomeUser", inversedBy="images")
* @ORM\JoinColumn(name="data_id", nullable=true)
* @var User
* @var SomeUser
*/
private $user;
}

?>
-----
<?php
Expand All @@ -34,10 +35,11 @@ class Fixture
{

/**
* @ORM\ManyToOne(targetEntity="\Acme\Entity\User", inversedBy="images")
* @ORM\ManyToOne(targetEntity="\Rector\Core\Tests\Issues\Issue7023\Source\SomeUser", inversedBy="images")
* @ORM\JoinColumn(name="data_id", nullable=true)
* @var \Acme\Entity\User|null
* @var \Rector\Core\Tests\Issues\Issue7023\Source\SomeUser|null
*/
private $user;
}

?>
8 changes: 8 additions & 0 deletions tests/Issues/Issue7023/Source/SomeUser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Rector\Core\Tests\Issues\Issue7023\Source;

class SomeUser
{

}

0 comments on commit 897cdda

Please sign in to comment.