Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19482 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99369 invoked by uid 1010); 7 Oct 2005 20:30:05 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 99341 invoked from network); 7 Oct 2005 20:30:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Oct 2005 20:30:05 -0000 X-Host-Fingerprint: 82.94.239.5 jdi.jdi-ict.nl Linux 2.5 (sometimes 2.4) (4) Received: from ([82.94.239.5:54773] helo=jdi.jdi-ict.nl) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 0A/3E-54476-8CAD6434 for ; Fri, 07 Oct 2005 16:30:02 -0400 Received: from localhost (localhost [127.0.0.1]) by jdi.jdi-ict.nl (8.12.11/8.12.11) with ESMTP id j97KTu39021493 for ; Fri, 7 Oct 2005 22:29:56 +0200 Received: from localhost (localhost [127.0.0.1]) by jdi.jdi-ict.nl (8.12.11/8.12.11) with ESMTP id j97KToRj021475 for ; Fri, 7 Oct 2005 22:29:51 +0200 Date: Fri, 7 Oct 2005 22:29:51 +0200 (CEST) X-X-Sender: derick@localhost To: PHP Developers Mailing List Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-618579228-1128716982=:13434" X-Virus-Scanned: by amavisd-new at jdi-ict.nl Subject: Type Hints with Null From: derick@php.net (Derick Rethans) --8323328-618579228-1128716982=:13434 Content-Type: TEXT/PLAIN; charset=US-ASCII Hello, attached is a patch (by Markus) that allows you to make typehints optionally take NULL as default value too, f.e.: class P { } class T { function f(P $p = NULL) { var_dump($p); } } $o=new T(); $o->f(new P); $o->f(NULL); $o->f(); I would like to commit this patch to HEAD pending any objections. regards, Derick -- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org --8323328-618579228-1128716982=:13434 Content-Type: TEXT/PLAIN; charset=US-ASCII; name=ze2-type-hints-null-20051005.diff.txt Content-Transfer-Encoding: BASE64 Content-Description: Content-Disposition: attachment; filename=ze2-type-hints-null-20051005.diff.txt SW5kZXg6IFplbmQvemVuZF9jb21waWxlLmMNCj09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT0NClJDUyBmaWxlOiAvcmVwb3NpdG9yeS9aZW5kRW5naW5lMi96ZW5k X2NvbXBpbGUuYyx2DQpyZXRyaWV2aW5nIHJldmlzaW9uIDEuNjY1DQpkaWZm IC11IC1wIC1kIC1yMS42NjUgemVuZF9jb21waWxlLmMNCi0tLSBaZW5kL3pl bmRfY29tcGlsZS5jCTMgT2N0IDIwMDUgMDg6MjE6MTUgLTAwMDAJMS42NjUN CisrKyBaZW5kL3plbmRfY29tcGlsZS5jCTYgT2N0IDIwMDUgMTg6MjE6MDIg LTAwMDANCkBAIC0xMzI0LDcgKzEzMjQsNyBAQCB2b2lkIHplbmRfZG9fcmVj ZWl2ZV9hcmcoemVuZF91Y2hhciBvcCwgDQogCQkJY3VyX2FyZ19pbmZvLT5j bGFzc19uYW1lID0gTlVMTDsNCiAJCQljdXJfYXJnX2luZm8tPmNsYXNzX25h bWVfbGVuID0gMDsNCiAJCX0NCi0JCWN1cl9hcmdfaW5mby0+YWxsb3dfbnVs bCA9IDA7DQorCQljdXJfYXJnX2luZm8tPmFsbG93X251bGwgPSAob3AgPT0g WkVORF9SRUNWX0lOSVQgJiYgKFpfVFlQRShpbml0aWFsaXphdGlvbi0+dS5j b25zdGFudCkgPT0gSVNfTlVMTCB8fCAoWl9UWVBFKGluaXRpYWxpemF0aW9u LT51LmNvbnN0YW50KSA9PSBJU19DT05TVEFOVCAmJiAhc3RyY2FzZWNtcCha X1NUUlZBTChpbml0aWFsaXphdGlvbi0+dS5jb25zdGFudCksICJOVUxMIikp KSkgPyAxIDogMDsNCiAJfSBlbHNlIHsNCiAJCWN1cl9hcmdfaW5mby0+Y2xh c3NfbmFtZSA9IE5VTEw7DQogCQljdXJfYXJnX2luZm8tPmNsYXNzX25hbWVf bGVuID0gMDsNCg== --8323328-618579228-1128716982=:13434--