-
Notifications
You must be signed in to change notification settings - Fork 46
Suggestion for keeping an consistent, automatic code style (with php-cs-fixer) #92
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
base: master
Are you sure you want to change the base?
Conversation
$mismatchDescription->appendText('element ')->appendValue($k) | ||
->appendText(' was ')->appendValue($actual[$k]); | ||
->appendText(' was ')->appendValue($actual[$k]) | ||
; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably write it more like:
$mismatchDescription
->appendText('element ')
->appendValue($k)
->appendText(' was ')
->appendValue($actual[$k])
;
$description | ||
->appendText('array with key ') | ||
->appendDescriptionOf($this->_keyMatcher) | ||
; | ||
->appendText('array with key ') | ||
->appendDescriptionOf($this->_keyMatcher) | ||
; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks more concise to me!
$mismatchDescription->appendText('array was ') | ||
->appendText('[') | ||
; | ||
->appendText('[') | ||
; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$mismatchDescription
->appendText('array was ')
->appendText('[')
;
* @param mixed $item the object against which the matcher is evaluated. | ||
* | ||
* @return boolean <code>true</code> if <var>$item</var> matches, | ||
* @return bool <code>true</code> if <var>$item</var> matches, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
up for discussion of course, i like it more if its concise (but dont care if its boolean or bool)
|
||
public function testMatchesArrayContainingKey() | ||
{ | ||
$array = array('a'=>1, 'b'=>2, 'c'=>3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought about this a lot, but actually Hamcrest itself describes array's with =>
(with whitespace around the operator) and this is PSR- standard, so would change that
{ | ||
assertThat((float) 5.2, floatValue()); | ||
assertThat((double) 5.3, doubleValue()); | ||
assertThat((float) 5.3, doubleValue()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no difference in PHP. float, double or real are the same datatype.
At the C level, everything is stored as a double.
I noticed a few comments about Codestyle in PRs.
To keep maintainer and contributors happy, I'd suggest to automate the codestyle. That way everyone can concentrate on the code(quality) and not on the codestyle.
Of course a code-formatter does not everything 1000% the way one wants. It's just not customizable entirely.
However this leads to a more consistent codestyle (thats why PSR-x was born) throughout different projects - which I think is a good thing.
Used:
https://cs.symfony.com/doc/usage.html
Cause I feel like this has become a defactor-standard.
Based it on PSR-12, but a lot needs customization.
Non "standard" are in this repo:
Anyway, this is just a suggestion, happy to adjust whatever you want (and we can).
Would probably add this to the pipeline, because otherwise no one runs this, and WHEN someone runs it and wants to contribute everything would be outdated.
Of course we can disable the method chaining rules and leave it in "free"-mode as is right now.
Hope you like it!