GuavaCZ / filament-knowledge-base

MIT License
144 stars 21 forks source link

[Bug]: #28

Closed ainesophaur closed 5 months ago

ainesophaur commented 5 months ago

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

lukas-frey commented 5 months ago

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

github-actions[bot] commented 5 months ago

:tada: This issue has been resolved in version 1.7.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: