1 Title: Loose type requirements for functions
4 Maintainer: Brian Moon <brianm@dealnews.com>
12 Many internal function of PHP will reject parameters because of their
13 type (the array and variable function come to mind). For userland
14 this is not an easy task as there is no uniform way to do it. An
15 addition to the engine for requiring loose types would allow
16 delevopers to know that the data passed to their functions is of the
17 correct type and reduce the need for duplicating the same code in
18 every function to check for the type of data.
24 Loose typing mostly means evaluating the contents of the variable and
25 not the type of the variable itself. The requirements for this would
26 and should work much like several of the is_* functions do now.
28 The typing of parameters would be optional and those not typed would
29 simply continue to be treated as they are now.
37 Only loose types should be needed to ensure the data is usable by the
38 function. Duplicating the functionallity of is_scalar, is_resource,
39 is_array and is_object should give developers all the information they
40 need to use a variable correctly.
45 The current function syntax should be expanded to allow typing of
46 variables inline in a C style.
51 could be changed to require an array such as:
53 function foo (array $var){
59 Mis-matches in type should be reported as fatal errors and should halt
60 the execution of a script as that function can not be run and code
61 following could not reliably run.
64 4. Compatibility Notes
65 ======================
67 Old code that does not take advantage of this will run without