note 101897 deleted from language.oop5.typehinting by danbrown
| From: | danbrown@php.net | Date: | Mon, 17 Jan 2011 14:34:49 +0000 |
| Subject: | note 101897 deleted from language.oop5.typehinting by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-175827@lists.php.net to get a copy of this message | ||
Note Submitter: jeffomatic at gmail dot com
----
If you are have a namespaced interface that uses type-hinting, please make sure that your type-hints
are fully-qualified, *even* if the types are primitive.
NOTE: The following example uses regular slashes for namespaces rather than backslashes, because the
note system does not seem to render backslashes.
File A:
<?php
namespace NS1;
interface IFoo
{
public function DoSomething( /int $arg );
}
?>
File B:
<?php
namespace NS2;
class Foo implements /NS1/IFoo
{
public function DoSomething( /int $arg );
}
?>
Note that I had to use the "\" global namespace prefix on the "int" type hints.
Failure to do so will raise an incompatibility error.
This does not appear to be necessary for the "array" basic type, which strikes me as a
bug, or at least a flagrant inconsistency.
FYI, I'm using PHP 5.3.1.