-
-
Notifications
You must be signed in to change notification settings - Fork 197
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
Enforce PSR-12 and organise imports on Winter CMS core files #1188
Draft
bennothommo
wants to merge
32
commits into
develop
Choose a base branch
from
fix/psr-12
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit changes the PHP code sniffer to use PSR-12 rules, as that ruleset will pick up a lot of the code style issues being flagged in PRs recently. In order to set the baseline, all current core files have been reformatted to fit the ruleset.
- Convert all aliases to qualified class names (mainly facades) - Reorder imports alphabetically - Ensure last item in array has a trailing comma - Strip out unused imports
bennothommo
changed the title
Enforce PSR-12 on Winter CMS core files
Enforce PSR-12 and organise imports on Winter CMS core files
Aug 23, 2024
LukeTowers
reviewed
Aug 23, 2024
LukeTowers
reviewed
Aug 23, 2024
LukeTowers
reviewed
Aug 23, 2024
LukeTowers
reviewed
Aug 23, 2024
LukeTowers
reviewed
Aug 23, 2024
LukeTowers
reviewed
Aug 23, 2024
LukeTowers
reviewed
Aug 23, 2024
LukeTowers
reviewed
Aug 23, 2024
This comment was marked as outdated.
This comment was marked as outdated.
This will allow us to use the ruleset in plugins as well
With new ruleset, it now passes
This command will allow developers to check code style against the Winter CMS code style rules in both the core and installed plugins.
LukeTowers
reviewed
Sep 4, 2024
bennothommo
added
enhancement
PRs that implement a new feature or substantial change
and removed
Status: In Progress
labels
Oct 11, 2024
LukeTowers
reviewed
Dec 7, 2024
LukeTowers
reviewed
Dec 7, 2024
Initial thoughts from testing on a client project: Problems:
Coding style suggestions:
Enhancement Ideas
To test
|
The core phpcs.xml is only relevant to core development, not projects using Winter. Running winter:sniff without a config file present will auto generate one from the stubs in the system module.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit changes the PHP code sniffer to use PSR-12 rules, as that ruleset will pick up a lot of the code style issues being flagged in PRs recently.
In order to set the baseline, all current core files have been reformatted to fit the ruleset.
I have also implemented rules around imports in files - mainly, taking out the aliases and using qualified facades and class names, and stripping out unused imports. This will improve IDE support for PHP intelligence and code completion.
Arrays are also now enforced to have a trailing comma to improve diffs.
Sorry in advance for the code review... 😬
php artisan winter:phpcs
command