Chris@0: Chris@0: */ Chris@0: class CallTimePassByReferencePass extends CodeCleanerPass Chris@0: { Chris@0: const EXCEPTION_MESSAGE = 'Call-time pass-by-reference has been removed'; Chris@0: Chris@0: /** Chris@0: * Validate of use call-time pass-by-reference. Chris@0: * Chris@0: * @throws RuntimeException if the user used call-time pass-by-reference Chris@0: * Chris@0: * @param Node $node Chris@0: */ Chris@0: public function enterNode(Node $node) Chris@0: { Chris@0: if (!$node instanceof FuncCall && !$node instanceof MethodCall && !$node instanceof StaticCall) { Chris@0: return; Chris@0: } Chris@0: Chris@0: foreach ($node->args as $arg) { Chris@0: if ($arg->byRef) { Chris@0: throw new FatalErrorException(self::EXCEPTION_MESSAGE, 0, E_ERROR, null, $node->getLine()); Chris@0: } Chris@0: } Chris@0: } Chris@0: }