note 128782 added to function.gettype
| From: | dg dot inc dot lcf at gmail dot com | Date: | Sat, 05 Aug 2023 22:40:32 +0000 |
| Subject: | note 128782 added to function.gettype | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220742@lists.php.net to get a copy of this message | ||
The compatibility of the ReflectionAPI is clearly broken.
Need to either fix the API or change the gettype().
<?php
function test(float $param) {}
$ref_func = new ReflectionFunction("test");
$float = floatval("0.5");
foreach ($ref_func->getParameters() as $parameter){
var_dump($parameter->getType()->getName() == gettype($float));
var_dump($parameter->getType()->getName());
var_dump(gettype($float));
}
?>
//Output:
bool(false)
string(5) "float"
string(6) "double"
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.157.134 (proxied: 95.26.6.88)
----
Manual Page -- https://php.net/manual/en/function.gettype.php
Edit -- https://main.php.net/note/edit/128782
Del: integrated -- https://main.php.net/note/delete/128782/integrated
Del: useless -- https://main.php.net/note/delete/128782/useless
Del: bad code -- https://main.php.net/note/delete/128782/bad+code
Del: spam -- https://main.php.net/note/delete/128782/spam
Del: non-english -- https://main.php.net/note/delete/128782/non-english
Del: in docs -- https://main.php.net/note/delete/128782/in+docs
Del: other reasons-- https://main.php.net/note/delete/128782
Reject -- https://main.php.net/note/reject/128782
Search -- https://main.php.net/manage/user-notes.php