Fixed bug that ReflectionParameter::getClass() will be deprecated in php8. (#3650)

This commit is contained in:
李铭昕 2021-06-01 22:01:53 +08:00 committed by GitHub
parent 6bc61103af
commit f09ab017a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions

View File

@ -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.

View File

@ -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());
}
}

View File

@ -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) {