Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复中间件传参解析冲突 #282

Merged
merged 1 commit into from
Feb 8, 2023
Merged

Conversation

sunxyw
Copy link
Member

@sunxyw sunxyw commented Feb 8, 2023

No description provided.

@sunxyw sunxyw added the bug 意外行为或意外问题 label Feb 8, 2023
@sunxyw sunxyw force-pushed the fix-middleware-args-passing branch from d0396c7 to 6794e7f Compare February 8, 2023 08:04
@sunxyw sunxyw requested a review from crazywhalecc February 8, 2023 08:06
@crazywhalecc
Copy link
Member

是不是意思就是,已经绑定的对象,不能再次在 call 时传入相同的对象?

@sunxyw
Copy link
Member Author

sunxyw commented Feb 8, 2023

是不是意思就是,已经绑定的对象,不能再次在 call 时传入相同的对象?

实际上是尽量避免以数字索引作为参数,因为我们没法约束用户获取参数的顺序,但因为 Pipeline 的实现不支持传入关联数组,所以建议仅传入必要的参数,一些本身已经绑定到容器的实例就没必要重复传入,因为可以直接从容器中解析。

另一类比如路由的 $params,就只能继续传入,但这样带来的问题就是方法定义的参数必须依据传入的顺序,即 $params 参数必须为第一个。

换言之,如果在调用处理时传入了参数,则监听该事件的方法也必须以相同的顺序接受参数。

@sunxyw sunxyw merged commit 8f65e5a into main Feb 8, 2023
@sunxyw sunxyw deleted the fix-middleware-args-passing branch February 8, 2023 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 意外行为或意外问题
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants