php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80707 function parameter ?t $v not described
Submitted: 2021-02-03 23:35 UTC Modified: 2021-08-06 19:16 UTC
From: Bernhard dot Stauss at Clareon dot de Assigned:
Status: Verified Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2021-02-03 23:35 UTC] Bernhard dot Stauss at Clareon dot de
Description:
------------
---
From manual page: https://php.net/functions.arguments
---
The manual page says no single word about function parameters declared as

   ?<type> $<param-name>

where <type> is the data type of the parameter 
and <param-name> is the name of the parameter.

What is the meaning of such a parameter declaration?


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-02-04 11:16 UTC] cmb@php.net
I think we should overhaul the "How to read a function definition"
section[1].

[1] <https://www.php.net/manual/en/about.prototypes.php>
 [2021-02-04 14:16 UTC] Bernhard dot Stauss at Clareon dot de
First: Thank you for the hint to nullable type. 

Second: The doc is good to get a help, if you are a more or less experienced php-developper and have a specific question. The doc may not be intended to be read in the given sequence.
 [2021-08-06 19:16 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2021-08-06 19:16 UTC] cmb@php.net
That page[1] is really bad; it starts with

| Information may be passed to functions via the argument list,
| which is a comma-delimited list of expressions.

What is close to nonsense.  It does not even mention type
declarations, except for variadics:

| It is also possible to add a type declaration before the ...
| token.

A pull request[2] for improvement is welcome!

[1] <https://php.net/functions.arguments>
[2] <https://github.com/php/doc-en/pulls>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC