Download src/php/php-src/Zend/tests/generators/debugInfo_001.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/generators/debugInfo_001.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/generators/debugInfo_001.phpt
-
curl -L -o debugInfo_001.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/generators/debugInfo_001.phpt
1.26 kB
| --TEST-- | |
| Generators expose the underlying function name in __debugInfo(). | |
| --FILE-- | |
| <?php | |
| function foo() { | |
| yield; | |
| } | |
| $gens = [ | |
| (new class() { | |
| function a() { | |
| yield from foo(); | |
| } | |
| })->a(), | |
| (function() { | |
| yield; | |
| })(), | |
| foo(), | |
| ]; | |
| foreach ($gens as $gen) { | |
| echo "Before:", PHP_EOL; | |
| var_dump($gen); | |
| foreach ($gen as $dummy) { | |
| echo "Inside:", PHP_EOL; | |
| var_dump($gen); | |
| } | |
| echo "After:", PHP_EOL; | |
| var_dump($gen); | |
| } | |
| ?> | |
| --EXPECTF-- | |
| Before: | |
| object(Generator)#%d (1) { | |
| ["function"]=> | |
| string(%d) "class@anonymous%s::a" | |
| } | |
| Inside: | |
| object(Generator)#%d (1) { | |
| ["function"]=> | |
| string(%d) "class@anonymous%s::a" | |
| } | |
| After: | |
| object(Generator)#%d (1) { | |
| ["function"]=> | |
| string(%d) "class@anonymous%s::a" | |
| } | |
| Before: | |
| object(Generator)#%d (1) { | |
| ["function"]=> | |
| string(%d) "{closure:%s:%d}" | |
| } | |
| Inside: | |
| object(Generator)#%d (1) { | |
| ["function"]=> | |
| string(%d) "{closure:%s:%d}" | |
| } | |
| After: | |
| object(Generator)#%d (1) { | |
| ["function"]=> | |
| string(%d) "{closure:%s:%d}" | |
| } | |
| Before: | |
| object(Generator)#%d (1) { | |
| ["function"]=> | |
| string(3) "foo" | |
| } | |
| Inside: | |
| object(Generator)#%d (1) { | |
| ["function"]=> | |
| string(3) "foo" | |
| } | |
| After: | |
| object(Generator)#%d (1) { | |
| ["function"]=> | |
| string(3) "foo" | |
| } | |