| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2014-05-14 13:25 UTC] mike@php.net
 
-Status: Open
+Status: Not a bug
  [2014-05-14 13:25 UTC] mike@php.net
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 11:00:01 2025 UTC | 
Description: ------------ When we use a Trait in a class we define behavior for that class like interfaces. But we can't use them as an input type. Checkout "Test Script" to find out more. I think you got idea. Best regards, motammem Test script: --------------- trait Foo { sayHello(){ echo "Hello"; } } class Bar { use Foo; } function test(Foo $foo){ $foo->sayHello(); } ////////////////////////////// $bar = new Bar(); test($bar); Expected result: ---------------- Hello Actual result: -------------- "Catchable fatal error: Argument 1 passed to go() must be an instance of Foo, instance of Bar given..."