Skip to content

feat: sort imports alphabetically and shorten names resolvable by imports - #14

Merged
roxblnfk merged 1 commit into
masterfrom
feat/ordered-imports-fqst
Oct 9, 2026
Merged

roxblnfk merged 1 commit into
masterfrom
feat/ordered-imports-fqst

Conversation

@roxblnfk

@roxblnfk roxblnfk commented Oct 9, 2026

Copy link
Copy Markdown
Member

What was changed

  • use statements are now sorted alphabetically within the class / function / const groups (ordered_imports); @PER-CS2x0 only groups them and keeps the written order.
  • fully_qualified_strict_types: a fully qualified name is shortened when it is already imported or belongs to the current namespace, in code and in simple PHPDoc tags. The leading backslash in the global namespace is kept, so configs like .php-cs-fixer.dist.php (\Spiral\CodeStyle\Builder::create()) are not touched.
  • Projects using the preset get import-order and FQCN-shortening diffs on the next cs:fix run; on roadrunner-php/worker it is a single swapped import.

Why?

The rules were proposed as local overrides in roadrunner-php/version-checker#11 and belong in the shared preset.

Checklist

  • Tested
    • Tested manually: preset applied to roadrunner-php/worker and roadrunner-php/version-checker sources
    • Unit tests added: an acceptance test fixes an unstyled stub and compares it with the styled one

…orts

The rules were proposed for roadrunner-php/version-checker#11 and belong to the shared preset. `fully_qualified_strict_types` keeps the leading backslash in the global namespace so configs like `.php-cs-fixer.dist.php` stay as they are.

Co-authored-by: Владислав Новиков <v.novikov@qsoft.ru>
Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
@roxblnfk
roxblnfk merged commit 75aacad into master Oct 9, 2026
4 of 6 checks passed
@roxblnfk
roxblnfk deleted the feat/ordered-imports-fqst branch October 9, 2026 20:30
@roxblnfk roxblnfk mentioned this pull request Oct 9, 2026
2 tasks
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