Skip to content

Commit ab8a8ad

Browse files
committed
Fix: initialize nullable typed properties to prevent PHP 8.1+ errors
Initializes all nullable typed properties in PhpRelDoc with default null values. This prevents "must not be accessed before initialization" fatal errors when properties are checked (e.g., `$this->primary !== null`) before being set. Fixes #37
1 parent 0d0ee73 commit ab8a8ad

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Entity/PhpRelDoc.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ class PhpRelDoc
1212
public const ASC = 1;
1313
public const DESC = 2;
1414

15-
private ?string $type;
15+
private ?string $type = null;
1616

17-
private ?string $entity;
17+
private ?string $entity = null;
1818

19-
private ?string $variable;
19+
private ?string $variable = null;
2020

21-
private ?bool $primary;
21+
private ?bool $primary = null;
2222

23-
private ?string $orderProperty;
23+
private ?string $orderProperty = null;
2424

25-
private ?int $orderDirection;
25+
private ?int $orderDirection = null;
2626

2727
public function getType(): string
2828
{

0 commit comments

Comments
 (0)