Re: [RFC] Pure-code source files via the .phpc extension
| From: | Larry Garfield | Date: | Tue, 16 Jun 2026 14:53:08 +0000 |
| Subject: | Re: [RFC] Pure-code source files via the .phpc extension | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131323@lists.php.net to get a copy of this message | ||
On Mon, Jun 15, 2026, at 11:20 PM, Hendrik Mennen wrote:
> 1. The friction is real and a small targeted addition is worth
> shipping. (what the RFC proposes)
> 2. The friction is real but the mechanism is wrong. (in which case:
> what signal would you prefer? per-file declare, magic first line,
> SAPI-only, ...)
> 3. The friction is not real, or not worth a language change at all.
I also am in camp 3. I basically never type <?php myself. My IDE does it for me when I create a
file. This is a non-issue, and the proposed solution, as others have explained, has many issues and
gotchas.
One useful part of Alex's module proposal was a file type that had stricter rules about what it
could do; basically it had to follow PSR-1. I think there could be potential in that concept, but
it wouldn't be triggered by a different file name; it would be triggered by, say, <?phpo
(PHP Only), or some other prefix that indicates the whole file must be code, no ?> allowed,
cannot have top-level output or code, etc. The idea needs some development, but I could see that
having use in a way that doesn't break BC.
But pivoting off the file name is a non-starter.
--Larry Garfield