A workaround for type hinting native types (and a little of self-advertising)
am 06.11.2007 18:00:46 von Martin Alterisio------=_Part_14376_4104512.1194368446779
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
$me->apologizeFor($this->isSelfAdvertising());
if ($you->lookingFor($php->workaround(TYPE_HINT_FOR_NATIVE_TYPE S)) {
check('http://www.phpclasses.org/browse/package/4195.html');
}
$package = new Package('http://www.phpclasses.org/browse/package/4195.html'
);
$package->usageExample = <<
}
test(1);
test("2"); // string representation of an int is OK
test(1.2); // not an int, fails
// there are also type hints for strictly checking types: StrictInt,
StrictString, etc
EXAMPLE;
$package->isExtendable = true;
$package->extensionExample = <<
private function __construct() { }
public static function isTypeHintFor($value) {
... regexp check for $value ...
}
}
sendMail(EmailAddress $email, ....) {
....
}
sendMail('test@test.com', ...);
EXAMPLE;
echo "Regards, \n Martin Alterisio";
------=_Part_14376_4104512.1194368446779--