webman安装php-di与webman的psr/container冲突

dpdzq

问题描述

今天新下载了webman,创建了项目后,默认 psr/container 就是使用的^2.0版本,我在项目里面通过composer安装php-di的时候报错,必须使用psr/container^1.0才可以,最后通过 composer config -g --unset repos.packagist 命令后,终于安装成功了 php-di^6.4版本,但是

启动报错,应该是psr/container与php-di版本问题冲突了?
PHP Fatal error: Declaration of DI\Container::has($name) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool in /var/www/html/webman/vendor/php-di/php-di/src/Container.php on line 210

Fatal error: Declaration of DI\Container::has($name) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool in /var/www/html/webman/vendor/php-di/php-di/src/Container.php on line 210
PHP Fatal error: Declaration of DI\Container::has($name) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool in /var/www/html/webman/vendor/php-di/php-di/src/Container.php on line 210

Fatal error: Declaration of DI\Container::has($name) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool in /var/www/html/webman/vendor/php-di/php-di/src/Container.php on line 210
Worker[31791] process terminated with ERROR: E_COMPILE_ERROR "Declaration of DI\Container::has($name) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool in /var/www/html/webman/vendor/php-di/php-di/src/Container.php on line 210"
Worker[31789] process terminated with ERROR: E_COMPILE_ERROR "Declaration of DI\Container::has($name) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool in /var/www/html/webman/vendor/php-di/php-di/src/Container.php on line 210"
PHP Fatal error: Declaration of DI\Container::has($name) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool in /var/www/html/webman/vendor/php-di/php-di/src/Container.php on line 210

Fatal error: Declaration of DI\Container::has($name) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool in /var/www/html/webman/vendor/php-di/php-di/src/Container.php on line 210
Worker[31790] process terminated with ERROR: E_COMPILE_ERROR "Declaration of DI\Container::has($name) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool in /var/www/html/webman/vendor/php-di/php-di/src/Container.php on line 210"
PHP Fatal error: Declaration of DI\Container::has($name) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool in /var/www/html/webman/vendor/php-di/php-di/src/Container.php on line 210

Fatal error: Declaration of DI\Container::has($name) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool in /var/www/html/webman/vendor/php-di/php-di/src/Container.php on line 210
Worker[31792] process terminated with ERROR: E_COMPILE_ERROR "Declaration of DI\Container::has($name) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool in /var/www/html/webman/vendor/php-di/php-di/src/Container.php on line 210"
PHP Fatal error: Declaration of DI\Container::has($name) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool in /var/www/html/webman/vendor/php-di/php-di/src/Container.php on line 210

Fatal error: Declaration of DI\Container::has($name) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool in /var/www/html/webman/vendor/php-di/php-di/src/Container.php on line 210
Worker[31793] process terminated with ERROR: E_COMPILE_ERROR "Declaration of DI\Container::has($name) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool in /var/www/html/webman/vendor/php-di/php-di/src/Container.php on line 210"
^CWorkerman[start.php] stopping ...

102 1 0
1个回答

Tinywan

php版本,webman版本要贴上来

  • dpdzq 2天前

    PHP版本:PHP 7.4.33
    Webman版本怎么看呢,我就是刚刚通过 composer create-project workerman/webman 命令创建的

  • dpdzq 2天前

    运行了下webman,显示 :Workerman version:4.1.17

  • walkor 2天前

    用php8 吧

  • dpdzq 2天前

    服务器上跑着其他的东西,还没发直接升级php,怕以前的东西出现兼容性

×
🔝