Skip to content

Commit

Permalink
Squiz/ScopeKeywordSpacing: add extra tests with static in a union type
Browse files Browse the repository at this point in the history
This is already handled correctly, the tests just safeguards this.
  • Loading branch information
jrfnl committed Dec 15, 2023
1 parent 393f231 commit 1a046ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ public static function fCreate($attributes = []): ?static
}

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

// Ensure that static as a scope keyword when preceeded by a colon which is not for a type declaration is still handled.
$callback = $cond ? get_fn_name() : static function ($a) { return $a * 10; };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ public static function fCreate($attributes = []): ?static
}

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

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

0 comments on commit 1a046ac

Please sign in to comment.