You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
declare(strict_types=1) does not ignore null AST nodes #19719
@nielsdos Should be ok, but would handle it as a feature rather than bug. Not sure if the same goes for declare(encoding=);.
Yeah sure, I can submit it as a new feature (for after 8.5). I don't think we should do encoding as that may have influence on some special characters that may have influence.
Activity
devnexen commentedon Sep 5, 2025
Hi @FearXenon what s the practical reason for not doing this ?
AFAIK, it might be possible to "fix" it, but do not know how trivial it is. cc @iluuu1994
iluuu1994 commentedon Sep 5, 2025
Not really a bug.
?>includes an implicit;, so it's not actually the first statement.adrian-schenk commentedon Sep 5, 2025
Hi @devnexen,
i´ve seen some projects that use a separate script to prepend licensing/copyright info to php files.
some of them did stuff like this:
besides, I don´t really see the point of why it shouldn´t work, since technically nothing gets "executed" before, right?
devnexen commentedon Sep 5, 2025
I see, but again that seems a very particular case. "How much the juice is worth the squeeze" is the question. But I ll let the lexer expert speak :)
ndossche commentedon Sep 7, 2025
We do allow it for namespaces, so why not also for strict_types? I don't see a reason why this wouldn't work (I could be missing some detail):
iluuu1994 commentedon Sep 7, 2025
@nielsdos Should be ok, but would handle it as a feature rather than bug. Not sure if the same goes for
declare(encoding=);.ndossche commentedon Sep 7, 2025
Yeah sure, I can submit it as a new feature (for after 8.5). I don't think we should do encoding as that may have influence on some special characters that may have influence.
Allow empty statements before declare(strict_types)
Allow empty statements before declare(strict_types)