xref: /PHP-7.4/Zend/tests/anon/008.phpt (revision 49608e06)
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--EXPECT--
22string(4) "cats"
23string(4) "dogs"
24