| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2019-10-17 08:02 UTC] cmb@php.net
 
-Status:      Open
+Status:      Not a bug
-Assigned To:
+Assigned To: cmb
  [2019-10-17 08:02 UTC] cmb@php.net
  [2019-10-17 08:04 UTC] sjon@php.net
 
-Summary:     Interface declaration of ...  unexpected
              behavior
+Summary:     Parameter Type Widening not properly
              documented
-Status:      Not a bug
+Status:      Open
-Type:        Bug
+Type:        Documentation Problem
-Package:     *Programming Data Structures
+Package:     Class/Object related
-Assigned To: cmb
+Assigned To:
  [2019-10-17 08:04 UTC] sjon@php.net
  [2019-10-17 08:05 UTC] sjon@php.net
  [2019-10-17 09:12 UTC] cmb@php.net
  [2019-10-17 10:53 UTC] pavel at bunaev dot ru
 
-Status: Open
+Status: Closed
  [2019-10-17 10:53 UTC] pavel at bunaev dot ru
  [2019-10-17 14:20 UTC] sjon@php.net
 
-Status: Closed
+Status: Verified
  [2019-10-17 14:20 UTC] sjon@php.net
  [2020-02-20 13:04 UTC] tiffany@php.net
 
-Assigned To:
+Assigned To: tiffany
  [2020-03-12 14:56 UTC] tiffany@php.net
  [2020-03-12 15:01 UTC] tiffany@php.net
 
-Status: Verified
+Status: Closed
  [2020-03-12 15:01 UTC] tiffany@php.net
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 16:00:01 2025 UTC | 
Description: ------------ The interface allows you to change the type of variable in an incompatible direction. In versions php 7.0+ and 7.1-, we could specify in the interface with what types of data we will work in the method. And at the kernel level, be sure that by implementing the interface the signature will not change. In version php 7.2+ and 7.3+, this has changed and there was no announcement .. We can create an interface and expect in the signature that the method will work with certain arguments but in fact we can transfer anything OS linux version php 7.2+ version php 7.1- is ok Test script: --------------- <?php interface IBaz {}; interface IFoo { public function simple(IBaz $a); } class CFoo implements IFoo { public function simple($a){ var_dump($a); } } $cFoo = new CFoo(); $cFoo->simple('vbvc'); Expected result: ---------------- <br /> <b>Fatal error</b>: Declaration of CFoo::simple($a) must be compatible with IFoo::simple(IBaz $a) in <b>[...][...]</b> on line <b>7</b><br /> Actual result: -------------- string(4) "vbvc"