On 02/01/2015 14:06, Marco Pivetta wrote:
Regardless if this RFC gets through or not, changing the signature of a
method IS a BC break in any case, so you shouldn't just move your `int`
declaration from the docblocks into the method signature.

On public methods yes although a lot of internal public methods are probably safe-ish, or would only affect people extending/overriding.

Private methods though could still benefit from this perfectly safely, but if the public methods route params to private methods with strict hints you still get issues.

I'm actually already using https://github.com/beberlei/assert for that,
and I'd like to get rid of it for simpler types.

Interesting, I didn't know about this, and it's a cool way to get more specialized assertions than plain type hints allow. IMO with the RFC as it stands you could still get rid of it for simple types though because it's not your job to validate user input. You need an int ask for an int and get an int. If users like convenience they can skip validation, if they like strictness they can do their own layer of Assertion::foo calls in their controllers.

Cheers

--
Jordi Boggiano
@seldaek - http://nelm.io/jordi

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to