xref: /PHP-8.1/Zend/tests/anon/008.phpt (revision 7aacc705)
1--TEST--
2testing static access for methods and properties in anon classes
3--FILE--
4<?php
5$anonClass = new class("cats", "dogs") {
6    public static $foo;
7    private static $bar;
8
9    public function __construct($foo, $bar) {
10        static::$foo = $foo;
11        static::$bar = $bar;
12    }
13
14    public static function getBar() {
15        return static::$bar;
16    }
17};
18
19var_dump($anonClass::$foo);
20var_dump($anonClass::getBar());
21?>
22--EXPECT--
23string(4) "cats"
24string(4) "dogs"
25