GuavaCZ/filament-knowledge-base

[Bug]:

Closed this issue ยท 2 comments

What happened?

I've noticed a warning in my console after adding this package package

uasort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero in ...Collection.php on line 1412

I narrowed it down to the sorting logic in KnowledgeBasePanel.php#L243 and KnowledgeBasePanel.php#L279 returning booleans instead of the expected sorting values of -1,0 or 1.

Changing the comparison to the spaceship operator resolves this issue

->sort(fn (Documentable $d1, Documentable $d2) => $d1->getOrder() <=> $d2->getOrder())

I would be happy to open a PR if desired.

How to reproduce the bug

Nothing special should be required

Package Version

1.6.0

PHP Version

8.3.8

Laravel Version

11.11.0

Which operating systems does with happen with?

No response

Notes

No response

Hi Travis, thanks for the report! I'll gladly accept a PR. :)

๐ŸŽ‰ This issue has been resolved in version 1.7.0 ๐ŸŽ‰

The release is available on GitHub release

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€