Cannot use isset() on the result of an expression (you can use "null !== expression" instead)
生PHPやLaravelでこのエラーが出たら...
PHPのisset()の引数、変数のみだそうです。
Laravelのコントローラの場合、以下の様な記述はエラーが出ます。
# bad
// ふつうのif文 if (isset(request('public'))) { $public = (bool)true; }else{ $public = (bool)false; } // 3項演算子 $cue->memo = isset(request('memo')) ? request('memo') : '';
# good
// isset() は、引数定数不可なので... $p = request('public'); $m = request('memo'); // ふつうのif文 if (isset($p)) { $public = (bool)true; }else{ $public = (bool)false; } // 3項演算子 $cue->memo = isset($m) ? request('memo') : '';
定数を変数に格納する。
ちょっとしたクッションを挟むだけで、問題なく動きます。
cf.
PHP: isset - Manual
PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.
コメント