DI\Definition\Exception\InvalidDefinition: Cannot compile closures which import variables using the `use` keyword in /var/www/staging.belarushockey.com/vendor/php-di/php-di/src/Compiler/Compiler.php:389
Stack trace:
#0 /var/www/staging.belarushockey.com/vendor/php-di/php-di/src/Compiler/Compiler.php(333): DI\Compiler\Compiler->compileClosure()
#1 /var/www/staging.belarushockey.com/vendor/php-di/php-di/src/Compiler/Compiler.php(286): DI\Compiler\Compiler->compileValue()
#2 /var/www/staging.belarushockey.com/vendor/php-di/php-di/src/Compiler/Compiler.php(140): DI\Compiler\Compiler->compileDefinition()
#3 /var/www/staging.belarushockey.com/vendor/php-di/php-di/src/ContainerBuilder.php(147): DI\Compiler\Compiler->compile()
#4 /var/www/staging.belarushockey.com/src/Extasy/ServiceProviders/DI/ContainerProvider.php(12): DI\ContainerBuilder->build()
#5 [internal function]: Extasy\ServiceProviders\DI\ContainerProvider::bootstrap()
#6 /var/www/staging.belarushockey.com/src/Extasy/CMS.php(85): call_user_func()
#7 /var/www/staging.belarushockey.com/src/Extasy/CMS.php(72): Extasy\CMS->bootstrap()
#8 /var/www/staging.belarushockey.com/public_html/cms.php(32): Extasy\CMS->__construct()
#9 {main}

Error source:

"/var/www/staging.belarushockey.com/vendor/php-di/php-di/src/Compiler/Compiler.php"
[ 385]    {
[ 386]        $reflector = new ReflectionClosure($closure);
[ 387]
[ 388]        if ($reflector->getUseVariables()) {
[ 389]            throw new InvalidDefinition('Cannot compile closures which import variables using the `use` keyword');
[ 390]        }
[ 391]
[ 392]        if ($reflector->isBindingRequired() || $reflector->isScopeRequired()) {
[ 393]            throw new InvalidDefinition('Cannot compile closures which use $this or self/static/parent references');
[ 394]        }