File: multiple_final_modifiers.phpt

package info (click to toggle)
php-ast 1.1.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 632 kB
  • sloc: ansic: 2,173; xml: 621; php: 319; makefile: 2
file content (21 lines) | stat: -rw-r--r-- 422 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
--TEST--
Multiple final multipliers should generate CompileError, not a fatal error
--SKIPIF--
<?php if (PHP_VERSION_ID < 70300) die('skip Requires PHP 7.3+'); ?>
--FILE--
<?php

$code = <<<'PHP'
<?php class C {
    final final function foo($fff) {}
}
PHP;

try {
    ast\parse_code($code, $version=70);
} catch (CompileError $e) {
    echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Multiple final modifiers are not allowed