Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / php / Zend / RFCs / 003.txt
blob30fb4cec4912f30d0600d45fda082d7eadf58521
1 Title:           Loose type requirements for functions
2 Version:         $Id$
3 Status:          draft
4 Maintainer:      Brian Moon <brianm@dealnews.com>
5 Created:         2001-09-17
6 Modified:        2001-09-17
9 1. Background/Need
10 ==================
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.
21 2. Overview
22 ===========
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.
31 3. Functionality
32 ================
34 3.1. Allowed Types
35 ==================
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.
42 3.2. Syntax
43 ===========
45 The current function syntax should be expanded to allow typing of
46 variables inline in a C style.
48 function foo ($var){
51 could be changed to require an array such as:
53 function foo (array $var){
56 3.3. Errors
57 ===========
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
68 modifications.