Skip to content

Commit d7efb79

Browse files
committed
Bump the requirements to PHP 8.1
1 parent 8264aad commit d7efb79

File tree

506 files changed

+1592
-3785
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

506 files changed

+1592
-3785
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ jobs:
2424
fail-fast: false
2525
matrix:
2626
php-version:
27-
- "7.4"
28-
- "8.0"
2927
- "8.1"
3028
- "8.2"
3129
- "8.3"
@@ -38,20 +36,20 @@ jobs:
3836
- ""
3937
include:
4038
- deps: "lowest"
41-
php-version: "7.4"
39+
php-version: "8.1"
4240
- deps: "highest"
4341
php-version: "8.4"
4442
# Run builds on low and high PHP versions with `doctrine/annotations` removed
4543
- deps: "highest"
46-
php-version: "7.4"
44+
php-version: "8.1"
4745
no-annotations: true
4846
- deps: "highest"
4947
php-version: "8.4"
5048
no-annotations: true
5149
# Run builds on high PHP version with `doctrine/orm` version pinned
5250
- deps: "highest"
5351
php-version: "8.4"
54-
orm: "^2.14"
52+
orm: "^2.20"
5553
- deps: "highest"
5654
php-version: "8.4"
5755
orm: "^3.0"
@@ -109,7 +107,7 @@ jobs:
109107
- name: "Install PHP"
110108
uses: "shivammathur/setup-php@v2"
111109
with:
112-
php-version: "8.2"
110+
php-version: "8.4"
113111
extensions: mongodb
114112

115113
- name: "Install dependencies with Composer"

.php-cs-fixer.dist.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
3232
->setRules([
3333
'@DoctrineAnnotation' => true,
34-
'@PHP74Migration' => true,
35-
'@PHP74Migration:risky' => true,
34+
'@PHP81Migration' => true,
35+
'@PHP80Migration:risky' => true,
3636
'@PHPUnit91Migration:risky' => true,
3737
'@PSR2' => true,
3838
'@Symfony' => true,
@@ -78,6 +78,7 @@
7878
'random_api_migration' => true,
7979
'return_assignment' => true,
8080
'self_accessor' => true,
81+
'single_line_empty_body' => true,
8182
'static_lambda' => true,
8283
'strict_param' => true,
8384
'ternary_to_null_coalescing' => true,

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ a release.
2121
### Added
2222
- IP address provider for use with extensions with IP address references (#2928)
2323

24+
### Changed
25+
- Dropped support for PHP < 8.1
26+
2427
## [3.19.0] - 2025-02-24
2528
### Added
2629
- Actor provider for use with extensions with user references (#2914)

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
"wiki": "https://github.com/Atlantic18/DoctrineExtensions/tree/main/doc"
4141
},
4242
"require": {
43-
"php": "^7.4 || ^8.0",
44-
"behat/transliterator": "^1.2",
43+
"php": "^8.1",
44+
"behat/transliterator": "^1.3",
4545
"doctrine/collections": "^1.2 || ^2.0",
4646
"doctrine/deprecations": "^1.0",
4747
"doctrine/event-manager": "^1.2 || ^2.0",

example/app/Command/PrintCategoryTranslationTreeCommand.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@
1818
use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper;
1919
use Gedmo\Translatable\Query\TreeWalker\TranslationWalker;
2020
use Gedmo\Translatable\TranslatableListener;
21+
use Symfony\Component\Console\Attribute\AsCommand;
2122
use Symfony\Component\Console\Command\Command;
2223
use Symfony\Component\Console\Input\InputInterface;
2324
use Symfony\Component\Console\Output\OutputInterface;
2425

26+
#[AsCommand(name: 'app:print-category-translation-tree', description: 'Seeds an example category tree with translations and prints the tree.')]
2527
final class PrintCategoryTranslationTreeCommand extends Command
2628
{
27-
protected static $defaultName = 'app:print-category-translation-tree';
28-
protected static $defaultDescription = 'Seeds an example category tree with translations and prints the tree.';
29-
3029
protected function execute(InputInterface $input, OutputInterface $output): int
3130
{
3231
/** @var EntityManagerHelper $helper */

example/app/Entity/Category.php

Lines changed: 47 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use App\Entity\Repository\CategoryRepository;
1515
use Doctrine\Common\Collections\ArrayCollection;
16+
use Doctrine\Common\Collections\Collection;
1617
use Doctrine\DBAL\Types\Types;
1718
use Doctrine\ORM\Mapping as ORM;
1819
use Gedmo\Mapping\Annotation as Gedmo;
@@ -29,7 +30,7 @@
2930
#[ORM\Table(name: 'ext_categories')]
3031
#[ORM\Entity(repositoryClass: CategoryRepository::class)]
3132
#[Gedmo\TranslationEntity(class: CategoryTranslation::class)]
32-
class Category
33+
class Category implements \Stringable
3334
{
3435
/**
3536
* @ORM\Column(type="integer")
@@ -39,33 +40,27 @@ class Category
3940
#[ORM\Column(type: Types::INTEGER)]
4041
#[ORM\Id]
4142
#[ORM\GeneratedValue]
42-
private $id;
43+
private ?int $id = null;
4344

4445
/**
45-
* @var string|null
46-
*
4746
* @Gedmo\Translatable
4847
*
4948
* @ORM\Column(length=64)
5049
*/
5150
#[Gedmo\Translatable]
5251
#[ORM\Column(length: 64)]
53-
private $title;
52+
private ?string $title = null;
5453

5554
/**
56-
* @var string|null
57-
*
5855
* @Gedmo\Translatable
5956
*
6057
* @ORM\Column(type="text", nullable=true)
6158
*/
6259
#[Gedmo\Translatable]
6360
#[ORM\Column(type: Types::TEXT, nullable: true)]
64-
private $description;
61+
private ?string $description = null;
6562

6663
/**
67-
* @var string|null
68-
*
6964
* @Gedmo\Translatable
7065
* @Gedmo\Slug(fields={"created", "title"})
7166
*
@@ -74,7 +69,7 @@ class Category
7469
#[Gedmo\Translatable]
7570
#[Gedmo\Slug(fields: ['created', 'title'])]
7671
#[ORM\Column(length: 64, unique: true)]
77-
private $slug;
72+
private ?string $slug = null;
7873

7974
/**
8075
* @Gedmo\TreeLeft
@@ -83,7 +78,7 @@ class Category
8378
*/
8479
#[Gedmo\TreeLeft]
8580
#[ORM\Column(type: Types::INTEGER)]
86-
private $lft;
81+
private ?int $lft = null;
8782

8883
/**
8984
* @Gedmo\TreeRight
@@ -92,7 +87,7 @@ class Category
9287
*/
9388
#[Gedmo\TreeRight]
9489
#[ORM\Column(type: Types::INTEGER)]
95-
private $rgt;
90+
private ?int $rgt = null;
9691

9792
/**
9893
* @Gedmo\TreeParent
@@ -103,7 +98,7 @@ class Category
10398
#[Gedmo\TreeParent]
10499
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'children')]
105100
#[ORM\JoinColumn(name: 'parent_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
106-
private $parent;
101+
private ?self $parent = null;
107102

108103
/**
109104
* @Gedmo\TreeRoot
@@ -112,7 +107,7 @@ class Category
112107
*/
113108
#[Gedmo\TreeRoot]
114109
#[ORM\Column(type: Types::INTEGER, nullable: true)]
115-
private $root;
110+
private ?int $root = null;
116111

117112
/**
118113
* @Gedmo\TreeLevel
@@ -121,9 +116,11 @@ class Category
121116
*/
122117
#[Gedmo\TreeLevel]
123118
#[ORM\Column(name: 'lvl', type: Types::INTEGER)]
124-
private $level;
119+
private ?int $level = null;
125120

126121
/**
122+
* @var Collection<array-key, self>
123+
*
127124
* @ORM\OneToMany(targetEntity="Category", mappedBy="parent")
128125
*/
129126
#[ORM\OneToMany(targetEntity: self::class, mappedBy: 'parent')]
@@ -136,7 +133,7 @@ class Category
136133
*/
137134
#[Gedmo\Timestampable(on: 'create')]
138135
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
139-
private $created;
136+
private ?\DateTime $created = null;
140137

141138
/**
142139
* @Gedmo\Timestampable(on="update")
@@ -145,7 +142,7 @@ class Category
145142
*/
146143
#[Gedmo\Timestampable(on: 'update')]
147144
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
148-
private $updated;
145+
private ?\DateTime $updated = null;
149146

150147
/**
151148
* @Gedmo\Blameable(on="create")
@@ -154,7 +151,7 @@ class Category
154151
*/
155152
#[Gedmo\Blameable(on: 'create')]
156153
#[ORM\Column(type: Types::STRING)]
157-
private $createdBy;
154+
private ?string $createdBy = null;
158155

159156
/**
160157
* @Gedmo\Blameable(on="update")
@@ -163,123 +160,131 @@ class Category
163160
*/
164161
#[Gedmo\Blameable(on: 'update')]
165162
#[ORM\Column(type: Types::STRING)]
166-
private $updatedBy;
163+
private ?string $updatedBy = null;
167164

168165
/**
166+
* @var Collection<array-key, CategoryTranslation>
167+
*
169168
* @ORM\OneToMany(
170169
* targetEntity="CategoryTranslation",
171170
* mappedBy="object",
172171
* cascade={"persist", "remove"}
173172
* )
174173
*/
175174
#[ORM\OneToMany(targetEntity: CategoryTranslation::class, mappedBy: 'object', cascade: ['persist', 'remove'])]
176-
private $translations;
175+
private Collection $translations;
177176

178177
public function __construct()
179178
{
180179
$this->children = new ArrayCollection();
181180
$this->translations = new ArrayCollection();
182181
}
183182

184-
public function __toString()
183+
public function __toString(): string
185184
{
186-
return $this->getTitle();
185+
return (string) $this->getTitle();
187186
}
188187

189-
public function getTranslations()
188+
/**
189+
* @return Collection<CategoryTranslation>
190+
*/
191+
public function getTranslations(): Collection
190192
{
191193
return $this->translations;
192194
}
193195

194-
public function addTranslation(CategoryTranslation $t)
196+
public function addTranslation(CategoryTranslation $t): void
195197
{
196198
if (!$this->translations->contains($t)) {
197199
$this->translations[] = $t;
198200
$t->setObject($this);
199201
}
200202
}
201203

202-
public function getSlug()
204+
public function getSlug(): ?string
203205
{
204206
return $this->slug;
205207
}
206208

207-
public function getId()
209+
public function getId(): ?int
208210
{
209211
return $this->id;
210212
}
211213

212-
public function setTitle($title)
214+
public function setTitle(?string $title): void
213215
{
214216
$this->title = $title;
215217
}
216218

217-
public function getTitle()
219+
public function getTitle(): ?string
218220
{
219221
return $this->title;
220222
}
221223

222-
public function setDescription($description)
224+
public function setDescription(?string $description): void
223225
{
224226
$this->description = $description;
225227
}
226228

227-
public function getDescription()
229+
public function getDescription(): ?string
228230
{
229231
return $this->description;
230232
}
231233

232-
public function setParent($parent)
234+
public function setParent(?self $parent): void
233235
{
234236
$this->parent = $parent;
235237
}
236238

237-
public function getParent()
239+
public function getParent(): ?self
238240
{
239241
return $this->parent;
240242
}
241243

242-
public function getRoot()
244+
public function getRoot(): ?int
243245
{
244246
return $this->root;
245247
}
246248

247-
public function getLevel()
249+
public function getLevel(): ?int
248250
{
249251
return $this->level;
250252
}
251253

252-
public function getChildren()
254+
/**
255+
* @return Collection<self>
256+
*/
257+
public function getChildren(): Collection
253258
{
254259
return $this->children;
255260
}
256261

257-
public function getLeft()
262+
public function getLeft(): ?int
258263
{
259264
return $this->lft;
260265
}
261266

262-
public function getRight()
267+
public function getRight(): ?int
263268
{
264269
return $this->rgt;
265270
}
266271

267-
public function getCreated()
272+
public function getCreated(): ?\DateTime
268273
{
269274
return $this->created;
270275
}
271276

272-
public function getUpdated()
277+
public function getUpdated(): ?\DateTime
273278
{
274279
return $this->updated;
275280
}
276281

277-
public function getCreatedBy()
282+
public function getCreatedBy(): ?string
278283
{
279284
return $this->createdBy;
280285
}
281286

282-
public function getUpdatedBy()
287+
public function getUpdatedBy(): ?string
283288
{
284289
return $this->updatedBy;
285290
}

0 commit comments

Comments
 (0)