-
Notifications
You must be signed in to change notification settings - Fork 59
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
Add contravariant test which fails due to missing in the from part #702
base: 8.2.x
Are you sure you want to change the base?
Add contravariant test which fails due to missing in the from part #702
Conversation
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.
Let's reduce this further to a test case around
BackwardCompatibilityCheck/test/unit/DetectChanges/Variance/TypeIsContravariantTest.php
Line 28 in e5bd16a
final class TypeIsContravariantTest extends TestCase |
interface A extends B {} | ||
interface B {} |
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.
The naming in this test makes things a bit complex to follow.
Let's rename A
and B
to make the sorting more clear instead.
B
used in both examples as "child interface".
Weird, this should work: interface ParentInterface {}
interface ChildInterface extends ParentInterface {} 'interface to parent interface is contravariant (2)' => [
new Identifier('ChildInterface'),
new Identifier('ParentInterface'),
true,
],
'interface to child interface is contravariant (2)' => [
new Identifier('ParentInterface'),
new Identifier('ChildInterface'),
false,
], Possibly just a swapped conditional in the code? |
I think the logic in So i assume if I split my PR mentioned into 2 PR's would not result in a failing CI. So the two PR's would be:
From this point i think, if we want support this, we would need to adjust |
I see, so that's what the test is picking up. Can we please represent that in a test case around |
So i added now a testcase for With the 2 codebases and one missing the crucial classes we cannot easily perform an |
We could build our own Would need to get all parent interfaces, turn them to a |
Yeah we could check this on this basis, if we can retrieve all child interfaces / classes of |
Would need to build an in-memory representation of the inheritance tree in both versions, then compare the two trees :) |
We have a situation right now where we want to enable the use to use the psr-20 clock interface. Beforehand we already introduced our own
ClockInterface
with the exact api the psr-20 one would have. And now, since it was released, we wanted to get rid of our own interface from our internal code but still providing it. So our interface now extends from the psr-20 one and we changed a signature which required our interface to the new psr-20 interface. In my opinion this should be ok, since the old interface is still allowed.I provided a TestCase here to reproduce this. Also here as ref the PR where we want to achieve this: patchlevel/event-sourcing#334