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