Skip to content

Commit 1a046ac

Browse files
committed
Squiz/ScopeKeywordSpacing: add extra tests with static in a union type
This is already handled correctly, the tests just safeguards this.
1 parent 393f231 commit 1a046ac

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.1.inc

+3-3
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ public static function fCreate($attributes = []): ?static
9595
}
9696

9797
// Also account for static used within union types.
98-
public function fCreate($attributes = []): object|static
99-
{
100-
}
98+
public function staticLast($attributes = []): object|static {}
99+
public function staticMiddle(): string|static|object {}
100+
public function staticFirst(): static|object {}
101101

102102
// Ensure that static as a scope keyword when preceeded by a colon which is not for a type declaration is still handled.
103103
$callback = $cond ? get_fn_name() : static function ($a) { return $a * 10; };

src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.1.inc.fixed

+3-3
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ public static function fCreate($attributes = []): ?static
9090
}
9191

9292
// Also account for static used within union types.
93-
public function fCreate($attributes = []): object|static
94-
{
95-
}
93+
public function staticLast($attributes = []): object|static {}
94+
public function staticMiddle(): string|static|object {}
95+
public function staticFirst(): static|object {}
9696

9797
// Ensure that static as a scope keyword when preceeded by a colon which is not for a type declaration is still handled.
9898
$callback = $cond ? get_fn_name() : static function ($a) { return $a * 10; };

0 commit comments

Comments
 (0)