mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00

For classes that are not declared `abstract`, produce a compiler error for any `abstract` methods. For anonymous classes, since they cannot be made abstract, the error message is slightly different. Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
34 lines
547 B
PHP
34 lines
547 B
PHP
--TEST--
|
|
ZE2 A static abstract methods
|
|
--FILE--
|
|
<?php
|
|
|
|
interface showable
|
|
{
|
|
static function show();
|
|
}
|
|
|
|
class pass implements showable
|
|
{
|
|
static function show() {
|
|
echo "Call to function show()\n";
|
|
}
|
|
}
|
|
|
|
pass::show();
|
|
|
|
eval('
|
|
class fail
|
|
{
|
|
abstract static function func();
|
|
}
|
|
');
|
|
|
|
fail::show();
|
|
|
|
echo "Done\n"; // shouldn't be displayed
|
|
?>
|
|
--EXPECTF--
|
|
Call to function show()
|
|
|
|
Fatal error: Class fail declares abstract method func() and must therefore be declared abstract in %sabstract_static.php(%d) : eval()'d code on line %d
|