twinfield
twinfield copied to clipboard
Initialize certain fields of CustomerBank
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.
Your mentioned solutions with a nullable bool is included in PR #142