1
0
mirror of https://github.com/php/php-src.git synced 2026-04-25 17:08:14 +02:00
Files
archived-php-src/Zend/tests/class_on_constant_evaluated_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
208 B
PHP

--TEST--
An error should be generated when using ::class on a constant evaluated expression
--FILE--
<?php
(1+1)::class;
?>
--EXPECTF--
Fatal error: Cannot use ::class on value of type int in %s on line %d