Doc #71051 [Com]: Type Hint about SeekableIterator::seek does not match with informed
| From: | gabriel dot heming at hotmail dot com | Date: | Wed, 09 Dec 2015 13:55:25 +0000 |
| Subject: | Doc #71051 [Com]: Type Hint about SeekableIterator::seek does not match with informed | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12922@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71051&edit=1
ID: 71051
Comment by: gabriel dot heming at hotmail dot com
Reported by: gabriel dot heming at hotmail dot com
Summary: Type Hint about SeekableIterator::seek does not
match with informed
Status: Not a bug
Type: Documentation Problem
Package: SPL related
Operating System: Debian 8.2
PHP Version: 7.0.0
Block user comment: N
Private report: N
New Comment:
Thanks for your reply.
By this way, I lose (or my code) a little of strictness what I want about my code.
There's no way to make the assignature (for type hints) like variables names, what that
doesn't matter at all?
Like:
public function seek($p) {
The code above, without match variable name (using $p instead of $position), will work normaly.
Previous Comments:
------------------------------------------------------------------------
[2015-12-08 20:24:47] requinix@php.net
@salathe just made bug #71058 so I'm closing this as NAB.
Yes, you must remove the type hint for it to work. Built-in functions work differently than userland
functions and the signature of a method (its name and parameter list) is separate from how
parameters are typed. Currently the method signature does not include typing and is just
"seek($position)" - that is what you need to match with your implementation. The fact that
the manual shows "void seek(int $position)" is purely for documentation.
I don't know what's broken but I'm talking about the assorted mailing lists.
http://php.net/mailing-lists.php
------------------------------------------------------------------------
[2015-12-08 11:08:08] gabriel dot heming at hotmail dot com
What I do not understand is about my code, I must remove the type hint in order to work with them.
In others reports, I saw about an internal mail, but the links was broken. There's something
about it now?
------------------------------------------------------------------------
[2015-12-07 21:12:17] requinix@php.net
Related To: Bug #71053
------------------------------------------------------------------------
[2015-12-07 21:06:57] requinix@php.net
>do not use type hinting
By that I mean the function signatures. As in the types aren't defined in the signatures
themselves. Obviously the code itself does respect strict typing.
------------------------------------------------------------------------
[2015-12-07 21:01:16] requinix@php.net
Built-in functions and methods currently do not use type hinting. The documentation indicates the
type as a clue to developers about the types of values used by each parameter, but the types
themselves are not part of the signature.
I'm suspending this pending discussion about what to do.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=71051
--
Edit this bug report at https://bugs.php.net/bug.php?id=71051&edit=1