Skip to content

InvalidPassByReference

A by-reference parameter receives an expression that cannot be referenced.

<?php
function increment(int &$val): void { $val++; }
increment(42); // literal cannot be passed by reference

Pass a variable instead of a literal or expression.