Closed Dmitrev closed 2 years ago
// src/Application/Actions/ActionError.php class ActionError implements JsonSerializable { private string $description; // <- string public function __construct(string $type, ?string $description) // string|null ? { $this->type = $type; $this->description = $description; } public function getDescription(): string // string { return $this->description; } public function setDescription(?string $description = null): self // string|null ? { $this->description = $description; return $this; } }
This file declares $description as string
$description
string
https://github.com/slimphp/Slim-Skeleton/blob/master/src/Application/Actions/ActionError.php#L23
While all the other methods seem to accept ?string https://github.com/slimphp/Slim-Skeleton/blob/master/src/Application/Actions/ActionError.php#L25 https://github.com/slimphp/Slim-Skeleton/blob/master/src/Application/Actions/ActionError.php#L47
?string
However passing a null to these methods will result in a TypeError
TypeError
Is this a typo or intentional? In my own project I just converted everything to string. Happy to make a PR for that if you agree.
Hey, thanks for raising this issue. Feel free to open a PR.
Fixed in #290
This file declares
$description
asstring
https://github.com/slimphp/Slim-Skeleton/blob/master/src/Application/Actions/ActionError.php#L23
While all the other methods seem to accept
?string
https://github.com/slimphp/Slim-Skeleton/blob/master/src/Application/Actions/ActionError.php#L25 https://github.com/slimphp/Slim-Skeleton/blob/master/src/Application/Actions/ActionError.php#L47However passing a null to these methods will result in a
TypeError
Is this a typo or intentional? In my own project I just converted everything to
string
. Happy to make a PR for that if you agree.