-----Original Message----- From: wikitech-l-bounces@wikimedia.org [mailto:wikitech-l-bounces@wikimedia.org] On Behalf Of Brion Vibber Sent: 22 November 2006 22:51 To: wikitech-l@wikimedia.org Subject: Re: [Wikitech-l] [MediaWiki-CVS] SVN: [17833]trunk/phase3/includes/Linker.php
rotem@svn.wikimedia.org wrote:
Reverting the addition of class names near the parameters: it doesn't seem to have a purpose, and breaks PHP 5.0.4 on my computer (PHP raises error when the parameters
are set to
null).
For reference, as of PHP 5 you can specify type requirements on function parameters, to enforce that objects of the correct type are passed. Unfortunately this is pretty limited; you can't allow 'type-X-or-null' or other such conditions, nor I think can you specify non-object types.
Setting the default for typed parameter to be null, allows type-X-or-null
class Foo { } class Bar { }
function f(Foo $foo = null) { var_dump($foo); }
f(new Foo()); f(); f(null);
f(new Bar()); // Catchable fatal error
Though can't remember which version this was added, and if your refering to something older.
Jared