yii2-materializecss
yii2-materializecss copied to clipboard
PHP 8 compatibility issue
Unparenthesized a ? b : c ? d : e is not supported in PHP 8. Use either (a ? b : c) ? d : e or a ? b : (c ? d : e) in https://github.com/MacGyer/yii2-materializecss/blob/3fb85450e72ad0458c60e7f46a9a8e42989e90af/src/widgets/form/SwitchButton.php#L155
It should be $this->inputOptions['uncheck'] = isset($this->uncheck) ? $this->uncheck : (is_null($this->uncheck) ? null : '0'); Kindly update. Thanks!
Hey @mpasang,
thanks for reporting the issue.
I think, the whole expression is somewhat over the top.
As its purpose is to use either the value of $this->uncheck or set it to '0' I would prefer to write it as follows:
$this->inputOptions['uncheck'] = isset($this->uncheck) ? $this->uncheck : '0'
Would you mind testing this solution? Thanks
I agree @MacGyer . That definitely works and is much more accepted. I just added the parentheses in the existing line to get over with the unsupported PHP 8 case.
Thanks for getting back to me. When will the fix be available then for release?
fixed in https://github.com/MacGyer/yii2-materializecss/releases/tag/4.0.0-RC1