Req #71058 [Com]: Function prototypes reflecting parameter/return type declarations

From: Date: Sun, 16 Feb 2020 16:48:42 +0000
Subject: Req #71058 [Com]: Function prototypes reflecting parameter/return type declarations
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17311@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71058&edit=1 ID: 71058 Comment by: carusogabriel@php.net Reported by: salathe@php.net Summary: Function prototypes reflecting parameter/return type declarations Status: Open Type: Feature/Change Request Package: Documentation problem PHP Version: 7.0.0 Block user comment: N Private report: N New Comment: This requested was addressed, right? We are now using the syntax {modifiers} {method_visibility} {(function/method)_name} ({list_arguments_with_type}) : {return_type} Example: https://www.php.net/reflectionmethod.invokeargs Previous Comments: ------------------------------------------------------------------------ [2015-12-19 16:51:50] ajf@php.net More formally, the problem is the distinction between type declarations (internally still called "type hints"), and zend_parse_parameters (ZPP) types. Very few internal functions use type hints, they usually have untyped parameters that are handled by ZPP instead. At least ZPP and type hints behave mostly the same, with the exception of NULL handling. Obviously it's still a problem for inheritance, though. ------------------------------------------------------------------------ [2015-12-08 20:24:48] requinix@php.net Related To: Bug #71051 ------------------------------------------------------------------------ [2015-12-08 11:54:50] salathe@php.net See also the phpdoc mailing list thread "Changing our function definition syntax in the manual" -- http://php.markmail.org/thread/4rj5yj5czqxjt6uo ------------------------------------------------------------------------ [2015-12-08 11:48:04] salathe@php.net Description: ------------ Given that PHP 7 introduced return type declarations and scalar parameter declarations, there is a conflict between the function prototypes used in the manual and the prototypes used in code. This has already caused some confusion (e.g. bug #71051 where someone tried to override a method using the "type suggestion" from the documentation). This request is in two parts (which may become separate requests at some point): 1. Discuss and decide how to approach the issue of the manual stating that an argument should be of a certain type, but is not really part of the function signature. The suggestion here is to have clearly marked prototypes stating whether the type declarations are "suggestions" as they have historically been, or actual declarations. 2. Consider altering the function prototype to move the return type declaration to the end, in order to match PHP syntax. This does not come without issues; such as our "mixed" pseudo-type. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71058&edit=1

« previous php.doc.bugs (#17311) next »