namespace Psy\CodeCleaner;
use PhpParser\Node;
-use PhpParser\Node\Expr\FuncCall as FunctionCall;
+use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\StaticCall;
use Psy\Exception\FatalErrorException;
*/
class CallTimePassByReferencePass extends CodeCleanerPass
{
+ const EXCEPTION_MESSAGE = 'Call-time pass-by-reference has been removed';
+
/**
* Validate of use call-time pass-by-reference.
*
return;
}
- if (!$node instanceof FunctionCall && !$node instanceof MethodCall && !$node instanceof StaticCall) {
+ if (!$node instanceof FuncCall && !$node instanceof MethodCall && !$node instanceof StaticCall) {
return;
}
foreach ($node->args as $arg) {
if ($arg->byRef) {
- throw new FatalErrorException('Call-time pass-by-reference has been removed');
+ throw new FatalErrorException(self::EXCEPTION_MESSAGE, 0, E_ERROR, null, $node->getLine());
}
}
}