Skip to content

Simplify max-tile histogram counting in movefeed - #11

Open
mmiermans wants to merge 1 commit into
exp/mozilla-basefrom
exp/mz-clean
Open

Simplify max-tile histogram counting in movefeed#11
mmiermans wants to merge 1 commit into
exp/mozilla-basefrom
exp/mz-clean

Conversation

@mmiermans

Copy link
Copy Markdown
Owner

Small readability cleanup in the move feed endpoint.

The max-tile statistics counter used a four-line isset/else block to increment per-tile counts. This replaces it with the null-coalescing operator so the intent (a histogram increment) reads in a single line, and switches the scoreStats accumulation from array_push() to the [] append shorthand for consistency with the rest of the file.

No behavior change — purely a refactor.

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
🤖 Claude has reviewed this PR — expand after forming your own opinion

Clean, minimal refactor. Both changes are idiomatic PHP improvements.

Null-coalescing histogram increment (line 41) — Good. The ?? operator is the idiomatic way to express this in PHP 7+, and it correctly preserves the semantics of the original isset/else block.

$scoreStats[] shorthand (line 43) — Good. [] is preferred over array_push() for single-element appends (avoids function-call overhead and is the more common PHP idiom).

Minor note on consistency: The PR description mentions the [] change is "for consistency with the rest of the file," but the move-feed section below (lines 84-90) still uses array_push() throughout. This is fine as-is — those calls append to a different structure in a different logical block — but if you do want full consistency, those could be converted in a follow-up.

No security, performance, testing, or documentation concerns. The changes are behavior-preserving and the PR description accurately captures the intent.

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.

1 participant