$ php -v
PHP 8.1.2-1ubuntu2.10 (cli) (built: Jan 16 2023 15:19:49) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
with Zend OPcache v8.1.2-1ubuntu2.10, Copyright (c), by Zend Technologies
$ cat entry-point.php
<?php
error_reporting(E_ALL & ~E_WARNING & ~E_USER_WARNING);
class C {
final private function m() {}
}
$ php entry-point.php
PHP Warning: Private methods cannot be final as they are never overridden by other classes in /tmp//entry-point.php on line 6
Ok, the appropriate WARNING appears.
However, since there is error_reporting(...) instruction, it should not appear.
Why do you appear?