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

Initialize certain fields of CustomerBank #132

Open
fuegas opened this issue Apr 1, 2019 · 1 comment
Open

Initialize certain fields of CustomerBank #132

fuegas opened this issue Apr 1, 2019 · 1 comment

Comments

@fuegas
Copy link
Contributor

fuegas commented Apr 1, 2019

In the current codebase of CustomerBank the getter for default looks like:

    public function getDefault() : bool
    {
        return $this->default;
    }

This requires $this->default to be a boolean. However, the variable is not initialized, so the following (simplified) code results in an error:

$bank = New CustomerBank();
$bank->getDefault();

I know requesting getDefault()on a new object seems strange but it feels off to have invalid values on an object that has just been initialized.

A solution could be to initialize $this->default to false or to allow a null by changing the definition to public function getDefault() : ?bool.

I'm wondering what your opinion is on this.

@iranl
Copy link
Contributor

iranl commented May 29, 2019

Your mentioned solutions with a nullable bool is included in PR #142

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