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

Discussion: Consider using PHP CS Fixer and/or PHPStan #947

Closed
colinmollenhour opened this issue May 4, 2020 · 4 comments · Fixed by #2744
Closed

Discussion: Consider using PHP CS Fixer and/or PHPStan #947

colinmollenhour opened this issue May 4, 2020 · 4 comments · Fixed by #2744
Labels
Cleanup: Code style Related to simple CS fixes. Cleanup: DOC blocks Related to DOC block updates and fixes.

Comments

@colinmollenhour
Copy link
Member

colinmollenhour commented May 4, 2020

  • Initially run CS Fixer to update all code to conform to a standard
  • Add Travis pipeline or Github Action to throw error when CS Fixer output is different from pushed code (showing diff)

#693 (comment)
#365

@colinmollenhour
Copy link
Member Author

@sreichel What are the pros/cons of PHP CS Fixer and PHPStan and are they completely redundant?

@colinmollenhour colinmollenhour changed the title Consider using PHP CS Fixer Discussion: Consider using PHP CS Fixer and/or PHPStan May 4, 2020
@tmotyl
Copy link
Contributor

tmotyl commented May 5, 2020

Php fixer just take care of CGL and can fix the formatting. While phpstan does static code analysis but cant fix code.

So we need both :)

@tmotyl tmotyl added Cleanup: DOC blocks Related to DOC block updates and fixes. Cleanup: Code style Related to simple CS fixes. labels May 5, 2020
@sreichel
Copy link
Contributor

sreichel commented May 6, 2020

@sreichel What are the pros/cons of PHP CS Fixer and PHPStan and are they completely redundant?

As @tmotyl said. No, they aren't redundant.

IMHO cs-fixer is "just" a nice to have to have code matching PSR2 standard or whatever. phpstan/psalm is to prevent logical problems .... can't find it actually, but there was a nice article about predicted or expected variables ....

@kkrieger85
Copy link
Contributor

+1 for phpcsfixer for PSR2
php php-cs-fixer.phar fix /path/to/project --rules=@PSR2

This could also improve to review PR like #1035 and all other PR consider code style

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cleanup: Code style Related to simple CS fixes. Cleanup: DOC blocks Related to DOC block updates and fixes.
Projects
None yet
4 participants