Skip to content

Commit c4d5a46

Browse files
authored
Ensure static variables are initialized (#10)
1 parent caae97c commit c4d5a46

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

src/Entity/Pair.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public static function create(mixed $first, mixed $second): Pair
7979
*/
8080
public static function empty(): Pair
8181
{
82-
static $pair;
82+
static $pair = null;
8383
$pair ??= new Pair(null, null);
8484

8585
return $pair;

src/Entity/Side.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ public function select(mixed $left, mixed $right): mixed
6969

7070
private static function left(): Side
7171
{
72-
static $left;
72+
static $left = null;
7373

7474
return $left ??= new Side(self::LEFT);
7575
}
7676

7777
private static function right(): Side
7878
{
79-
static $right;
79+
static $right = null;
8080

8181
return $right ??= new Side(self::RIGHT);
8282
}

src/Util/Character.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,14 @@ public static function isContinuousScript(int $codePoint): bool
6767
return false;
6868
}
6969

70-
static $table;
70+
static $table = null;
7171
$table ??= require dirname(__DIR__, 2) . '/resources/NonContinuousScriptLookupTable.php';
7272

7373
return $table[$codePoint] ?? true;
7474
}
7575

7676
public static function isWhiteSpace(string $char): bool
7777
{
78-
// TODO optimize function call. Replace calls with const
7978
return self::IS_WHITESPACE[$char] ?? false;
8079
}
8180

0 commit comments

Comments
 (0)