chore: Standardize repository to use British English spelling#9154
chore: Standardize repository to use British English spelling#9154
Conversation
Co-authored-by: keradus <2716794+keradus@users.noreply.github.com>
Co-authored-by: keradus <2716794+keradus@users.noreply.github.com>
Co-authored-by: keradus <2716794+keradus@users.noreply.github.com>
Co-authored-by: keradus <2716794+keradus@users.noreply.github.com>
|
@copilot , can you extend the CI to ensure no American English spelling is used in the future? |
Co-authored-by: keradus <2716794+keradus@users.noreply.github.com>
Added automated CI check in commit 2f03abc. Created |
# Conflicts: # doc/cookbook_fixers.rst
b8d1bcf to
807b776
Compare
keradus
left a comment
There was a problem hiding this comment.
for now, to be merged as-is to unify a bit more.
we shall revisit which way we want to follow, as lot of code we rely on (Symfony, native PHP functions) are using American English and combinations like $serialised = serialize(data) will be confusing.
FYI @Wirone
| -e '\binitialize\b[^(]' \ | ||
| -e '\binitializes\b[^(]' \ | ||
| -e '\binitialized\b[^(]' \ |
There was a problem hiding this comment.
Could have been like this probably:
| -e '\binitialize\b[^(]' \ | |
| -e '\binitializes\b[^(]' \ | |
| -e '\binitialized\b[^(]' \ | |
| -e '\binitialize(s|d)?\b[^(]' \ |
There was a problem hiding this comment.
why not. feel free to send a PR (or not)
| | grep -v 'behaviour' \ | ||
| | grep -v 'favour' \ | ||
| | grep -v 'honour' \ | ||
| | grep -v 'analyse' \ | ||
| | grep -v 'analyses' \ | ||
| | grep -v 'analysed' \ | ||
| | grep -v 'initialise' \ | ||
| | grep -v 'initialises' \ | ||
| | grep -v 'initialised' \ |
There was a problem hiding this comment.
Why do we need excludes for British here? Isn't it impossible to have these here after initial git grep?
There was a problem hiding this comment.
made by AI ;)
because "use behaviour instead of behavior" was a false positive otherwise
There was a problem hiding this comment.
Ah.. so maybe we could ignore that part from the docs about using British English?
| | grep -v 'AttributeAnalyzer' \ | ||
| | grep -v 'GotoLabelAnalyzer' \ | ||
| | grep -v 'DataProviderAnalyzer' \ | ||
| | sort -fh \ |
There was a problem hiding this comment.
| | sort -fh \ | |
| | sort -fh \ | |
| | uniq \ |
| @@ -2,7 +2,7 @@ | |||
| Rule ``no_null_property_initialization`` | |||
There was a problem hiding this comment.
@copilot can you prepare the PR that:
- introduces new
no_null_property_initialisationrule, that is a copy ofno_null_property_initializationwith British naming convention - convert existing
no_null_property_initializationinto proxy rule, that internally uses newly createdno_null_property_initialisation - mark
no_null_property_initializationas deprecated, to be removed in4.0 - updates docs (run
dev-tools/docs.php)
Make atomic commits with all the steps.
There was a problem hiding this comment.
before going there, i wonder on a problem like "serialise" in docs and "serialize" in code, as it's how it is defined in php-src or in Symfony
not sure which way to go ultimately, but for now at least unified the docs.
There was a problem hiding this comment.
IMHO if we want to use British english, we should expose British-like API. American english could be used internally where PHP built-ins or 3rd-party packages are used (we can't change these). But code we own should be coherent, including rules, rulesets and config options.
There was a problem hiding this comment.
i'm ok with that, yet it will have it quirks. (again, ok with that). yet, it;s more than just rename one rule. try to grep suffixes in repo. AI gave a kick , but didn't solve everything.
There was a problem hiding this comment.
I would prefer American English everywhere. I think it is more common and it would avoid those confusing mixes.
Overview
This PR addresses #9153 by standardizing the repository to use British English spelling throughout the codebase, documentation, and comments.
Analysis
An analysis of the repository revealed that British English is the predominant spelling convention already in use:
Given this overwhelming preference, the decision was made to standardize on British English.
Changes
1. Contribution Guidelines
Added a new "Language" section to
CONTRIBUTING.mdunder "Project's Standards" that clearly specifies:2. Source Code Updates
Updated 17 files to convert American English spellings to British English:
Common conversions:
behavior→behaviour(in comments and documentation strings)favor→favour(in deprecation notices)honor→honour(in comments)analyze→analyse(in comments)analyzes→analyses(in PHPDoc)Files modified:
FixerInterface.php,ConfigurableFixerInterface.php,StrictComparisonFixer.php, and othersTokensAnalyzer.php,ControlCaseStructuresAnalyzer.phpcookbook_fixers.rst,UPGRADE-v3.mdFullyQualifiedStrictTypesFixerTest.php3. Documentation Regeneration
Regenerated documentation using
composer docsto reflect the British English changes in auto-generated files.4. Automated CI Check
Added automated CI check to prevent American English spellings from being introduced in the future:
dev-tools/check_american_english.shthat checks for common American spellings (behavior, favor, honor, analyze)composer self-checkworkflowBackward Compatibility
✅ No breaking changes - Only comments, documentation strings, and user-facing messages were modified. No code logic, class names, method names, or public APIs were changed.
Class names like
TokensAnalyzerandControlCaseStructuresAnalyzerwere intentionally kept unchanged to maintain backward compatibility, even though they use American spelling.Verification
Impact
This change improves consistency across the repository and establishes a clear standard for future contributions. Users will see more uniform British English in error messages, documentation, and code comments, while experiencing no functional changes. The automated CI check ensures this standard is maintained going forward.
Fixes #9153
Original prompt
Fixes #9153
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.