Hi,
On Mon, 2007-10-15 at 20:47 +0200, "Timm Friebe" wrote:
> function xpath(DomDocument $arg) {
> return new DomXPath($arg);
> }
>
> function xpath(XmlTree $arg) {
> return new DomXPath($this->loadXML($arg->getSource())));
> }
>
> function xpath($arg) { // Untyped = default
> if (!is_string($arg)) {
> throw new IllegalArgumentException('Unsupported argument type');
> }
> return new DomXPath($this->loadXML($arg));
> }
>
> ==
>
> If we consider the readability argument only: Which one of the above more
> readable? You decide:)
Allowing an untyped version next to a typed one is imo the worst thing
one can do: f I want to read the code and first see the untyped
implementation I certainly go crazy while trying to debug the code.
johannes
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php