rfc:prototype_checks

This is an old revision of the document!


Request for Comments: How to write RFCs

Introduction

Past discussions on the mailing lists have shed some light on the various ways we handle prototype checks and what may be done to improve PHP in that area. This RFC summarizes the current state (5.3/5.4) of prototype checks and possible improvements to it

Prototype checks

Prototype checks occur in different contexts:

Implementing abstract method

The prototype is checked with current normal rules (see Current rules). Any mismatch with current rules generates a FATAL error.

Implementing interface method

The prototype is checked with current normal rules (see Current rules). Any mismatch with current rules generates a FATAL error.

Overriding existing method

The prototype is checked with current normal rules (see Current rules). Any mismatch with current rules generates a STRICT error.

Current rules

This part specifies what is currently considered as a compatible signature:

Allowed

Adding new optional arguments

function foo($a)

becomes in a sub class/interface

function foo($a, $b = 42)

Adding a return-by-ref

function foo($a)

becomes in a sub class/interface

function &foo($a)
rfc/prototype_checks.1316431187.txt.gz · Last modified: 2017/09/22 13:28 (external edit)