diff --git a/ext/config.m4 b/ext/config.m4 index 8552cc50a..7ad79738e 100644 --- a/ext/config.m4 +++ b/ext/config.m4 @@ -2,7 +2,7 @@ PHP_ARG_ENABLE(stub, whether to enable stub, [ --enable-stub Enable Stub]) if test "$PHP_STUB" = "yes"; then - + if ! test "x" = "x"; then PHP_EVAL_LIBLINE(, STUB_SHARED_LIBADD) @@ -79,6 +79,7 @@ if test "$PHP_STUB" = "yes"; then stub/functional.zep.c stub/functionexists.zep.c stub/functions.zep.c + stub/generators.zep.c stub/geometry.zep.c stub/globals.zep.c stub/globals/env.zep.c diff --git a/ext/config.w32 b/ext/config.w32 index 7cc2da406..ee19516cd 100644 --- a/ext/config.w32 +++ b/ext/config.w32 @@ -9,35 +9,35 @@ if (PHP_STUB != "no") { ADD_EXTENSION_DEP("stub", "json"); AC_DEFINE("ZEPHIR_USE_PHP_JSON", 1, "Whether PHP json extension is present at compile time"); } - - ADD_SOURCES(configure_module_dirname + "/stub/invokes", "abstractprotected.zep.c abstractinvoker.zep.c abstractinvokercomplex.zep.c invokeprotected.zep.c invokeprotectedcomplex.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub", "testinterface.zep.c scallparent.zep.c constantsparent.zep.c methodinterface.zep.c arithmetic.zep.c arrayaccessobj.zep.c arrayaccesstest.zep.c arrayiterator.zep.c arrayiteratortest.zep.c arraymanipulation.zep.c arrayobject.zep.c arraysearch.zep.c assign.zep.c bitwise.zep.c branchprediction.zep.c cast.zep.c cblock.zep.c chars.zep.c closures.zep.c compare.zep.c concat.zep.c constants.zep.c constantsinterface.zep.c constantsinterfacea.zep.c constantsinterfaceb.zep.c declaretest.zep.c diinterface.zep.c echoes.zep.c emptytest.zep.c evaltest.zep.c exception.zep.c exceptions.zep.c exists.zep.c exitdie.zep.c extendedinterface.zep.c factorial.zep.c fannkuch.zep.c fasta.zep.c fcall.zep.c fetchtest.zep.c fibonnaci.zep.c flow.zep.c fortytwo.zep.c functional.zep.c functionexists.zep.c functions.zep.c geometry.zep.c globals.zep.c instance.zep.c instanceoff.zep.c internalclasses.zep.c internalinterfaces.zep.c invoke.zep.c issettest.zep.c issue1134.zep.c issue1404.zep.c issue1521.zep.c issue663.zep.c issue887.zep.c issue893.zep.c issue914.zep.c issues.zep.c json.zep.c logical.zep.c mcall.zep.c mcallchained.zep.c mcalldynamic.zep.c mcallinternal.zep.c methodabstract.zep.c methodargs.zep.c nativearray.zep.c oo.zep.c operator.zep.c pdostatement.zep.c pregmatch.zep.c quantum.zep.c range.zep.c references.zep.c reflection.zep.c regexdna.zep.c requires.zep.c resourcetest.zep.c returns.zep.c router.zep.c scall.zep.c scalldynamic.zep.c scallexternal.zep.c scalllateconstruct.zep.c scope.zep.c sort.zep.c spectralnorm.zep.c spl.zep.c spropertyaccess.zep.c statements.zep.c strings.zep.c stubs.zep.c ternary.zep.c trytest.zep.c typeinstances.zep.c typeoff.zep.c unknownclass.zep.c unsettest.zep.c usetest.zep.c vars.zep.c 0__closure.zep.c 1__closure.zep.c 2__closure.zep.c 3__closure.zep.c 4__closure.zep.c 5__closure.zep.c 6__closure.zep.c 7__closure.zep.c 8__closure.zep.c 9__closure.zep.c 10__closure.zep.c 11__closure.zep.c 12__closure.zep.c 13__closure.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/oo/extend", "exception.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/issue2165", "issueextendinterface.zep.c issueinterface.zep.c issue.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/oo/extend/db", "exception.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/globals/session", "base.zep.c child.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/interfaces", "interfaceint.zep.c interfaceintsignature.zep.c implementint.zep.c implementinterface.zep.c interfacestaticmethod.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/oo", "abstractstatic.zep.c oodynamica.zep.c abstractclass.zep.c concretestatic.zep.c constantsinterface.zep.c deprecatedmethods.zep.c dynamicprop.zep.c extendpdoclass.zep.c ooconstruct.zep.c ooconstructparams.zep.c oodestruct.zep.c oodynamicb.zep.c oonativeimplements.zep.c oonoconstruct.zep.c ooparams.zep.c param.zep.c propertyaccess.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/oo/extend/db/query", "exception.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/oo/scopes", "hasprivatemethod.zep.c scopetesterinterface.zep.c abstractclass.zep.c abstractclassmagic.zep.c privatescopetester.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/ooimpl", "zbeginning.zep.c abeginning.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/properties", "publicproperties.zep.c app.zep.c extendspublicproperties.zep.c getobjectvars.zep.c privateproperties.zep.c propertyarray.zep.c propertyupdate.zep.c protectedproperties.zep.c staticprivateproperties.zep.c staticpropertyarray.zep.c staticprotectedproperties.zep.c staticpublicproperties.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/bench", "foo.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/builtin", "arraymethods.zep.c charmethods.zep.c intmethods.zep.c stringmethods.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/constructors", "issue1803.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/flow", "switchflow.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/globals", "env.zep.c post.zep.c server.zep.c serverrequestfactory.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/integration/psr", "extendexternal.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/integration/psr/http/message", "messageinterfaceex.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/mcall", "caller.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/namespaces/a/b", "sub.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/namespaces", "classentry.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/oo/extend/db/query/placeholder", "exception.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/oo/extend/spl", "arrayobject.zep.c directoryiterator.zep.c doublylinkedlist.zep.c fileinfo.zep.c fileobject.zep.c filesystemiterator.zep.c fixedarray.zep.c globiterator.zep.c heap.zep.c maxheap.zep.c minheap.zep.c priorityqueue.zep.c queue.zep.c recursivedirectoryiterator.zep.c stack.zep.c tempfileobject.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/optimizers", "isscalar.zep.c acos.zep.c arraymerge.zep.c asin.zep.c cos.zep.c createarray.zep.c ldexp.zep.c sin.zep.c sqrt.zep.c strreplace.zep.c substr.zep.c tan.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/requires", "external3.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/router", "exception.zep.c route.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/typehinting", "testabstract.zep.c", "stub"); + + ADD_SOURCES(configure_module_dirname + "/stub/invokes", "abstractprotected.zep.c abstractinvoker.zep.c abstractinvokercomplex.zep.c invokeprotected.zep.c invokeprotectedcomplex.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub", "testinterface.zep.c scallparent.zep.c constantsparent.zep.c methodinterface.zep.c arithmetic.zep.c arrayaccessobj.zep.c arrayaccesstest.zep.c arrayiterator.zep.c arrayiteratortest.zep.c arraymanipulation.zep.c arrayobject.zep.c arraysearch.zep.c assign.zep.c bitwise.zep.c branchprediction.zep.c cast.zep.c cblock.zep.c chars.zep.c closures.zep.c compare.zep.c concat.zep.c constants.zep.c constantsinterface.zep.c constantsinterfacea.zep.c constantsinterfaceb.zep.c declaretest.zep.c diinterface.zep.c echoes.zep.c emptytest.zep.c evaltest.zep.c exception.zep.c exceptions.zep.c exists.zep.c exitdie.zep.c extendedinterface.zep.c factorial.zep.c fannkuch.zep.c fasta.zep.c fcall.zep.c fetchtest.zep.c fibonnaci.zep.c flow.zep.c fortytwo.zep.c functional.zep.c functionexists.zep.c functions.zep.c generators.zep.c geometry.zep.c globals.zep.c instance.zep.c instanceoff.zep.c internalclasses.zep.c internalinterfaces.zep.c invoke.zep.c issettest.zep.c issue1134.zep.c issue1404.zep.c issue1521.zep.c issue663.zep.c issue887.zep.c issue893.zep.c issue914.zep.c issues.zep.c json.zep.c logical.zep.c mcall.zep.c mcallchained.zep.c mcalldynamic.zep.c mcallinternal.zep.c methodabstract.zep.c methodargs.zep.c nativearray.zep.c oo.zep.c operator.zep.c pdostatement.zep.c pregmatch.zep.c quantum.zep.c range.zep.c references.zep.c reflection.zep.c regexdna.zep.c requires.zep.c resourcetest.zep.c returns.zep.c router.zep.c scall.zep.c scalldynamic.zep.c scallexternal.zep.c scalllateconstruct.zep.c scope.zep.c sort.zep.c spectralnorm.zep.c spl.zep.c spropertyaccess.zep.c statements.zep.c strings.zep.c stubs.zep.c ternary.zep.c trytest.zep.c typeinstances.zep.c typeoff.zep.c unknownclass.zep.c unsettest.zep.c usetest.zep.c vars.zep.c 0__closure.zep.c 1__closure.zep.c 2__closure.zep.c 3__closure.zep.c 4__closure.zep.c 5__closure.zep.c 6__closure.zep.c 7__closure.zep.c 8__closure.zep.c 9__closure.zep.c 10__closure.zep.c 11__closure.zep.c 12__closure.zep.c 13__closure.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/oo/extend", "exception.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/issue2165", "issueextendinterface.zep.c issueinterface.zep.c issue.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/oo/extend/db", "exception.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/globals/session", "base.zep.c child.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/interfaces", "interfaceint.zep.c interfaceintsignature.zep.c implementint.zep.c implementinterface.zep.c interfacestaticmethod.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/oo", "abstractstatic.zep.c oodynamica.zep.c abstractclass.zep.c concretestatic.zep.c constantsinterface.zep.c deprecatedmethods.zep.c dynamicprop.zep.c extendpdoclass.zep.c ooconstruct.zep.c ooconstructparams.zep.c oodestruct.zep.c oodynamicb.zep.c oonativeimplements.zep.c oonoconstruct.zep.c ooparams.zep.c param.zep.c propertyaccess.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/oo/extend/db/query", "exception.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/oo/scopes", "hasprivatemethod.zep.c scopetesterinterface.zep.c abstractclass.zep.c abstractclassmagic.zep.c privatescopetester.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/ooimpl", "zbeginning.zep.c abeginning.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/properties", "publicproperties.zep.c app.zep.c extendspublicproperties.zep.c getobjectvars.zep.c privateproperties.zep.c propertyarray.zep.c propertyupdate.zep.c protectedproperties.zep.c staticprivateproperties.zep.c staticpropertyarray.zep.c staticprotectedproperties.zep.c staticpublicproperties.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/bench", "foo.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/builtin", "arraymethods.zep.c charmethods.zep.c intmethods.zep.c stringmethods.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/constructors", "issue1803.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/flow", "switchflow.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/globals", "env.zep.c post.zep.c server.zep.c serverrequestfactory.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/integration/psr", "extendexternal.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/integration/psr/http/message", "messageinterfaceex.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/mcall", "caller.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/namespaces/a/b", "sub.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/namespaces", "classentry.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/oo/extend/db/query/placeholder", "exception.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/oo/extend/spl", "arrayobject.zep.c directoryiterator.zep.c doublylinkedlist.zep.c fileinfo.zep.c fileobject.zep.c filesystemiterator.zep.c fixedarray.zep.c globiterator.zep.c heap.zep.c maxheap.zep.c minheap.zep.c priorityqueue.zep.c queue.zep.c recursivedirectoryiterator.zep.c stack.zep.c tempfileobject.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/optimizers", "isscalar.zep.c acos.zep.c arraymerge.zep.c asin.zep.c cos.zep.c createarray.zep.c ldexp.zep.c sin.zep.c sqrt.zep.c strreplace.zep.c substr.zep.c tan.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/requires", "external3.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/router", "exception.zep.c route.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/typehinting", "testabstract.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/types", "mixedtype.zep.c", "stub"); ADD_FLAG("CFLAGS_STUB", "/D ZEPHIR_RELEASE /Oi /Ot /Oy /Ob2 /Gs /GF /Gy /GL"); ADD_FLAG("CFLAGS", "/D ZEPHIR_RELEASE /Oi /Ot /Oy /Ob2 /Gs /GF /Gy /GL"); diff --git a/ext/stub.c b/ext/stub.c index 7fd9c1cdf..6aa78529b 100644 --- a/ext/stub.c +++ b/ext/stub.c @@ -110,6 +110,7 @@ zend_class_entry *stub_fortytwo_ce; zend_class_entry *stub_functional_ce; zend_class_entry *stub_functionexists_ce; zend_class_entry *stub_functions_ce; +zend_class_entry *stub_generators_ce; zend_class_entry *stub_geometry_ce; zend_class_entry *stub_globals_ce; zend_class_entry *stub_globals_env_ce; @@ -250,9 +251,9 @@ ZEND_DECLARE_MODULE_GLOBALS(stub) PHP_INI_BEGIN() STD_PHP_INI_BOOLEAN("stub.db.my_setting_1", "0", PHP_INI_ALL, OnUpdateBool, db.my_setting_1, zend_stub_globals, stub_globals) - - - + + + STD_PHP_INI_BOOLEAN("stub.orm.cache_enable", "1", PHP_INI_ALL, OnUpdateBool, orm.cache_enable, zend_stub_globals, stub_globals) STD_PHP_INI_ENTRY("stub.orm.cache_prefix", "prefix-string-", PHP_INI_ALL, NULL, orm.cache_prefix, zend_stub_globals, stub_globals) STD_PHP_INI_BOOLEAN("extension.test_ini_variable", "1", PHP_INI_ALL, OnUpdateBool, extension.test_ini_variable, zend_stub_globals, stub_globals) @@ -338,6 +339,7 @@ static PHP_MINIT_FUNCTION(stub) ZEPHIR_INIT(Stub_FunctionExists); ZEPHIR_INIT(Stub_Functional); ZEPHIR_INIT(Stub_Functions); + ZEPHIR_INIT(Stub_Generators); ZEPHIR_INIT(Stub_Geometry); ZEPHIR_INIT(Stub_Globals); ZEPHIR_INIT(Stub_Globals_Env); @@ -487,14 +489,14 @@ static PHP_MINIT_FUNCTION(stub) ZEPHIR_INIT(stub_7__closure); ZEPHIR_INIT(stub_8__closure); ZEPHIR_INIT(stub_9__closure); - + return SUCCESS; } #ifndef ZEPHIR_RELEASE static PHP_MSHUTDOWN_FUNCTION(stub) { - + zephir_deinitialize_memory(); UNREGISTER_INI_ENTRIES(); return SUCCESS; @@ -517,7 +519,7 @@ static void php_zephir_init_globals(zend_stub_globals *stub_globals) /* Static cache */ memset(stub_globals->scache, '\0', sizeof(zephir_fcall_cache_entry*) * ZEPHIR_MAX_CACHE_SLOTS); - + stub_globals->db.my_setting_2 = 100; stub_globals->db.my_setting_3 = 7.5; stub_globals->orm.cache_level = 3; @@ -530,7 +532,7 @@ static void php_zephir_init_globals(zend_stub_globals *stub_globals) stub_globals->my_setting_3 = 15.2; stub_globals->my_setting_4 = 'A'; stub_globals->my_setting_5 = ZSTR_VAL(zend_string_init(ZEND_STRL("custom_value"), 0)); - + } /** @@ -538,7 +540,7 @@ static void php_zephir_init_globals(zend_stub_globals *stub_globals) */ static void php_zephir_init_module_globals(zend_stub_globals *stub_globals) { - + } static PHP_RINIT_FUNCTION(stub) @@ -551,13 +553,13 @@ static PHP_RINIT_FUNCTION(stub) zephir_init_static_properties_Stub_Properties_StaticPropertyArray(); zephir_init_static_properties_Stub_SPropertyAccess(); - + return SUCCESS; } static PHP_RSHUTDOWN_FUNCTION(stub) { - + zephir_deinitialize_memory(); return SUCCESS; } @@ -603,7 +605,7 @@ static PHP_GINIT_FUNCTION(stub) static PHP_GSHUTDOWN_FUNCTION(stub) { - + } PHP_FUNCTION(g_stub_zephir_global_method_test); diff --git a/ext/stub.h b/ext/stub.h index cf7b456b2..b9b309352 100644 --- a/ext/stub.h +++ b/ext/stub.h @@ -74,6 +74,7 @@ #include "stub/functional.zep.h" #include "stub/functionexists.zep.h" #include "stub/functions.zep.h" +#include "stub/generators.zep.h" #include "stub/geometry.zep.h" #include "stub/globals.zep.h" #include "stub/globals/env.zep.h" @@ -227,4 +228,4 @@ #include "stub/12__closure.zep.h" #include "stub/13__closure.zep.h" -#endif \ No newline at end of file +#endif diff --git a/ext/stub/generators.zep.c b/ext/stub/generators.zep.c new file mode 100644 index 000000000..f36e642be --- /dev/null +++ b/ext/stub/generators.zep.c @@ -0,0 +1,71 @@ + +#ifdef HAVE_CONFIG_H +#include "../ext_config.h" +#endif + +#include +#include "../php_ext.h" +#include "../ext.h" + +#include +#include +#include +#include + +#include "kernel/main.h" +#include "kernel/object.h" + +//static zend_object_handlers zend_generator_handlers; + + +ZEPHIR_INIT_CLASS(Stub_Generators) +{ + ZEPHIR_REGISTER_CLASS(Stub, Generators, stub, generators, stub_generators_method_entry, 0); + + return SUCCESS; +} + +PHP_METHOD(Stub_Generators, simpleYield) +{ + //zend_ast *ast_val = zend_ast_create_zval_from_str(zend_string_init("test", sizeof("test") - 1, 0)); + zval vals; + + zephir_create_array(&vals, 5, 0); + zephir_array_update_string(&vals, SL("server"), zend_string_init("test", sizeof("test") - 1, 0), PH_COPY | PH_SEPARATE); + + zend_generator *generator, *root; + + generator = emalloc(sizeof(zend_generator)); + memset(generator, 0, sizeof(zend_generator)); + + /* The key will be incremented on first use, so it'll start at 0 */ + generator->largest_used_integer_key = -1; + + ZVAL_UNDEF(&generator->retval); + ZVAL_UNDEF(&generator->values); + + /* By default we have a tree of only one node */ + generator->node.parent = NULL; + generator->node.children = 0; + generator->node.ptr.root = NULL; + generator->values = vals; + + zend_object_std_init(&generator->std, zend_standard_class_def); + //generator->std.handlers = &zend_generator_handlers; + + root = zend_generator_get_current(generator); + RETURN_COPY_DEREF(root->values); + //if (EXPECTED(generator->execute_data != NULL && Z_TYPE(root->key) != IS_UNDEF)) { + // RETURN_COPY_DEREF(&root->key); + //} + + //RETURN_OBJ_COPY(generator); + + // CG(active_op_array)->fn_flags |= ZEND_ACC_GENERATOR; + // zend_ast_create(ZEND_AST_YIELD, $2, NULL); CG(extra_fn_flags) |= ZEND_ACC_GENERATOR; + + //CG(active_op_array)->fn_flags |= ZEND_ACC_GENERATOR; + + //zend_emit_op(NULL, ZEND_YIELD, ast_val, NULL); +} + diff --git a/ext/stub/generators.zep.h b/ext/stub/generators.zep.h new file mode 100644 index 000000000..5b67d7416 --- /dev/null +++ b/ext/stub/generators.zep.h @@ -0,0 +1,18 @@ + +extern zend_class_entry *stub_generators_ce; + +ZEPHIR_INIT_CLASS(Stub_Generators); + +PHP_METHOD(Stub_Generators, simpleYield); + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_generators_simpleyield, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEPHIR_INIT_FUNCS(stub_generators_method_entry) { +#if PHP_VERSION_ID >= 80000 + PHP_ME(Stub_Generators, simpleYield, arginfo_stub_generators_simpleyield, ZEND_ACC_PUBLIC) +#else + PHP_ME(Stub_Generators, simpleYield, NULL, ZEND_ACC_PUBLIC) +#endif + PHP_FE_END +}; diff --git a/stub/generators.zep b/stub/generators.zep new file mode 100644 index 000000000..d2994fa8f --- /dev/null +++ b/stub/generators.zep @@ -0,0 +1,10 @@ + +namespace Stub; + +class Generators +{ + public function simpleYield() + { + //yield 1; + } +} diff --git a/tests/Extension/GeneratorsTest.php b/tests/Extension/GeneratorsTest.php new file mode 100644 index 000000000..01f433262 --- /dev/null +++ b/tests/Extension/GeneratorsTest.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Extension; + +use PHPUnit\Framework\TestCase; +use Stub\Generators; + +final class GeneratorsTest extends TestCase +{ + private Generators $test; + + protected function setUp(): void + { + $this->test = new Generators(); + } + + public function testYield(): void + { + $this->assertInstanceOf(\Generator::class, $this->test->simpleYield()); + } +}