Download src/php/php-src/Zend/tests/attributes/constants/not_repeatable-userland.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 702 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/attributes/constants/not_repeatable-userland.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/attributes/constants/not_repeatable-userland.phpt
-
curl -L -o not_repeatable-userland.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/attributes/constants/not_repeatable-userland.phpt
702 Bytes
| --TEST-- | |
| Validation of attribute repetition (not allowed; userland attribute) | |
| --FILE-- | |
| class MyAttribute {} | |
| const MY_CONST = true; | |
| $attributes = new ReflectionConstant('MY_CONST')->getAttributes(); | |
| var_dump($attributes); | |
| $attributes[0]->newInstance(); | |
| --EXPECTF-- | |
| array(2) { | |
| [0]=> | |
| object(ReflectionAttribute)#%d (1) { | |
| ["name"]=> | |
| string(11) "MyAttribute" | |
| } | |
| [1]=> | |
| object(ReflectionAttribute)#%d (1) { | |
| ["name"]=> | |
| string(11) "MyAttribute" | |
| } | |
| } | |
| Fatal error: Uncaught Error: Attribute "MyAttribute" must not be repeated in %s:%d | |
| Stack trace: | |
| #0 %s(%d): ReflectionAttribute->newInstance() | |
| #1 {main} | |
| thrown in %s on line %d | |