rfc:never_for_parameter_types

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
rfc:never_for_parameter_types [2021/08/15 07:41] – formatting fix jordanrlrfc:never_for_parameter_types [2021/08/17 12:33] – argument -> parameter jordanrl
Line 7: Line 7:
  
 ===== Introduction ===== ===== Introduction =====
-Arguments in PHP are contravariant to preserve Liskov substitution. This means that if class B extends class A, then redefines a function call, the entire type of that argument from class A must be present in the type of the argument in class B:+Parameters in PHP are contravariant to preserve Liskov substitution. This means that if class B extends class A, then redefines a function call, the entire type of that parameter from class A must be present in the type of the parameter in class B:
  
 <code php> <code php>
Line 27: Line 27:
 </code> </code>
  
-Thus, the more specific a type is for an argument in a base class, the more broad it can be in an extending class with the requirement that it must also include the type from the base class.+Thus, the more specific a type is for an parameter in a base class, the more broad it can be in an extending class with the requirement that it must also include the type from the base class.
  
-Since ''never'' is a bottom type within the PHP engine, all other types contain it. This RFC proposes allowing ''never'' as a valid argument type for functions.+Since ''never'' is a bottom type within the PHP engine, all other types contain it. This RFC proposes allowing ''never'' as a valid parameter type for functions.
  
 ===== Use Cases ===== ===== Use Cases =====
Line 138: Line 138:
  
 ===== References ===== ===== References =====
-  * https://github.com/JordanRL/never-argument-type/edit/master/README.md+  * https://github.com/JordanRL/never-argument-type/blob/master/README.md
   * https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)   * https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)
   * https://en.wikipedia.org/wiki/Bottom_type   * https://en.wikipedia.org/wiki/Bottom_type
rfc/never_for_parameter_types.txt · Last modified: 2021/08/24 11:53 by jordanrl