diff --git a/phpstan-tests.neon b/phpstan-tests.neon index 84f6be97358bf1bd92fa425e2186e1291513b629..d3e0ee482e93e7a58bc89ff1de54ccd4c5a904d8 100644 --- a/phpstan-tests.neon +++ b/phpstan-tests.neon @@ -1,5 +1,5 @@ parameters: - level: 3 + level: 4 paths: - tests/ symfony: diff --git a/phpstan.neon b/phpstan.neon index 342259847bcd4b69bbdc436efc40a04978c88768..8d5ca2249f38ef110a8fe028806592419faf7c35 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,6 +1,8 @@ parameters: - level: 3 + level: 4 paths: - src/ symfony: - container_xml_path: var/cache/dev/App_KernelDevDebugContainer.xml \ No newline at end of file + container_xml_path: var/cache/dev/App_KernelDevDebugContainer.xml + doctrine: + objectManagerLoader: tests/object-manager.php \ No newline at end of file diff --git a/src/Entity/Capsule.php b/src/Entity/Capsule.php index ccdf90027348c7b5c50ac2e09863b4eeeb07628f..877fee85a55b24d1c08925f3156d1b4699b1952c 100644 --- a/src/Entity/Capsule.php +++ b/src/Entity/Capsule.php @@ -32,7 +32,7 @@ class Capsule /** * - * //@ORM\Column(name="aut_crea", type="string", length=255, nullable=false) + * @ORM\Column(name="aut_crea", type="int", length=255, nullable=false) * * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="capsulesCreated") * @ORM\JoinColumn(name="aut_crea", referencedColumnName="id") @@ -48,7 +48,7 @@ class Capsule /** * - * //@ORM\Column(name="aut_maj", type="string", length=255, nullable=false) + * @ORM\Column(name="aut_maj", type="int", length=255) * * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="capsulesEdited") * @ORM\JoinColumn(name="aut_maj", referencedColumnName="id") diff --git a/src/Entity/ResetPasswordRequest.php b/src/Entity/ResetPasswordRequest.php index 6f7faed678a9fa0bae7f232e59d8ea0aa845b6af..78b901312d2a75b6c8146f5f64ea89bc39eabe30 100644 --- a/src/Entity/ResetPasswordRequest.php +++ b/src/Entity/ResetPasswordRequest.php @@ -19,15 +19,15 @@ class ResetPasswordRequest implements ResetPasswordRequestInterface * @ORM\GeneratedValue * @ORM\Column(type="integer") */ - private $id; + private int $id; /** * @ORM\ManyToOne(targetEntity=User::class) * @ORM\JoinColumn(nullable=false) */ - private $user; + private User $user; - public function __construct(object $user, \DateTimeInterface $expiresAt, string $selector, string $hashedToken) + public function __construct(User $user, \DateTimeInterface $expiresAt, string $selector, string $hashedToken) { $this->user = $user; $this->initialize($expiresAt, $selector, $hashedToken); @@ -38,7 +38,7 @@ class ResetPasswordRequest implements ResetPasswordRequestInterface return $this->id; } - public function getUser(): object + public function getUser(): User { return $this->user; } diff --git a/tests/functional/ProjectControllerTest.php b/tests/functional/ProjectControllerTest.php index cb02496060942c782f0b24778c9007090242a094..d806daed6c485882aa0600a38ed31f7656a4ee8d 100644 --- a/tests/functional/ProjectControllerTest.php +++ b/tests/functional/ProjectControllerTest.php @@ -59,6 +59,7 @@ class ProjectControllerTest extends WebTestCase $this->object_manager->flush(); } + /** @phpstan-ignore-next-line */ private function getDOMDocument(): \DOMDocument { $dom_xml = new \DOMDocument(); @@ -90,7 +91,7 @@ class ProjectControllerTest extends WebTestCase self::assertInstanceOf(Capsule::class, $capsule_in_db); $capsule_name_in_db = $capsule_in_db->getName(); - $dom_xml = self::getDomDocument(); + $dom_xml = $this->getDomDocument(); $video_node = $dom_xml->getElementsByTagName('video')->item(0); $video_url_in_xml_file = $video_node->getAttribute('url'); diff --git a/tests/functional/RegistrationControllerTest.php b/tests/functional/RegistrationControllerTest.php index acba987fcd553dcec4c262c7e9167f7aa08ad43d..39eca6b9cb5fe25fd161daf9640d2d16cd9e167c 100644 --- a/tests/functional/RegistrationControllerTest.php +++ b/tests/functional/RegistrationControllerTest.php @@ -148,7 +148,7 @@ class RegistrationControllerTest extends WebTestCase $this->assertResponseIsSuccessful('/register_mail_sent'); } - private function registerUser(string $userEmail, KernelBrowser &$client): ?Crawler + private function registerUser(string $userEmail, KernelBrowser &$client): Crawler { $crawler = $client->request('GET', '/register'); diff --git a/tests/object-manager.php b/tests/object-manager.php new file mode 100644 index 0000000000000000000000000000000000000000..c15dbe952450a364136f6c0aed5214fbfe2dc1de --- /dev/null +++ b/tests/object-manager.php @@ -0,0 +1,11 @@ +<?php +use App\Kernel; +use Symfony\Component\Dotenv\Dotenv; + +require __DIR__ . '/../vendor/autoload.php'; + +(new Dotenv())->bootEnv(__DIR__ . '/../.env'); + +$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); +$kernel->boot(); +return $kernel->getContainer()->get('doctrine')->getManager();