Docblocks indicate `Navi->items` should be array but can be null
Closed this issue · 0 comments
thunderdw commented
Hi, thanks for the package!
Noticed a very minor issue. The docblocks for Log1x\Navi\Navi->items
indicate that the property should be an array, and instantiates it as an array.
When you build a menu (new Navi())->build('menu_name')
, if that menu doesn't have items, the builder function returns void
instead and items
is set to null. See line 66 below:
Lines 56 to 73 in 555653b
I could see two approaches:
- Updating the docblocks for
Navi->items
(and related functions likeNavi->toArray()
andMenuBuilder->build()
) to indicate that the value can benull
, or: - Updating
MenuBuilder->build()
line 66 toreturn []
instead ofreturn
The latter option seems to make more sense to me but is potentially a breaking change if anyone is using strict comparison for null checking, e.g. Navi->toArray() === null
or Navi->getItems() === null
Happy to submit a PR if there's a preferred approach.