Skip to content

Always generate fatal error for LSP failures #4000

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

Closed
wants to merge 1 commit into from

Conversation

nikic
Copy link
Member

@nikic nikic commented Mar 28, 2019

RFC: https://wiki.php.net/rfc/lsp_errors

When a method signature (LSP) check during inheritance fails, always generate a fatal compile error. Previously, this generated either a warning or a fatal error based on the following rules:

  • If the method signatures have an incompatible return type, generate a fatal error.
  • If the prototype of the method is abstract (or part of an interface), generate a fatal error.
  • Otherwise, generate a warning. Prior to PHP 7.0 a strict standards warnings was generated.

This change removes the distinction between abstract and non-abstract methods and always generates a fatal error.

@nikic nikic added the RFC label Mar 28, 2019
@nikic nikic force-pushed the inheritance-error branch from 214943d to bc1eaaf Compare March 28, 2019 13:33
Class D extends C { function f(array $a) {} }
?>
==DONE==
--EXPECTF--
Warning: Declaration of D::f(array $a) should be compatible with C::f($a) in %s on line 5
Array hint, should be nothing.
==DONE==
Copy link
Contributor

@morrisonlevi morrisonlevi Apr 8, 2019

Choose a reason for hiding this comment

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

The ==DONE== looks like it was removed from expected text, but not from the program.

@nikic
Copy link
Member Author

nikic commented May 7, 2019

Merged as fd2db11 into master, with a few more "done" messages dropped per Levi's comment.

@nikic nikic closed this May 7, 2019
@carusogabriel carusogabriel added this to the PHP 8.0 milestone May 30, 2020
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.

3 participants