mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00

This allows $obj::class, which gives the same result as get_class($obj). Anything other than an object results in TypeError. RFC: https://wiki.php.net/rfc/class_name_literal_on_object Closes GH-5065.
10 lines
220 B
PHP
10 lines
220 B
PHP
--TEST--
|
|
::class on an expression cannot be used inside constant expressions
|
|
--FILE--
|
|
<?php
|
|
|
|
const A = [0]::class;
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Fatal error: (expression)::class cannot be used in constant expressions in %s on line %d
|