xref: /PHP-8.3/tests/classes/private_001.phpt (revision d30cd7d7)
1--TEST--
2ZE2 A private method can only be called inside the class
3--FILE--
4<?php
5
6class pass {
7    private static function show() {
8        echo "Call show()\n";
9    }
10
11    public static function do_show() {
12        pass::show();
13    }
14}
15
16pass::do_show();
17pass::show();
18
19echo "Done\n"; // shouldn't be displayed
20?>
21--EXPECTF--
22Call show()
23
24Fatal error: Uncaught Error: Call to private method pass::show() from global scope in %s:%d
25Stack trace:
26#0 {main}
27  thrown in %s on line %d
28