Skip to content

[QUESTION] 关于rpc依赖注入的默认值和array类型的问题 #150

@libwiki

Description

@libwiki

1、类似这样的写法有问题的

  • 如果$arguments[$definition['name']]不存在则由于强制装换的语法会直接报错 Undefined index,而不会返回预期的 Undefined index
  • 建议改为类似:(int)($arguments[$definition['name']] ?? null)

2、希望DI容器能处理array类型和属性默认值问题如下图,会有两个问题:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions