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

Fix sort different array keys #202

Merged
merged 2 commits into from
Aug 9, 2023
Merged

Fix sort different array keys #202

merged 2 commits into from
Aug 9, 2023

Conversation

PNixx
Copy link

@PNixx PNixx commented Aug 2, 2023

No description provided.

@sanmai sanmai self-requested a review August 2, 2023 07:18
@@ -18,7 +18,7 @@
*/
class StandardFilters
{

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please revert this change/

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't. PHPStorm auto fixing it before commit.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you at least add another test please?

);
$expected = array(
array('a' => 50),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add another test. We need to be sure it is not a BC break (when existing tests work as before).

Copy link
Collaborator

@sanmai sanmai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to merge this once these two problems are addressed.

@sanmai sanmai merged commit c76f0b8 into kalimatas:master Aug 9, 2023
6 checks passed
@PATROMO
Copy link

PATROMO commented Dec 28, 2023

@sanmai @PNixx What was fixed here? This is a BC.
$a[$property] ?? 0 <-- Why int zero?
What will happen if this is compared with -1 ?
Check this: https://3v4l.org/O4vOC

I would also recommend using <=>

If you want fix Warning: Undefined array key "..." in then I would recommend to use $a[$property] ?? null for non-BC!

@PATROMO
Copy link

PATROMO commented Dec 28, 2023

return $a[$property] ?? null <=> $b[$property] ?? null;

@PATROMO
Copy link

PATROMO commented Jan 9, 2024

@sanmai @PNixx why you ignore me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants