Skip to content

Keep Sort::fromExpression() within the cognitive complexity limit. - #19

Merged
gustavofreze merged 1 commit into
mainfrom
refactor/reduce-sort-complexity
Nov 7, 2026
Merged

gustavofreze merged 1 commit into
mainfrom
refactor/reduce-sort-complexity

Conversation

@gustavofreze

Copy link
Copy Markdown
Member

Please follow the contributing guidelines.

Summary

  • slevomat/coding-standard 8.31.3, resolved by any fresh install, reports a cognitive complexity of 7 for Sort::fromExpression(), above the limit of 5, so make review fails on main. The method is unchanged since 1.0.0 and passed under 8.31.1.
  • Moves the parsing of a single sort token (leading minus, field validation, direction) from the closure inside Sort::fromExpression() into the internal value object Internal\SortToken. Sort::fromExpression() keeps only the empty-expression guard and the mapping.
  • No behavior change and no public API change: SortToken lives in src/Internal/, the existing tests pass unchanged, and the ruleset is untouched.

Release

Recommended release: patch (no behavior change).

This unblocks #18 (chore/require-http-8), whose auto-review job fails on the same finding.

Related issue

None.

Checklist

  • Tests added or updated.
  • Documentation updated when applicable.
  • make review passes.
  • make tests passes.

Keeps the cognitive complexity of Sort::fromExpression() within the ruleset limit
reported by slevomat/coding-standard 8.31.3. No behavior or public API change.
@gustavofreze
gustavofreze merged commit c7ffcbf into main Nov 7, 2026
5 checks passed
@gustavofreze
gustavofreze deleted the refactor/reduce-sort-complexity branch November 7, 2026 11:50
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