twinfield icon indicating copy to clipboard operation
twinfield copied to clipboard

Initialize certain fields of CustomerBank

Open fuegas opened this issue 6 years ago • 1 comments

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.

fuegas avatar Apr 01 '19 10:04 fuegas

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

iranl avatar May 29 '19 18:05 iranl