Skip to content

Commit

Permalink
Make test compatible with PHP 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
W0rma committed Apr 29, 2024
1 parent c363f55 commit d0e5966
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions tests/Tests/ORM/Functional/Ticket/GH6123Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\UnitOfWork;
use Doctrine\Tests\OrmFunctionalTestCase;

Expand All @@ -17,7 +16,7 @@ protected function setUp(): void
parent::setUp();

$this->createSchemaForModels(
GH6123Entity::class,
GH6123Entity::class
);
}

Expand Down Expand Up @@ -58,7 +57,10 @@ public function testRemovedEntityCanBePersistedAgain(): void
$this->_em->flush();
}

private function loadEntityFromDatabase(int $id): GH6123Entity|null
/**
* @return GH6123Entity|null
*/
private function loadEntityFromDatabase(int $id)

Check failure on line 63 in tests/Tests/ORM/Functional/Ticket/GH6123Test.php

View workflow job for this annotation

GitHub Actions / coding-standards / Coding Standards (8.2)

Method \Doctrine\Tests\ORM\Functional\Ticket\GH6123Test::loadEntityFromDatabase() does not have native return type hint for its return value but it should be possible to add it based on @return annotation "GH6123Entity|null".
{
return $this->_em->createQueryBuilder()
->select('e')
Expand All @@ -70,11 +72,20 @@ private function loadEntityFromDatabase(int $id): GH6123Entity|null
}
}

/**
* @ORM\Entity
*/
#[ORM\Entity]
class GH6123Entity
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @var int
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[Column(type: Types::INTEGER, nullable: false)]
public int $id;
#[ORM\Column(type: Types::INTEGER)]
public $id;
}

0 comments on commit d0e5966

Please sign in to comment.