mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
b6b16a1758
https://wiki.php.net/rfc/new_without_parentheses Closes GH-13029
27 lines
340 B
PHP
27 lines
340 B
PHP
--TEST--
|
|
Object instantiated without parentheses is collected
|
|
--FILE--
|
|
<?php
|
|
|
|
class A
|
|
{
|
|
public function test(): void
|
|
{
|
|
echo 'called' . PHP_EOL;
|
|
}
|
|
|
|
public function __destruct()
|
|
{
|
|
echo 'collected' . PHP_EOL;
|
|
}
|
|
}
|
|
|
|
new A()->test();
|
|
echo 'code after' . PHP_EOL;
|
|
|
|
?>
|
|
--EXPECT--
|
|
called
|
|
collected
|
|
code after
|