Instantiation of class Closure is not allowed¶
Description¶
The Closure class is a PHP native class, which cannot be directly instantiated. It must be created with other syntaxes, such as the closure syntax, function () {};, first class callable foo(...), or arrow functions fn () => 1;.
Example¶
<?php
new Closure();
?>
Solutions¶
Use the closure syntax.
Use the arrow function syntax.
Use the first class callable syntax.
Changed Behavior¶
This error may appear following an evolution in behavior, in previous versions. See ` <https://php-changed-behaviors.readthedocs.io/en/latest/behavior/.html>`_.