Skip to content

Commit a62a443

Browse files
authored
Merge pull request #637 from TomHAnderson/hotfix/tests-phpcs
Hotfix/tests phpcs
2 parents de450e5 + 806b106 commit a62a443

33 files changed

+147
-75
lines changed

tests/Assets/AnotherListenerStub.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaravelDoctrineTest\ORM\Assets;
46

57
class AnotherListenerStub

tests/Assets/Auth/AuthenticableMock.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaravelDoctrineTest\ORM\Assets\Auth;
46

57
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;

tests/Assets/Auth/AuthenticableWithNonEmptyConstructorMock.php

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaravelDoctrineTest\ORM\Assets\Auth;
46

57
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
@@ -9,6 +11,7 @@ class AuthenticableWithNonEmptyConstructorMock implements AuthenticatableContrac
911
{
1012
use Authenticatable;
1113

14+
/** @param string[] $passwords */
1215
public function __construct(array $passwords)
1316
{
1417
$this->password = $passwords[0];
+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaravelDoctrineTest\ORM\Assets\Auth\Passwords;
46

57
use Illuminate\Contracts\Auth\CanResetPassword;
@@ -8,20 +10,18 @@ class UserMock implements CanResetPassword
810
{
911
/**
1012
* Get the e-mail address where password reset links are sent.
11-
* @return string
1213
*/
13-
public function getEmailForPasswordReset()
14+
public function getEmailForPasswordReset(): string
1415
{
1516
1617
}
1718

1819
/**
1920
* Send the password reset notification.
20-
*
21-
* @param string $token
22-
* @return void
2321
*/
24-
public function sendPasswordResetNotification($token)
22+
// phpcs:disable
23+
public function sendPasswordResetNotification($token): void
2524
{
2625
}
26+
// phpcs:enable
2727
}
+4-1
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaravelDoctrineTest\ORM\Assets\Configuration;
46

57
use Doctrine\DBAL\Platforms\AbstractPlatform;
68
use Doctrine\DBAL\Types\Type;
79

810
class TypeMock extends Type
911
{
12+
/** @param string[] $column */
1013
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
1114
{
1215
return '';
1316
}
1417

15-
public function getName()
18+
public function getName(): void
1619
{
1720
}
1821
}
+4-1
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaravelDoctrineTest\ORM\Assets\Configuration;
46

57
use Doctrine\DBAL\Platforms\AbstractPlatform;
68
use Doctrine\DBAL\Types\Type;
79

810
class TypeMock2 extends Type
911
{
12+
/** @param string[] $column */
1013
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
1114
{
1215
return '';
1316
}
1417

15-
public function getName()
18+
public function getName(): void
1619
{
1720
}
1821
}

tests/Assets/Decorator.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaravelDoctrineTest\ORM\Assets;
46

57
use Doctrine\ORM\Decorator\EntityManagerDecorator;

tests/Assets/Entity/Foo.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaravelDoctrineTest\ORM\Assets\Entity;
46

57
class Foo
68
{
7-
private $id;
9+
private int $id;
810

9-
private $name;
11+
private string $name;
1012
}

tests/Assets/Entity/Scientist.php

+15-10
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaravelDoctrineTest\ORM\Assets\Entity;
46

7+
use Doctrine\Common\Collections\Collection;
58
use Doctrine\ORM\Mapping as ORM;
9+
use Theory;
610

7-
#[ORM\Entity(repositoryClass: "LaravelDoctrineTest\ORM\Assets\Repository\ScientistRepository")]
11+
#[ORM\Entity(repositoryClass: 'LaravelDoctrineTest\ORM\Assets\Repository\ScientistRepository')]
812
class Scientist
913
{
1014
#[ORM\Id]
11-
#[ORM\Column(type: "integer")]
12-
#[ORM\GeneratedValue(strategy: "AUTO")]
13-
private $id;
15+
#[ORM\Column(type: 'integer')]
16+
#[ORM\GeneratedValue(strategy: 'AUTO')]
17+
private int $id;
1418

15-
#[ORM\Column(type: "string", nullable: true)]
16-
private $firstName;
19+
#[ORM\Column(type: 'string', nullable: true)]
20+
private string $firstName;
1721

18-
#[ORM\Column(type: "string", nullable: false)]
19-
private $lastName;
22+
#[ORM\Column(type: 'string', nullable: false)]
23+
private string $lastName;
2024

21-
#[ORM\OneToMany(targetEntity: \Theory::class, mappedBy: "scientist")]
22-
private $theories;
25+
/** @var Collection|Theory[] */
26+
#[ORM\OneToMany(targetEntity: Theory::class, mappedBy: 'scientist')]
27+
private Collection $theories;
2328
}

tests/Assets/Entity/Theory.php

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaravelDoctrineTest\ORM\Assets\Entity;
46

57
use Doctrine\ORM\Mapping as ORM;
8+
use Scientist;
69

7-
#[ORM\Entity(repositoryClass: "LaravelDoctrineTest\ORM\Assets\Repository\TheoryRepository")]
10+
#[ORM\Entity(repositoryClass: 'LaravelDoctrineTest\ORM\Assets\Repository\TheoryRepository')]
811
class Theory
912
{
1013
#[ORM\Id]
11-
#[ORM\Column(type: "integer")]
12-
#[ORM\GeneratedValue(strategy: "AUTO")]
13-
private $id;
14+
#[ORM\Column(type: 'integer')]
15+
#[ORM\GeneratedValue(strategy: 'AUTO')]
16+
private int $id;
1417

15-
#[ORM\Column(type: "string", nullable: false)]
16-
private $title;
18+
#[ORM\Column(type: 'string', nullable: false)]
19+
private string $title;
1720

18-
#[ORM\ManyToOne(targetEntity: \Scientist::class, inversedBy: "theories")]
19-
#[ORM\JoinColumn(name: "scientist_id", referencedColumnName: "id", nullable: false)]
20-
private $scientist;
21+
#[ORM\ManyToOne(targetEntity: Scientist::class, inversedBy: 'theories')]
22+
#[ORM\JoinColumn(name: 'scientist_id', referencedColumnName: 'id', nullable: false)]
23+
private Scientist $scientist;
2124
}

tests/Assets/Extensions/ExtensionMock.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaravelDoctrineTest\ORM\Assets\Extensions;
46

57
use Doctrine\Common\EventManager;
@@ -15,9 +17,7 @@ public function addSubscribers(EventManager $manager, EntityManagerInterface $em
1517
(new ExtensionManagerTest())->assertTrue(true);
1618
}
1719

18-
/**
19-
* @return mixed[]
20-
*/
20+
/** @return mixed[] */
2121
public function getFilters(): array
2222
{
2323
return [];

tests/Assets/Extensions/ExtensionMock2.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaravelDoctrineTest\ORM\Assets\Extensions;
46

57
use Doctrine\Common\EventManager;
@@ -12,9 +14,7 @@ public function addSubscribers(EventManager $manager, EntityManagerInterface $em
1214
{
1315
}
1416

15-
/**
16-
* @return mixed[]
17-
*/
17+
/** @return mixed[] */
1818
public function getFilters(): array
1919
{
2020
return [];

tests/Assets/Extensions/ExtensionWithFiltersMock.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaravelDoctrineTest\ORM\Assets\Extensions;
46

57
use Doctrine\Common\EventManager;
@@ -12,14 +14,12 @@ public function addSubscribers(EventManager $manager, EntityManagerInterface $em
1214
{
1315
}
1416

15-
/**
16-
* @return mixed[]
17-
*/
17+
/** @return mixed[] */
1818
public function getFilters(): array
1919
{
2020
return [
2121
'filter' => 'FilterMock',
22-
'filter2' => 'FilterMock'
22+
'filter2' => 'FilterMock',
2323
];
2424
}
2525
}

tests/Assets/FakeConnection.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaravelDoctrineTest\ORM\Assets;
46

57
use Doctrine\DBAL\Connection;

tests/Assets/FakeEventManager.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaravelDoctrineTest\ORM\Assets;
46

57
use Doctrine\Common\EventManager;

tests/Assets/FilterStub.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaravelDoctrineTest\ORM\Assets;
46

5-
use Doctrine\ORM\Query\Filter\SQLFilter;
67
use Doctrine\ORM\Mapping\ClassMetadata;
8+
use Doctrine\ORM\Query\Filter\SQLFilter;
79

810
class FilterStub extends SQLFilter
911
{

tests/Assets/ListenerStub.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaravelDoctrineTest\ORM\Assets;
46

57
class ListenerStub

tests/Assets/Middleware/BindableEntity.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaravelDoctrineTest\ORM\Assets\Middleware;
46

7+
use function strtolower;
8+
59
class BindableEntity
610
{
7-
public $id;
11+
public int $id;
812

9-
public $name;
13+
public string $name;
1014

11-
public function getId()
15+
public function getId(): int
1216
{
1317
return $this->id;
1418
}
1519

16-
public function getName()
20+
public function getName(): string
1721
{
1822
return strtolower($this->name);
1923
}

tests/Assets/Middleware/BindableEntityWithInterface.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace LaravelDoctrineTest\ORM\Assets\Middleware;
46

57
use LaravelDoctrine\ORM\Contracts\UrlRoutable;
68

9+
use function strtolower;
10+
711
class BindableEntityWithInterface implements UrlRoutable
812
{
9-
public $id;
13+
public int $id;
1014

11-
public $name;
15+
public string $name;
1216

13-
public function getId()
17+
public function getId(): int
1418
{
1519
return $this->id;
1620
}
1721

18-
public function getName()
22+
public function getName(): string
1923
{
2024
return strtolower($this->name);
2125
}

0 commit comments

Comments
 (0)