1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 11:13:36 +02:00
Files
archived-php-src/Zend/tests/class_on_expression_in_constant_expression.phpt
T
Nikita Popov d933591674 Add support for $obj::class
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.
2020-02-11 12:16:30 +01:00

11 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