mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
a9e6667817
We already detect the case where we're entirely outside a class -- now also check whether there actually is a parent. This is a minor BC break, in that code that was never executed might have previously contained an invalid parent:: reference without generating an error.
15 lines
311 B
PHP
15 lines
311 B
PHP
--TEST--
|
|
class name as scalar from ::class keyword error using parent in class constant
|
|
--FILE--
|
|
<?php
|
|
|
|
namespace Foo\Bar {
|
|
class One {
|
|
const Baz = parent::class;
|
|
}
|
|
var_dump(One::Baz);
|
|
}
|
|
?>
|
|
--EXPECTF--
|
|
Fatal error: Cannot use "parent" when current class scope has no parent in %s on line %d
|