mirror of
https://github.com/php/php-src.git
synced 2026-03-24 16:22:37 +01:00
RFC: https://wiki.php.net/rfc/typed_class_constants Co-Authored-By: Ben <7127204+moliata@users.noreply.github.com> Co-Authored-By: Bob Weinand <3154871+bwoebi@users.noreply.github.com> Co-Authored-By: Ilija Tovilo <ilija.tovilo@me.com>
21 lines
386 B
PHP
21 lines
386 B
PHP
--TEST--
|
|
Using ReflectionClass::__toString() with typed class constants when there is a type mismatch
|
|
--FILE--
|
|
<?php
|
|
|
|
class Foo {
|
|
const array CONST1 = C;
|
|
}
|
|
|
|
define("C", new stdClass());
|
|
|
|
try {
|
|
(string) new ReflectionClass(Foo::class);
|
|
} catch (TypeError $e) {
|
|
echo $e->getMessage() . "\n";
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
Cannot assign stdClass to class constant Foo::CONST1 of type array
|