|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-07-18 06:45 UTC] helly@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 05:00:02 2025 UTC |
Description: ------------ Currently, only object and array arguments of a function can be hinted. However, if you can't hint non-class/non-array argument, you have to leave argument unhinted, which allows passing of class/array besides of scalar types. I propose adding new type-hinting keyword 'scalar', which matches complement to currently possible hints. Think also about 'resource' hint. Reproduce code: --------------- <?php function show ( scalar $string ) { echo $string; } show("hello\n"); show(new stdClass()); ?> Expected result: ---------------- hello Error...