Skip to content

NullMethodCall

A method is called on a value that is possibly null.

<?php
function find(): ?Item { return null; }
find()->process(); // may be null

Guard with a null check or use the null-safe operator ?->.

<?php
find()?->process();