mirror of
https://github.com/php/php-src.git
synced 2026-04-28 02:33:17 +02:00
c9249e2d3a
* zend_language_parser: Support every argument syntax for `clone()` * zend_language_parser: Adjust `clone()` grammar to avoid conflicts * zend_language_parser: Add explanatory comment for `clone_argument_list`
95 lines
2.2 KiB
PHP
95 lines
2.2 KiB
PHP
--TEST--
|
|
Ast Printing
|
|
--FILE--
|
|
<?php
|
|
|
|
$x = new stdClass();
|
|
|
|
|
|
try {
|
|
assert(false && $y = clone $x);
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
assert(false && $y = clone($x));
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
assert(false && $y = clone($x, ));
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
assert(false && $y = clone($x, [ "foo" => $foo, "bar" => $bar ]));
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
assert(false && $y = clone($x, $array));
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
assert(false && $y = clone($x, $array, $extraParameter, $trailingComma, ));
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
assert(false && $y = clone(object: $x, withProperties: [ "foo" => $foo, "bar" => $bar ]));
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
assert(false && $y = clone($x, withProperties: [ "foo" => $foo, "bar" => $bar ]));
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
assert(false && $y = clone(object: $x));
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
assert(false && $y = clone(object: $x, [ "foo" => $foo, "bar" => $bar ]));
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
assert(false && $y = clone(...["object" => $x, "withProperties" => [ "foo" => $foo, "bar" => $bar ]]));
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
assert(false && $y = clone(...));
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), PHP_EOL;
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
assert(false && ($y = \clone($x)))
|
|
assert(false && ($y = \clone($x)))
|
|
assert(false && ($y = \clone($x)))
|
|
assert(false && ($y = \clone($x, ['foo' => $foo, 'bar' => $bar])))
|
|
assert(false && ($y = \clone($x, $array)))
|
|
assert(false && ($y = \clone($x, $array, $extraParameter, $trailingComma)))
|
|
assert(false && ($y = \clone(object: $x, withProperties: ['foo' => $foo, 'bar' => $bar])))
|
|
assert(false && ($y = \clone($x, withProperties: ['foo' => $foo, 'bar' => $bar])))
|
|
assert(false && ($y = \clone(object: $x)))
|
|
assert(false && ($y = \clone(object: $x, ['foo' => $foo, 'bar' => $bar])))
|
|
assert(false && ($y = \clone(...['object' => $x, 'withProperties' => ['foo' => $foo, 'bar' => $bar]])))
|
|
assert(false && ($y = \clone(...)))
|