The “Generator” class is reserved for internal use and cannot be manually instantiated¶
Description¶
Generator is a PHP native class. It is automagically created when a function or method uses the yield
or yield from
keyword. There is no other ways to create such an object.
In fact, generator
is also a final class, so it cannot be extended too.
Example¶
<?php
new Generator();
?>
Solutions¶
Use composition to use this class in another class.