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

OrderedInterfacesFixer - Introduction #4113

Merged
merged 1 commit into from Mar 19, 2019

Conversation

dmvdbrugge
Copy link
Contributor

Fixes #4108

Copy link
Member

@julienfalque julienfalque left a comment

Choose a reason for hiding this comment

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

Great stuff 👍

src/Fixer/ClassNotation/OrderedImplementsFixer.php Outdated Show resolved Hide resolved
src/Fixer/ClassNotation/OrderedImplementsFixer.php Outdated Show resolved Hide resolved
@julienfalque julienfalque added this to the 2.14.0 milestone Nov 24, 2018
@SpacePossum SpacePossum changed the title Add OrderedImplementsFixer OrderedImplementsFixer - Introduction Dec 4, 2018
README.rst Outdated Show resolved Hide resolved
@dmvdbrugge dmvdbrugge changed the title OrderedImplementsFixer - Introduction OrderedInterfacesFixer - Introduction Dec 10, 2018
@keradus keradus changed the title OrderedInterfacesFixer - Introduction Add OrderedInterfacesFixer Dec 31, 2018
@keradus
Copy link
Member

keradus commented Dec 31, 2018

I let myself resolve the conflicts, readme was not regenerated after changes

@keradus keradus added RTM Ready To Merge and removed RTM Ready To Merge labels Dec 31, 2018
@keradus keradus modified the milestones: 2.14.0, 2.15.0 Dec 31, 2018
Copy link
Member

@keradus keradus left a comment

Choose a reason for hiding this comment

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

This rule is not safe.
I tried to apply it to our own codebase:

ker@dus:~/github/PHP-CS-Fixer λ git ds src/AbstractFixer.php
diff --git a/src/AbstractFixer.php b/src/AbstractFixer.php
index 44a07d83..af0cb1da 100644
--- a/src/AbstractFixer.php
+++ b/src/AbstractFixer.php
@@ -33,7 +33,7 @@
  *
  * @internal
  */
-abstract class AbstractFixer implements FixerInterface, DefinedFixerInterface
+abstract class AbstractFixer implements DefinedFixerInterface, FixerInterface
 {
ker@dus:~/github/PHP-CS-Fixer λ vendor/bin/phpunit 
PHP Fatal error:  Class PhpCsFixer\AbstractFixer cannot implement previously implemented interface PhpCsFixer\Fixer\FixerInterface in /home/d.ruminski/github/PHP-CS-Fixer/src/AbstractFixer.php on line 36

It has to at least be marked as risky

@dmvdbrugge
Copy link
Contributor Author

I will mark as risky. However, in the case of our own code base, isn't it bad practise anyway to have this interface-duplication? I mean, DefinedFixerInterface extends FixerInterface, why implements them both? (Also: why does php break one way but not the other? Strange...)

@SpacePossum SpacePossum changed the title Add OrderedInterfacesFixer OrderedInterfacesFixer - Introduction Jan 7, 2019
@SpacePossum
Copy link
Contributor

SpacePossum commented Jan 7, 2019

isn't it bad practise anyway to have this interface-duplication?

it doesn't harm to be explicit, it could also be because it makes merging over the various branches more easy, but maybe it is (indeed) overcomplete and can be cleaned up some day in another PR

why does php break one way but not the other? Strange...

I have no idea, it really puzzles me!, sadly it does break, so please update to be risky

@keradus
Copy link
Member

keradus commented Jan 7, 2019

I wouldn't consider it a bad idea. If you want to implement interfaces A and B, you may not know, not control, or even not care internal detail that B also implement A under the hood. Yet, this rule can break the code in current PHP engine, so we need risky flag with good explanation to the user why is it so.

@dmvdbrugge
Copy link
Contributor Author

@keradus all changes have been processed (like, 3 months ago 😜) could you update your review?

@SpacePossum
Copy link
Contributor

Thank you @dmvdbrugge.

@SpacePossum SpacePossum merged commit cbc655a into PHP-CS-Fixer:master Mar 19, 2019
SpacePossum added a commit that referenced this pull request Mar 19, 2019
This PR was squashed before being merged into the 2.15-dev branch (closes #4113).

Discussion
----------

OrderedInterfacesFixer - Introduction

Fixes #4108

Commits
-------

cbc655a OrderedInterfacesFixer - Introduction
@keradus
Copy link
Member

keradus commented May 3, 2019

all changes have been processed (like, 3 months ago stuck_out_tongue_winking_eye) could you update your review?

post mortem, @dmvdbrugge - pushing fixes to PR doesn't mark the PR as changed for repo maintainer (or at least to me). without new comment (!= commit), it's hard to notice that sth changed

@dmvdbrugge dmvdbrugge deleted the 4108-ordered_implements branch May 9, 2019 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants