Download src/php/php-src/Zend/tests/constexpr/new_self_parent.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 641 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/constexpr/new_self_parent.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/constexpr/new_self_parent.phpt
-
curl -L -o new_self_parent.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/constexpr/new_self_parent.phpt
641 Bytes
| --TEST-- | |
| new self / new parent in constant expression | |
| --FILE-- | |
| class A { | |
| public static function invalid($x = new parent) { | |
| } | |
| } | |
| class B extends A { | |
| public static function method($x = new self, $y = new parent) { | |
| var_dump($x, $y); | |
| } | |
| } | |
| function invalid($x = new self) {} | |
| B::method(); | |
| try { | |
| invalid(); | |
| } catch (Error $e) { | |
| echo $e->getMessage(), "\n"; | |
| } | |
| try { | |
| B::invalid(); | |
| } catch (Error $e) { | |
| echo $e->getMessage(), "\n"; | |
| } | |
| --EXPECT-- | |
| object(B)#1 (0) { | |
| } | |
| object(A)#2 (0) { | |
| } | |
| Cannot access "self" when no class scope is active | |
| Cannot access "parent" when current class scope has no parent | |