Skip to content

Commit

Permalink
Merge pull request #637 from TomHAnderson/hotfix/tests-phpcs
Browse files Browse the repository at this point in the history
Hotfix/tests phpcs
  • Loading branch information
TomHAnderson authored Oct 28, 2024
2 parents de450e5 + 806b106 commit a62a443
Show file tree
Hide file tree
Showing 33 changed files with 147 additions and 75 deletions.
2 changes: 2 additions & 0 deletions tests/Assets/AnotherListenerStub.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace LaravelDoctrineTest\ORM\Assets;

class AnotherListenerStub
Expand Down
2 changes: 2 additions & 0 deletions tests/Assets/Auth/AuthenticableMock.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace LaravelDoctrineTest\ORM\Assets\Auth;

use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace LaravelDoctrineTest\ORM\Assets\Auth;

use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
Expand All @@ -9,6 +11,7 @@ class AuthenticableWithNonEmptyConstructorMock implements AuthenticatableContrac
{
use Authenticatable;

/** @param string[] $passwords */
public function __construct(array $passwords)
{
$this->password = $passwords[0];
Expand Down
12 changes: 6 additions & 6 deletions tests/Assets/Auth/Passwords/UserMock.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace LaravelDoctrineTest\ORM\Assets\Auth\Passwords;

use Illuminate\Contracts\Auth\CanResetPassword;
Expand All @@ -8,20 +10,18 @@ class UserMock implements CanResetPassword
{
/**
* Get the e-mail address where password reset links are sent.
* @return string
*/
public function getEmailForPasswordReset()
public function getEmailForPasswordReset(): string
{
return '[email protected]';
}

/**
* Send the password reset notification.
*
* @param string $token
* @return void
*/
public function sendPasswordResetNotification($token)
// phpcs:disable
public function sendPasswordResetNotification($token): void
{
}
// phpcs:enable
}
5 changes: 4 additions & 1 deletion tests/Assets/Configuration/TypeMock.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
<?php

declare(strict_types=1);

namespace LaravelDoctrineTest\ORM\Assets\Configuration;

use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\Type;

class TypeMock extends Type
{
/** @param string[] $column */
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
{
return '';
}

public function getName()
public function getName(): void
{
}
}
5 changes: 4 additions & 1 deletion tests/Assets/Configuration/TypeMock2.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
<?php

declare(strict_types=1);

namespace LaravelDoctrineTest\ORM\Assets\Configuration;

use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\Type;

class TypeMock2 extends Type
{
/** @param string[] $column */
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
{
return '';
}

public function getName()
public function getName(): void
{
}
}
2 changes: 2 additions & 0 deletions tests/Assets/Decorator.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace LaravelDoctrineTest\ORM\Assets;

use Doctrine\ORM\Decorator\EntityManagerDecorator;
Expand Down
6 changes: 4 additions & 2 deletions tests/Assets/Entity/Foo.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

declare(strict_types=1);

namespace LaravelDoctrineTest\ORM\Assets\Entity;

class Foo
{
private $id;
private int $id;

private $name;
private string $name;
}
25 changes: 15 additions & 10 deletions tests/Assets/Entity/Scientist.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
<?php

declare(strict_types=1);

namespace LaravelDoctrineTest\ORM\Assets\Entity;

use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Theory;

#[ORM\Entity(repositoryClass: "LaravelDoctrineTest\ORM\Assets\Repository\ScientistRepository")]
#[ORM\Entity(repositoryClass: 'LaravelDoctrineTest\ORM\Assets\Repository\ScientistRepository')]
class Scientist
{
#[ORM\Id]
#[ORM\Column(type: "integer")]
#[ORM\GeneratedValue(strategy: "AUTO")]
private $id;
#[ORM\Column(type: 'integer')]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private int $id;

#[ORM\Column(type: "string", nullable: true)]
private $firstName;
#[ORM\Column(type: 'string', nullable: true)]
private string $firstName;

#[ORM\Column(type: "string", nullable: false)]
private $lastName;
#[ORM\Column(type: 'string', nullable: false)]
private string $lastName;

#[ORM\OneToMany(targetEntity: \Theory::class, mappedBy: "scientist")]
private $theories;
/** @var Collection|Theory[] */
#[ORM\OneToMany(targetEntity: Theory::class, mappedBy: 'scientist')]
private Collection $theories;
}
21 changes: 12 additions & 9 deletions tests/Assets/Entity/Theory.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
<?php

declare(strict_types=1);

namespace LaravelDoctrineTest\ORM\Assets\Entity;

use Doctrine\ORM\Mapping as ORM;
use Scientist;

#[ORM\Entity(repositoryClass: "LaravelDoctrineTest\ORM\Assets\Repository\TheoryRepository")]
#[ORM\Entity(repositoryClass: 'LaravelDoctrineTest\ORM\Assets\Repository\TheoryRepository')]
class Theory
{
#[ORM\Id]
#[ORM\Column(type: "integer")]
#[ORM\GeneratedValue(strategy: "AUTO")]
private $id;
#[ORM\Column(type: 'integer')]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private int $id;

#[ORM\Column(type: "string", nullable: false)]
private $title;
#[ORM\Column(type: 'string', nullable: false)]
private string $title;

#[ORM\ManyToOne(targetEntity: \Scientist::class, inversedBy: "theories")]
#[ORM\JoinColumn(name: "scientist_id", referencedColumnName: "id", nullable: false)]
private $scientist;
#[ORM\ManyToOne(targetEntity: Scientist::class, inversedBy: 'theories')]
#[ORM\JoinColumn(name: 'scientist_id', referencedColumnName: 'id', nullable: false)]
private Scientist $scientist;
}
6 changes: 3 additions & 3 deletions tests/Assets/Extensions/ExtensionMock.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace LaravelDoctrineTest\ORM\Assets\Extensions;

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

/**
* @return mixed[]
*/
/** @return mixed[] */
public function getFilters(): array
{
return [];
Expand Down
6 changes: 3 additions & 3 deletions tests/Assets/Extensions/ExtensionMock2.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace LaravelDoctrineTest\ORM\Assets\Extensions;

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

/**
* @return mixed[]
*/
/** @return mixed[] */
public function getFilters(): array
{
return [];
Expand Down
8 changes: 4 additions & 4 deletions tests/Assets/Extensions/ExtensionWithFiltersMock.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace LaravelDoctrineTest\ORM\Assets\Extensions;

use Doctrine\Common\EventManager;
Expand All @@ -12,14 +14,12 @@ public function addSubscribers(EventManager $manager, EntityManagerInterface $em
{
}

/**
* @return mixed[]
*/
/** @return mixed[] */
public function getFilters(): array
{
return [
'filter' => 'FilterMock',
'filter2' => 'FilterMock'
'filter2' => 'FilterMock',
];
}
}
2 changes: 2 additions & 0 deletions tests/Assets/FakeConnection.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace LaravelDoctrineTest\ORM\Assets;

use Doctrine\DBAL\Connection;
Expand Down
2 changes: 2 additions & 0 deletions tests/Assets/FakeEventManager.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace LaravelDoctrineTest\ORM\Assets;

use Doctrine\Common\EventManager;
Expand Down
4 changes: 3 additions & 1 deletion tests/Assets/FilterStub.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php

declare(strict_types=1);

namespace LaravelDoctrineTest\ORM\Assets;

use Doctrine\ORM\Query\Filter\SQLFilter;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Query\Filter\SQLFilter;

class FilterStub extends SQLFilter
{
Expand Down
2 changes: 2 additions & 0 deletions tests/Assets/ListenerStub.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace LaravelDoctrineTest\ORM\Assets;

class ListenerStub
Expand Down
12 changes: 8 additions & 4 deletions tests/Assets/Middleware/BindableEntity.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
<?php

declare(strict_types=1);

namespace LaravelDoctrineTest\ORM\Assets\Middleware;

use function strtolower;

class BindableEntity
{
public $id;
public int $id;

public $name;
public string $name;

public function getId()
public function getId(): int
{
return $this->id;
}

public function getName()
public function getName(): string
{
return strtolower($this->name);
}
Expand Down
12 changes: 8 additions & 4 deletions tests/Assets/Middleware/BindableEntityWithInterface.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
<?php

declare(strict_types=1);

namespace LaravelDoctrineTest\ORM\Assets\Middleware;

use LaravelDoctrine\ORM\Contracts\UrlRoutable;

use function strtolower;

class BindableEntityWithInterface implements UrlRoutable
{
public $id;
public int $id;

public $name;
public string $name;

public function getId()
public function getId(): int
{
return $this->id;
}

public function getName()
public function getName(): string
{
return strtolower($this->name);
}
Expand Down
Loading

0 comments on commit a62a443

Please sign in to comment.