Download src/php/php-src/Zend/tests/attributes/017_closure_scope.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 845 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/attributes/017_closure_scope.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/attributes/017_closure_scope.phpt
-
curl -L -o 017_closure_scope.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/attributes/017_closure_scope.phpt
845 Bytes
| --TEST-- | |
| Attributes make use of closure scope. | |
| --FILE-- | |
| class Test1 | |
| { | |
| private const FOO = 'bar'; | |
| } | |
| class C1 | |
| { | |
| private const FOO = 'foo'; | |
| public static function foo() | |
| { | |
| return (self::class, self::FOO) function (#[A1(self::class, self::FOO)] $p) { }; | |
| } | |
| } | |
| $ref = new \ReflectionFunction(C1::foo()); | |
| print_r($ref->getAttributes()[0]->getArguments()); | |
| print_r($ref->getParameters()[0]->getAttributes()[0]->getArguments()); | |
| echo "\n"; | |
| $ref = new \ReflectionFunction(C1::foo()->bindTo(null, Test1::class)); | |
| print_r($ref->getAttributes()[0]->getArguments()); | |
| print_r($ref->getParameters()[0]->getAttributes()[0]->getArguments()); | |
| --EXPECT-- | |
| Array | |
| ( | |
| [0] => C1 | |
| [1] => foo | |
| ) | |
| Array | |
| ( | |
| [0] => C1 | |
| [1] => foo | |
| ) | |
| Array | |
| ( | |
| [0] => Test1 | |
| [1] => bar | |
| ) | |
| Array | |
| ( | |
| [0] => Test1 | |
| [1] => bar | |
| ) | |