$me->apologizeFor($this->isSelfAdvertising());
if ($you->lookingFor($php->workaround(TYPE_HINT_FOR_NATIVE_TYPES)) {
    check('http://www.phpclasses.org/browse/package/4195.html');
}

$package = new Package('http://www.phpclasses.org/browse/package/4195.html'
);

$package->usageExample = <<<EXAMPLE
    function test(int $n) {
    }
    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 = <<<EXAMPLE
    final class EmailAddress implements TypeHint {
        private function __construct() { }
        public static function isTypeHintFor($value) {
            ... regexp check for $value ...
        }
    }

    sendMail(EmailAddress $email, ....) {
        ....
    }

    sendMail('[EMAIL PROTECTED]', ...);
EXAMPLE;

echo "Regards, \n Martin Alterisio";

Reply via email to