Re: [RFC] Scalar Type Hints

From: Date: Sun, 25 Jan 2015 04:02:46 +0000
Subject: Re: [RFC] Scalar Type Hints
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-81105@lists.php.net to get a copy of this message
Hi everyone, Just a few small updates. I’ve made a small change to this RFC. Instead of the strict mode syntax being declare(strict_typehints=TRUE), it’s now declare(strict_types=1) instead. This makes it a bit quicker to type - important given you’d need to type it a lot - without sacrificing much readability. It also avoids using the words “type hint”, which I understand are contentious to some people. The patch now includes a more extensive set of tests: https://github.com/TazeTSchnitzel/php-src/tree/scalar_type_hints_2_strict_mode/Zend/tests/typehints/ The pull request is also now green on Travis (aside from two failures on the debug build - but they also fail in master). Levi’s Return Types RFC has now passed, so now the RFC needs to cover that. The RFC currently doesn’t discuss return types, save for a paragraph in the Future Scope section. When the return types patch is merged, I’ll update the scalars patch, and then update the RFC. A point of contention here is whether or not return types should always be strict, or whether they should also obey the strict/weak modes. I’m not entirely sure on that one, that specific item may end up going to a vote. That said, I do lean towards always strict, given you can usually ensure your return type’s correct. Thanks. -- Andrea Faulds http://ajf.me/ PS: It’s rumoured that a certain other female internals developer may have endorsed this RFC at a certain recent PHP conference. That’s good to hear!

« previous php.internals (#81105) next »