rfc:consistent_callables

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
rfc:consistent_callables [2019/04/28 02:51] – Made scope of changes even smaller. danackrfc:consistent_callables [2019/04/28 02:58] danack
Line 178: Line 178:
 // Fatal error: Uncaught TypeError: Argument 1 passed to Foo::process() must be  // Fatal error: Uncaught TypeError: Argument 1 passed to Foo::process() must be 
 // callable, string given, called in /in/7SCuB on line 34 and defined in /in/7SCuB:10 // callable, string given, called in /in/7SCuB on line 34 and defined in /in/7SCuB:10
-i.e. calling `self::hello` from within Bar changes the callable from meaning `Foo::hello` to `Bar::hello` and calling 'parent::hello' from within Foo changes the meaning from `Foo::hello` to something that breaks. 
  
 </code> </code>
 +
 +i.e. calling `self::hello` from within Bar changes the callable from meaning `Foo::hello` to `Bar::hello` and calling 'parent::hello' from within Foo changes the meaning from `Foo::hello` to something that breaks.
  
 === call_user_func different from is_callable ===  === call_user_func different from is_callable === 
Line 211: Line 212:
 // This is foo::bar // This is foo::bar
 // Fatal error: Uncaught Error: Class 'self' not found in /in/DDGHU:14 // Fatal error: Uncaught Error: Class 'self' not found in /in/DDGHU:14
-i.e. despite something being 'callable' it is only callable directly and not through call_user_func. 
  
 </code> </code>
 +
 +i.e. despite something being 'callable' it is only callable directly and not through call_user_func.
  
  
Line 224: Line 226:
   - A string that is the name of a function.   - A string that is the name of a function.
   - An array consisting of two elements; a string at index 0 which is a valid fully qualified class name, and a string at index 1 which must meet the conditions:   - An array consisting of two elements; a string at index 0 which is a valid fully qualified class name, and a string at index 1 which must meet the conditions:
-    * either be the name of a public static function of the class or the class must have a magic __callStatic method. +  * either be the name of a public static function of the class or the class must have a magic __callStatic method.   
-    * the name must not be that of an instance method. +   
-  - An array consisting of two elements; an object at index 0, and a string at index 1 where either the string is the name of a public method of the object, or the object has a magic __call method.+  * the name must not be that of an instance method.   
 +  - An array consisting of two elements; an object at index 0, and a string at index 1 where either the string is the name of a public method of the object, or the object has a magic __call method.  
   - An instance of a class (an object) where the class has a public __invoke() method.   - An instance of a class (an object) where the class has a public __invoke() method.
   - Closures, which includes anonymous functions.   - Closures, which includes anonymous functions.
rfc/consistent_callables.txt · Last modified: 2021/10/20 13:18 by danack