Hi Nikita,

Nikita Popov wrote:
As I see it, the issue here is really not how to figure out whether a file
uses strict_types, the issue is how you mix strict_types=1 and
strict_types=0 code in a single file.

This is also my assessment.

Back when this feature was introduced, we decided not to allow this kind of
mixing, as it seemed prone to causing a mess and use-cases seemed doubtful.
Given the issue Symfony is experiencing, we should reevaluate this
decision. Imho it's not good if there are some things you simply *cannot*
express in a single file.

I think it was things like this that made me initially allow having multiple strict_types declarations in a file. But that was changed later.

Maybe we could allow it, but only with the block syntax, much as we do with namespaces? i.e.:

declare (strict_types=1) {

}

declare (strict_types=0) {

}

Or we could allow any number of non-block strict_types declarations if we wanted. I don't know.

--
Andrea Faulds
https://ajf.me/

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

Reply via email to