generated from spawnia/php-package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
38 additions
and
40 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
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 |
---|---|---|
|
@@ -30,10 +30,7 @@ abstract protected function converters(): array; | |
*/ | ||
public static function fromStdClass(stdClass $data): self | ||
{ | ||
static $instance; | ||
$instance ??= new static(); | ||
|
||
return $instance->fromGraphQL($data); | ||
return (new static())->fromGraphQL($data); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
spawnia
Author
Owner
|
||
} | ||
|
||
/** | ||
|
@@ -87,7 +84,10 @@ public function toGraphQL($value): stdClass | |
return $serializable; | ||
} | ||
|
||
public function fromGraphQL($value) | ||
/** | ||
* @return static | ||
*/ | ||
public function fromGraphQL($value): self | ||
{ | ||
if (! $value instanceof stdClass) { | ||
throw new InvalidArgumentException('Expected stdClass, got: ' . gettype($value)); | ||
|
I just stumbled upon this. Why did it stop working? Can you explain pls?