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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
30 + 46 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 12:01:27 2024 UTC