Skip to content

Commit d9d04c0

Browse files
committed
fixes PHP-CS and PHPStan reportings
Signed-off-by: Stefan Gehrig <[email protected]>
1 parent cd126db commit d9d04c0

File tree

2 files changed

+32
-17
lines changed

2 files changed

+32
-17
lines changed

tests/Gedmo/Tree/Fixture/Issue2582/OU.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<?php
22

3+
/*
4+
* This file is part of the Doctrine Behavioral Extensions package.
5+
* (c) Gediminas Morkevicius <[email protected]> http://www.gediminasm.org
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
310
namespace Gedmo\Tests\Tree\Fixture\Issue2582;
411

512
use Doctrine\Common\Collections\ArrayCollection;
@@ -73,16 +80,18 @@ class OU
7380
/**
7481
* @ORM\OneToMany(targetEntity="\Gedmo\Tests\Tree\Fixture\Issue2582\OU", mappedBy="parent")
7582
* @ORM\OrderBy({"left" = "ASC"})
83+
*
84+
* @var Collection<int, self>
7685
*/
7786
#[ORM\OneToMany(targetEntity: self::class, mappedBy: 'parent')]
7887
#[ORM\OrderBy(['left' => 'ASC'])]
7988
private Collection $children;
8089

8190
public function __construct(string $id, ?self $parent = null)
8291
{
83-
$this->id = $id;
92+
$this->id = $id;
8493
$this->children = new ArrayCollection();
85-
$this->parent = $parent;
94+
$this->parent = $parent;
8695
if ($parent) {
8796
$parent->children->add($this);
8897
}
@@ -93,7 +102,7 @@ public function getId(): string
93102
return $this->id;
94103
}
95104

96-
public function getParent(): ?OU
105+
public function getParent(): ?self
97106
{
98107
return $this->parent;
99108
}
@@ -113,6 +122,9 @@ public function getRight(): int
113122
return $this->right;
114123
}
115124

125+
/**
126+
* @return Collection<int, self>
127+
*/
116128
public function getChildren(): Collection
117129
{
118130
return $this->children;

tests/Gedmo/Tree/Issue/Issue2582Test.php

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ protected function setUp(): void
3232

3333
public function testInsertTwoRootsInOneFlush(): void
3434
{
35-
$ou1 = new OU('00000000-0000-0000-0000-000000000001', null);
35+
$ou1 = new OU('00000000-0000-0000-0000-000000000001', null);
3636
$ou11 = new OU('00000000-0000-0000-0000-000000000011', $ou1);
37-
$ou2 = new OU('00000000-0000-0000-0000-000000000002', null);
37+
$ou2 = new OU('00000000-0000-0000-0000-000000000002', null);
3838
$ou21 = new OU('00000000-0000-0000-0000-000000000021', $ou2);
3939

4040

@@ -53,7 +53,7 @@ public function testInsertTwoRootsInOneFlush(): void
5353
['00000000-0000-0000-0000-000000000021', '00000000-0000-0000-0000-000000000002', 6, 1, 7],
5454
];
5555
foreach ($this->fetchAllOUs() as $i => $a) {
56-
self::assertSame(
56+
static::assertSame(
5757
$expected[$i],
5858
[
5959
$a->getId(),
@@ -68,9 +68,9 @@ public function testInsertTwoRootsInOneFlush(): void
6868

6969
public function testInsertTwoRootsInOneFlushRootsFirst(): void
7070
{
71-
$ou1 = new OU('00000000-0000-0000-0000-000000000001', null);
71+
$ou1 = new OU('00000000-0000-0000-0000-000000000001', null);
7272
$ou11 = new OU('00000000-0000-0000-0000-000000000011', $ou1);
73-
$ou2 = new OU('00000000-0000-0000-0000-000000000002', null);
73+
$ou2 = new OU('00000000-0000-0000-0000-000000000002', null);
7474
$ou21 = new OU('00000000-0000-0000-0000-000000000021', $ou2);
7575

7676

@@ -89,7 +89,7 @@ public function testInsertTwoRootsInOneFlushRootsFirst(): void
8989
['00000000-0000-0000-0000-000000000021', '00000000-0000-0000-0000-000000000002', 6, 1, 7],
9090
];
9191
foreach ($this->fetchAllOUs() as $i => $a) {
92-
self::assertSame(
92+
static::assertSame(
9393
$expected[$i],
9494
[
9595
$a->getId(),
@@ -104,9 +104,9 @@ public function testInsertTwoRootsInOneFlushRootsFirst(): void
104104

105105
public function testInsertTwoRootsInTwoFlushes(): void
106106
{
107-
$ou1 = new OU('00000000-0000-0000-0000-000000000001', null);
107+
$ou1 = new OU('00000000-0000-0000-0000-000000000001', null);
108108
$ou11 = new OU('00000000-0000-0000-0000-000000000011', $ou1);
109-
$ou2 = new OU('00000000-0000-0000-0000-000000000002', null);
109+
$ou2 = new OU('00000000-0000-0000-0000-000000000002', null);
110110
$ou21 = new OU('00000000-0000-0000-0000-000000000021', $ou2);
111111

112112

@@ -126,7 +126,7 @@ public function testInsertTwoRootsInTwoFlushes(): void
126126
['00000000-0000-0000-0000-000000000021', '00000000-0000-0000-0000-000000000002', 6, 1, 7],
127127
];
128128
foreach ($this->fetchAllOUs() as $i => $a) {
129-
self::assertSame(
129+
static::assertSame(
130130
$expected[$i],
131131
[
132132
$a->getId(),
@@ -139,6 +139,14 @@ public function testInsertTwoRootsInTwoFlushes(): void
139139
}
140140
}
141141

142+
protected function getUsedEntityFixtures(): array
143+
{
144+
return [OU::class];
145+
}
146+
147+
/**
148+
* @return list<OU>
149+
*/
142150
private function fetchAllOUs(): array
143151
{
144152
$categoryRepo = $this->em->getRepository(OU::class);
@@ -148,9 +156,4 @@ private function fetchAllOUs(): array
148156
->getQuery()
149157
->getResult();
150158
}
151-
152-
protected function getUsedEntityFixtures(): array
153-
{
154-
return [OU::class];
155-
}
156159
}

0 commit comments

Comments
 (0)