Skip to content

NullableReturnStatement

A nullable value is returned from a function with a non-nullable return type.

<?php
function getName(): string {
return null; // null is not a string
}

Change the return type to ?string or ensure a non-null value is always returned.