{ return "type {$argNum}"; } /** * element type of argument #$argNum * @param mixed $argNum * @return mixed */ function elementType($argNum) { return "elementType {$argNum}"; } override(\array_shift(0), elementType(0)); override(\array_reverse(0), elementType(0)); override(\array_pop(0), elementType(0)); // override(\array_map(0), type(1)); override(\array_filter(0), type(0)); override(\array_reduce(0), elementType(0)); override(\current(0), elementType(0)); override(\reset(0), elementType(0)); override(\end(0), elementType(0)); override(\prev(0), elementType(0)); override(\next(0), elementType(0)); override(\iterator_to_array(0), type(0)); // override( \ServiceLocatorInterface::get(0), // map( [ // "A" => \Exception::class, // \ExampleFactory::EXAMPLE_B => ExampleB::class, // \EXAMPLE_B => \ExampleB::class, // '' => '@|\Iterator', // ]));
<?php function testfunc() { echo 'a<br>'; } testFunc(); override('testFunc', '', ''); testFunc();
foreach ($commandAlts as $alt) { if (commandExists($alt)) { $cmd = $alt; } } if ($cmd === null) { throw new Exception("Unable to determine composer command, tried [" . join(", ", $commandAlts) . "]", 3); } array_shift($argv); // Remove haydn.php command putenv("COMPOSER={$newConf}"); passthru("{$cmd} " . join(" ", $argv), $retVal); return $retVal; } function commandExists($cmd) { exec("which {$cmd}", $output, $retVal); return $retVal === 0; } //////////////////////////////////////////////////////////////////////////////// try { $conf = loadJson(SRC_CONF); $modifier = loadJson(MOD_CONF); override($conf, $modifier); $tempPath = writeTemp($conf); $retVal = launchComposer($tempPath, $argv); exit($retVal); } catch (Exception $e) { fwrite(STDERR, $e->getMessage() . "\n"); exit(100 + $e->getCode()); }