Skip to content
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

15 php cs fixer issues #16

Merged
merged 8 commits into from
Apr 8, 2016
Merged

15 php cs fixer issues #16

merged 8 commits into from
Apr 8, 2016

Conversation

badams
Copy link
Contributor

@badams badams commented Apr 8, 2016

#15 Adding php-cs-fixer config, and changes from running said config

$finder = Symfony\CS\Finder\DefaultFinder::create()
->in(__DIR__);

$fixers = array(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I haven't checked myself yet, but does this custom list cover PSR2? I just would like Yasumi to be PSR2 compliant. Any additional ones are fine to me, but not mandatory.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the PR and looking good! Mostly it is formatting/style corrections. However seems these are not necessarily PSR2 corrections, but nonetheless good. Let me merge it this weekend, as I want to check a few little things more

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess its a starting point, having the config in place means this can eventually be formalized, and the php-cs-fixer checks can be added to travis once that is done.

There are a lot of formatting changes in this PR - I didn't even manage to review them all.

I've just been looking over the PSRs, and Fixers defined for them and this config still includes a lot of symfony cs fixers. I might revert the previous commit and re-run php-cs-fixer with only the PSR based fixers.

@badams
Copy link
Contributor Author

badams commented Apr 8, 2016

@stelgenhof I think I'm happy with this now :)

To summarize the changes in this PR

  • I adjusted the list to only include PSR based fixers
  • I've also added a shortcut command to composer composer php-cs-fixer which runs the fixers.
  • I've php-cs-fixer now also runs on the CI server, meaning PRs will need to be PSR2 compliant before they can be merged.

@badams
Copy link
Contributor Author

badams commented Apr 8, 2016

Also, a note about the tests directory and namespaces, it appears to be part of PSR4

The contiguous sub-namespace names after the "namespace prefix" correspond to a subdirectory within a "base directory", in which the namespace separators represent directory separators. The subdirectory name MUST match the case of the sub-namespace names.

Which is a requirement of PSR2 as far as I understand it

@stelgenhof
Copy link
Member

I think the contiguous sub-namespace requirements was the culprit I believe. Let me check once more and merge your PR

@stelgenhof
Copy link
Member

Would you mind changing the "tests" folder back to uppercase? I prefer the sub-namespaces to be consistent. If not, I can do it after merging the PR :)

As for - ./vendor/bin/php-cs-fixer --diff --dry-run -v fix, you said it will run on the CI server however this is just a dry-run. Any reason for that?

@badams
Copy link
Contributor Author

badams commented Apr 8, 2016

@stelgenhof would you want to change the actual directory from tests to Tests? at least that way it does align still align with PSR4 (rather than just the namespace)

Regarding the dry-run, it means it wont be changing the files just determining if any files do not meet the cs requirements. The output looks more like phpunit:

$ ./vendor/bin/php-cs-fixer --diff --dry-run -v fix

Loaded config from "/home/travis/build/azuyalabs/yasumi/.php_cs"

......................................................................................................................................................................................................................................................................................................................................................

Legend: ?-unknown, I-invalid file syntax, file ignored, .-no changes, F-fixed, E-error

Checked all files in 15.168 seconds, 9.000 MB memory used

If any files do not pass, the build fails

@stelgenhof
Copy link
Member

Ah indeed. Then I would leave it as you did. No need to change. I will merge it

@badams
Copy link
Contributor Author

badams commented Apr 8, 2016

Alright, go ahead. I'll need to update my other pull request to meet the new CS requirements :)

@stelgenhof stelgenhof merged commit 0c46979 into azuyalabs:master Apr 8, 2016
@stelgenhof stelgenhof mentioned this pull request Apr 8, 2016
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.

2 participants