Skip to content

Fixed @Inject does not works in nested trait.#3520

Merged
limingxinleo merged 7 commits intohyperf:masterfrom
assert6:trait_nesting
Apr 25, 2021
Merged

Fixed @Inject does not works in nested trait.#3520
limingxinleo merged 7 commits intohyperf:masterfrom
assert6:trait_nesting

Conversation

@assert6
Copy link
Copy Markdown
Member

@assert6 assert6 commented Apr 25, 2021

No description provided.

if (is_array($traitNames)) {
foreach ($traitNames ?? [] as $traitName) {
$traitProperties = ReflectionManager::reflectPropertyNames($traitName);
$recursiveTrait = function (\ReflectionClass $reflectionClass, array $handled) use (&$recursiveTrait, $className) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这一坨改成__handleTrait吧。。。

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

又占用一个方法啊🤣

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没办法。。。这个写法太奇怪了。。。

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trait能 A use B然后B use A么?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不行, 扫描就卡住了

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我是说php语法支持这种写法么

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好像不是你说的 那样 ,只是Trait use A A有个类初始化 然后代理类 没有反射出来Trait use A 里的 类初始化 __construst()

@limingxinleo limingxinleo changed the title fixed trait nesting does not work Fixed @Inject does not works in nested trait. Apr 25, 2021
@limingxinleo limingxinleo merged commit b751c00 into hyperf:master Apr 25, 2021
@assert6 assert6 deleted the trait_nesting branch June 2, 2021 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants