mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-29 18:27:44 +08:00
Added ModelUpdateVisitor::getReturnType
method (#7077)
This commit is contained in:
parent
3cf0da31d3
commit
2443aa4f10
@ -4,6 +4,7 @@
|
||||
|
||||
- [#7059](https://github.com/hyperf/hyperf/pull/7059) Added `Hyperf\Database\Schema\Schema::getForeignKeys()`.
|
||||
- [#7064](https://github.com/hyperf/hyperf/pull/7064) Support db type `enum` for `DoctrineConnection`.
|
||||
- [#7077](https://github.com/hyperf/hyperf/pull/7077) Added `ModelUpdateVisitor::getReturnType` method.
|
||||
|
||||
# v3.1.40 - 2024-09-12
|
||||
|
||||
|
@ -259,7 +259,7 @@ class ModelUpdateVisitor extends NodeVisitorAbstract
|
||||
// Magic get<name>Attribute
|
||||
$name = Str::snake(substr($method->getName(), 3, -9));
|
||||
if (! empty($name)) {
|
||||
$type = PhpDocReader::getInstance()->getReturnType($method, true);
|
||||
$type = $this->getReturnType($method, true);
|
||||
$this->setProperty($name, $type, true, false, '', false, 1);
|
||||
}
|
||||
continue;
|
||||
@ -438,4 +438,9 @@ class ModelUpdateVisitor extends NodeVisitorAbstract
|
||||
$model = new $className();
|
||||
return '\\' . get_class($model->newCollection());
|
||||
}
|
||||
|
||||
protected function getReturnType(ReflectionMethod $method, bool $withoutNamespace = false): array
|
||||
{
|
||||
return PhpDocReader::getInstance()->getReturnType($method, $withoutNamespace);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user