diff --git a/CHANGELOG-2.2.md b/CHANGELOG-2.2.md index 7517f2b07..3bd6d4fae 100644 --- a/CHANGELOG-2.2.md +++ b/CHANGELOG-2.2.md @@ -29,3 +29,8 @@ - [#3631](https://github.com/hyperf/hyperf/pull/3631) Support multiplexing for AMQP component. - [#3635](https://github.com/hyperf/hyperf/pull/3635) Added `Hyperf\Utils\CodeGen\PhpParser` which used to generate AST for reflection. - [#3648](https://github.com/hyperf/hyperf/pull/3648) Added `Hyperf\Utils\CodeGen\PhpDocReaderManager` to manage `PhpDocReader`. + +## Fixed + +- [#3650](https://github.com/hyperf/hyperf/pull/3650) Fixed bug that `ReflectionParameter::getClass()` will be deprecated in php8. + diff --git a/src/di/src/Definition/DefinitionSource.php b/src/di/src/Definition/DefinitionSource.php index a7fad8f52..da1e57aa5 100644 --- a/src/di/src/Definition/DefinitionSource.php +++ b/src/di/src/Definition/DefinitionSource.php @@ -74,10 +74,9 @@ class DefinitionSource implements DefinitionSourceInterface continue; } - $parameterClass = $parameter->getClass(); - - if ($parameterClass) { - $parameters[$index] = new Reference($parameterClass->getName()); + $parameterType = $parameter->getType(); + if ($parameterType && $parameterType instanceof \ReflectionNamedType && ! $parameterType->isBuiltin()) { + $parameters[$index] = new Reference($parameterType->getName()); } } diff --git a/src/framework/src/Logger/StdoutLogger.php b/src/framework/src/Logger/StdoutLogger.php index cfeebc496..0c9d7ae2c 100644 --- a/src/framework/src/Logger/StdoutLogger.php +++ b/src/framework/src/Logger/StdoutLogger.php @@ -138,7 +138,7 @@ class StdoutLogger implements StdoutLoggerInterface $this->output->writeln($message); } - protected function getMessage(string $message, string $level = LogLevel::INFO, array $tags) + protected function getMessage(string $message, string $level = LogLevel::INFO, array $tags = []) { $tag = null; switch ($level) {