Download src/php/php-src/Zend/tests/asymmetric_visibility/reference.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 467 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/asymmetric_visibility/reference.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/asymmetric_visibility/reference.phpt
-
curl -L -o reference.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/asymmetric_visibility/reference.phpt
467 Bytes
| --TEST-- | |
| Asymmetric visibility reference | |
| --FILE-- | |
| class Foo { | |
| public private(set) int $bar = 0; | |
| public function test() { | |
| $bar = &$this->bar; | |
| $bar++; | |
| } | |
| } | |
| $foo = new Foo(); | |
| try { | |
| $bar = &$foo->bar; | |
| $bar++; | |
| } catch (Error $e) { | |
| echo $e->getMessage(), "\n"; | |
| } | |
| var_dump($foo->bar); | |
| $foo->test(); | |
| var_dump($foo->bar); | |
| --EXPECT-- | |
| Cannot indirectly modify private(set) property Foo::$bar from global scope | |
| int(0) | |
| int(1) | |