Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/Application/Actions/ActionError has wrong type $description #289

Closed
Dmitrev opened this issue Jul 8, 2022 · 2 comments
Closed

src/Application/Actions/ActionError has wrong type $description #289

Dmitrev opened this issue Jul 8, 2022 · 2 comments

Comments

@Dmitrev
Copy link
Contributor

Dmitrev commented Jul 8, 2022

// 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

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

However 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.

@Dmitrev Dmitrev changed the title src/Application/ActionsActionError has wrong type $description src/Application/Actions/ActionError has wrong type $description Jul 8, 2022
@nbayramberdiyev
Copy link
Contributor

Hey, thanks for raising this issue. Feel free to open a PR.

@Dmitrev
Copy link
Contributor Author

Dmitrev commented Aug 2, 2022

Fixed in #290

@Dmitrev Dmitrev closed this as completed Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants