xref: /PHP-8.4/Zend/tests/traits/error_012.phpt (revision d30cd7d7)
1--TEST--
2Trying to access a protected trait method
3--FILE--
4<?php
5
6trait foo {
7    public function test() { return 3; }
8}
9
10class bar {
11    use foo { test as protected; }
12}
13
14$x = new bar;
15var_dump($x->test());
16
17?>
18--EXPECTF--
19Fatal error: Uncaught Error: Call to protected method bar::test() from global scope in %s:%d
20Stack trace:
21#0 {main}
22  thrown in %s on line %d
23