Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Return of parent::__set_state() method is only object
- Loading branch information
Showing
3 changed files
with
55 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
class A | ||
{ | ||
final public function __construct() { } | ||
|
||
/** | ||
* @param array<string, mixed> $data | ||
*/ | ||
public static function __set_state(array $data): static | ||
{ | ||
$obj = new static(); | ||
|
||
return $obj; | ||
} | ||
} | ||
|
||
class B extends A | ||
{ | ||
public static function __set_state(array $data): static | ||
{ | ||
$obj = parent::__set_state($data); | ||
|
||
return $obj; | ||
} | ||
} |