On 2 January 2015 at 15:01, Jordi Boggiano wrote:

Looking at it from an OSS maintainer perspective, introducing strict hints
in code would be a huge BC break as I don't know how people use my code,
nor if they validate/coerce their user input early or not. If I suddenly
declare something as int and someone used to pass '5', they get an error.
That would make adoption quite hard in OSS IMO if you don't want to bother
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.

That'd be a simple lib to write, it barely adds more code to your
functions, and you get strict typing. But I hardly see anyone do this, and
I would argue it's because it sounds appealing in theory but it's not worth
it in practice.
I'm actually already using https://github.com/beberlei/assert for that, and
I'd like to get rid of it for simpler types.

Marco Pivetta



Search Discussions

Discussion Posts


Follow ups

Related Discussions



site design / logo © 2019 Grokbase