Skip to content

Commit 16f48b1

Browse files
committed
Remove PHP 7.* support
1 parent b9901e2 commit 16f48b1

File tree

12 files changed

+80
-136
lines changed

12 files changed

+80
-136
lines changed

.github/workflows/tests.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,9 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
include:
16-
- php-version: '7.2'
16+
- php-version: '8.1'
1717
composer-flags: '--prefer-stable --prefer-lowest'
1818
description: 'with lowest'
19-
- php-version: '7.2'
20-
- php-version: '7.4'
21-
- php-version: '8.0'
2219
- php-version: '8.1'
2320
- php-version: '8.2'
2421

@@ -28,7 +25,7 @@ jobs:
2825
coding-standards: true
2926

3027
#Static Analysis (min PHP version)
31-
- php-version: '7.2'
28+
- php-version: '8.1'
3229
description: 'with Static Analysis'
3330
static-analysis: true
3431

@@ -65,6 +62,14 @@ jobs:
6562
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}-${{ matrix.composer-flags }}
6663
restore-keys: composer-${{ runner.os }}-${{ matrix.php-version }}-
6764

65+
- name: Remove friendsofphp/php-cs-fixer
66+
if: matrix.coding-standards != true
67+
run: composer remove friendsofphp/php-cs-fixer --dev --no-update
68+
69+
- name: Remove vimeo/psalm
70+
if: matrix.static-analysis != true
71+
run: composer remove vimeo/psalm --dev --no-update
72+
6873
- name: Install dependencies
6974
run: composer update --no-interaction --no-progress ${{ matrix.composer-flags }}
7075

.php-cs-fixer.dist.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
'@Symfony' => true,
2020
'@Symfony:risky' => true,
2121
'@DoctrineAnnotation' => true,
22-
'@PHP71Migration' => true,
23-
'@PHP71Migration:risky' => true,
24-
'@PHPUnit84Migration:risky' => true,
22+
'@PHP81Migration' => true,
23+
'@PHP80Migration:risky' => true,
24+
'@PHPUnit100Migration:risky' => true,
2525
'array_syntax' => ['syntax' => 'short'],
2626
'fopen_flags' => true,
2727
'header_comment' => ['header' => $fileHeaderComment, 'separate' => 'both'],

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@
1717
"psr-4": { "Ecommit\\DoctrineOrmRefetch\\Tests\\": "tests/" }
1818
},
1919
"require": {
20-
"php": "^7.2|^8.0",
20+
"php": "^8.1",
2121
"doctrine/collections": "^1.5|^2.0",
2222
"doctrine/common": "^2.11|^3.0",
23-
"doctrine/orm": "^2.7"
23+
"doctrine/orm": "^2.13"
2424
},
2525
"require-dev": {
2626
"doctrine/cache": "^1.11|^2.0",
2727
"doctrine/data-fixtures": "^1.4.1",
2828
"fakerphp/faker": "^1.9",
2929
"friendsofphp/php-cs-fixer": "^3.0",
30-
"phpunit/phpunit": "^8.4",
30+
"phpunit/phpunit": "^10.0",
3131
"symfony/cache": "*",
32-
"vimeo/psalm": "^4.23"
32+
"vimeo/psalm": "^5"
3333
},
3434
"extra": {
3535
"branch-alias": {

src/RefetchManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function getEntityManager(): EntityManagerInterface
6969

7070
protected function getObjectMetadata(object $object): ClassMetadata
7171
{
72-
return $this->entityManager->getClassMetadata(\get_class($object));
72+
return $this->entityManager->getClassMetadata($object::class);
7373
}
7474

7575
protected function getIdentifierFlattener(): IdentifierFlattener
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Ecommit\DoctrineOrmRefetch\Tests\App\Doctrine;
1818
use PHPUnit\Framework\TestCase;
1919

20-
abstract class AbstractTest extends TestCase
20+
abstract class AbstractTestCase extends TestCase
2121
{
2222
protected function countObjectsInUnitOfWork(): int
2323
{

tests/App/Doctrine.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
1717
use Doctrine\Common\DataFixtures\Loader;
1818
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
19+
use Doctrine\DBAL\DriverManager;
1920
use Doctrine\ORM\EntityManager;
2021
use Doctrine\ORM\EntityManagerInterface;
22+
use Doctrine\ORM\ORMSetup;
2123
use Doctrine\ORM\Tools\SchemaTool;
22-
use Doctrine\ORM\Tools\Setup;
2324

2425
class Doctrine
2526
{
@@ -34,14 +35,15 @@ public static function getEntityManager(): EntityManagerInterface
3435
return static::$entityManager;
3536
}
3637

37-
$config = Setup::createAnnotationMetadataConfiguration([__DIR__.'/Entity'], true, null, null, false);
38-
static::$entityManager = EntityManager::create(
38+
$config = ORMSetup::createAttributeMetadataConfiguration([__DIR__.'/Entity'], true);
39+
$connection = DriverManager::getConnection(
3940
[
4041
'driver' => 'pdo_sqlite',
4142
'memory' => true,
4243
],
4344
$config
4445
);
46+
static::$entityManager = new EntityManager($connection, $config);
4547

4648
return static::$entityManager;
4749
}

tests/App/Entity/Author.php

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,21 @@
1717
use Doctrine\Common\Collections\Collection;
1818
use Doctrine\ORM\Mapping as ORM;
1919

20-
/**
21-
* @ORM\Entity
22-
* @ORM\Table(name="author")
23-
*/
20+
#[ORM\Entity]
21+
#[ORM\Table(name: 'author')]
2422
class Author
2523
{
26-
/**
27-
* @ORM\Id
28-
* @ORM\Column(type="integer", name="author_id")
29-
*/
24+
#[ORM\Id]
25+
#[ORM\Column(type: 'integer', name: 'author_id')]
3026
protected $authorId;
3127

32-
/**
33-
* @ORM\Column(type="string", length=255)
34-
*/
28+
#[ORM\Column(type: 'string', length: 255)]
3529
protected $firstName;
3630

37-
/**
38-
* @ORM\Column(type="string", length=255)
39-
*/
31+
#[ORM\Column(type: 'string', length: 255)]
4032
protected $lastName;
4133

42-
/**
43-
* @ORM\ManyToMany(targetEntity="Ecommit\DoctrineOrmRefetch\Tests\App\Entity\Book", mappedBy="authors")
44-
*/
34+
#[ORM\ManyToMany(targetEntity: Book::class, mappedBy: 'authors')]
4535
protected $books;
4636

4737
public function __construct()

tests/App/Entity/Book.php

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,41 +17,27 @@
1717
use Doctrine\Common\Collections\Collection;
1818
use Doctrine\ORM\Mapping as ORM;
1919

20-
/**
21-
* @ORM\Entity
22-
* @ORM\Table(name="book")
23-
*/
20+
#[ORM\Entity]
21+
#[ORM\Table(name: 'book')]
2422
class Book
2523
{
26-
/**
27-
* @ORM\Id
28-
* @ORM\Column(type="integer", name="book_id")
29-
*/
24+
#[ORM\Id]
25+
#[ORM\Column(type: 'integer', name: 'book_id')]
3026
protected $bookId;
3127

32-
/**
33-
* @ORM\Column(type="string", length=255)
34-
*/
28+
#[ORM\Column(type: 'string', length: 255)]
3529
protected $title;
3630

37-
/**
38-
* @ORM\ManyToOne(targetEntity="Ecommit\DoctrineOrmRefetch\Tests\App\Entity\Category", inversedBy="books")
39-
* @ORM\JoinColumn(name="category_id", referencedColumnName="category_id", nullable=false)
40-
*/
31+
#[ORM\ManyToOne(targetEntity: Category::class, inversedBy: 'books')]
32+
#[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'category_id', nullable: false)]
4133
protected $category;
4234

43-
/**
44-
* @ORM\ManyToMany(targetEntity="Ecommit\DoctrineOrmRefetch\Tests\App\Entity\Author", inversedBy="books")
45-
* @ORM\JoinTable(name="book_author",
46-
* joinColumns={@ORM\JoinColumn(name="book_id", referencedColumnName="book_id")},
47-
* inverseJoinColumns={@ORM\JoinColumn(name="author_id", referencedColumnName="author_id")}
48-
* )
49-
*/
35+
#[ORM\ManyToMany(targetEntity: Author::class, inversedBy: 'books')]
36+
#[ORM\JoinColumn(name: 'book_id', referencedColumnName: 'book_id')]
37+
#[ORM\InverseJoinColumn(name: 'author_id', referencedColumnName: 'author_id')]
5038
protected $authors;
5139

52-
/**
53-
* @ORM\OneToMany(targetEntity="Ecommit\DoctrineOrmRefetch\Tests\App\Entity\Sale", mappedBy="book")
54-
*/
40+
#[ORM\OneToMany(targetEntity: Sale::class, mappedBy: 'book')]
5541
protected $sales;
5642

5743
public function __construct()

tests/App/Entity/Category.php

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,18 @@
1717
use Doctrine\Common\Collections\Collection;
1818
use Doctrine\ORM\Mapping as ORM;
1919

20-
/**
21-
* @ORM\Entity
22-
* @ORM\Table(name="category")
23-
*/
20+
#[ORM\Entity]
21+
#[ORM\Table(name: 'category')]
2422
class Category
2523
{
26-
/**
27-
* @ORM\Id
28-
* @ORM\Column(type="integer", name="category_id")
29-
*/
24+
#[ORM\Id]
25+
#[ORM\Column(type: 'integer', name: 'category_id')]
3026
protected $categoryId;
3127

32-
/**
33-
* @ORM\Column(type="string", length=255)
34-
*/
28+
#[ORM\Column(type: 'string', length: 255)]
3529
protected $name;
3630

37-
/**
38-
* @ORM\OneToMany(targetEntity="Ecommit\DoctrineOrmRefetch\Tests\App\Entity\Book", mappedBy="category")
39-
*/
31+
#[ORM\OneToMany(targetEntity: Book::class, mappedBy: 'category')]
4032
protected $books;
4133

4234
public function __construct()

tests/App/Entity/Sale.php

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,20 @@
1515

1616
use Doctrine\ORM\Mapping as ORM;
1717

18-
/**
19-
* @ORM\Entity
20-
* @ORM\Table(name="sale")
21-
*/
18+
#[ORM\Entity]
19+
#[ORM\Table(name: 'sale')]
2220
class Sale
2321
{
24-
/**
25-
* @ORM\Id
26-
* @ORM\ManyToOne(targetEntity="Ecommit\DoctrineOrmRefetch\Tests\App\Entity\Book", inversedBy="sales")
27-
* @ORM\JoinColumn(name="book_id", referencedColumnName="book_id", nullable=false)
28-
*/
22+
#[ORM\Id]
23+
#[ORM\ManyToOne(targetEntity: Book::class, inversedBy: 'sales')]
24+
#[ORM\JoinColumn(name: 'book_id', referencedColumnName: 'book_id', nullable: false)]
2925
protected $book;
3026

31-
/**
32-
* @ORM\Id
33-
* @ORM\Column(type="smallint")
34-
*/
27+
#[ORM\Id]
28+
#[ORM\Column(type: 'smallint')]
3529
protected $year;
3630

37-
/**
38-
* @ORM\Column(type="integer")
39-
*/
31+
#[ORM\Column(type: 'integer')]
4032
protected $countSales;
4133

4234
public function setBook(Book $book = null): self

0 commit comments

Comments
 (0)