Skip to content

Conversation

pmmaga
Copy link
Contributor

@pmmaga pmmaga commented Feb 1, 2017

After #2342, an LSP violation over the number of required parameters was promoted to a Fatal Error if the parent implements an interface or abstract.

This PR fixes that behaviour.

@nikic nikic self-requested a review February 1, 2017 18:29
@pmmaga
Copy link
Contributor Author

pmmaga commented Feb 1, 2017

Travis failure seems unrelated.

@krakjoe krakjoe added the Bug label Feb 1, 2017
if (child->common.prototype && (
child->common.prototype->common.fn_flags & ZEND_ACC_ABSTRACT
)) {
if (parent->common.fn_flags & ZEND_ACC_ABSTRACT) {
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't look quite right to me. Doesn't think mean that if B extends A implements I, and B violates I (and not just A), then you will only get a warning, rather than a fatal error?

Copy link
Contributor

Choose a reason for hiding this comment

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

If B extends A implements I and B violates I then you should get a fatal. The whole goal is to eventually fatal for all incompatibilties. The only reason I can see to not give a fatal is if we previously didn't fatal, in which case it should probably wait until 8.0.

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 see, so basically this test should still fatal. Correct?

Copy link
Member

Choose a reason for hiding this comment

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

@pmmaga Correct. However I don't see a great way of implementing that, short of going two LSP checks, one against the interface and one against the class. Not sure if we want to do that...

@pmmaga
Copy link
Contributor Author

pmmaga commented Feb 1, 2017

This PR would demote any incompatibility with interfaces to a Warning if this interface was implemented by the parent of the current method. This is not the desired effect and the original behavior is preferred.

@pmmaga pmmaga closed this Feb 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants