Skip to content

Always generate fatal error for LSP failures#4000

Closed
nikic wants to merge 1 commit into
php:masterfrom
nikic:inheritance-error
Closed

Always generate fatal error for LSP failures#4000
nikic wants to merge 1 commit into
php:masterfrom
nikic:inheritance-error

Conversation

@nikic

@nikic nikic commented Mar 28, 2019

Copy link
Copy Markdown
Member

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
--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==

@morrisonlevi morrisonlevi Apr 8, 2019

Copy link
Copy Markdown
Contributor

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

nikic commented May 7, 2019

Copy link
Copy Markdown
Member Author

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