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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: Bernhard dot Stauss at Clareon dot de
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2021 The PHP Group
All rights reserved.
Last updated: Fri Sep 24 15:03:43 2021 UTC