Skip to content

Support new PHP 8.4 syntaxes #734

Open
@jrfnl

Description

@jrfnl

PHP 8.4 introduces new syntaxes for which it should be verified if the Tokenizer needs updates and/or whether any sniffs need updating.

Action list

Notes:

  • While Property Hooks is a single RFC, it introduces multiple new syntaxes. With that in mind, I've broken the RFC up into separately actionable parts.
  • Action items in italics are tentative. Investigation and testing is needed to determine whether any changes are needed and if so, which.
  • For action items not in italics, I'm fairly certain those will be needed.
  • This list is not set in stone and is subject to change once investigation for supporting a syntax starts.

To Do

Done

Nothing yet.

No action needed

Contribution Process

If anyone familiar with the PHP and PHPCS tokenizer wants to start work on any of these, please leave a comment in this ticket to claim an action item.

If you are not familiar with either tokenizer, please spare yourself the pain 😉

New custom PHPCS tokens may be needed (like for supporting property hooks). If that's the case, please open a separate issue with a detailed proposal on how to handle the syntax, what alternatives have been considered, what the consequences would be and why the proposed option should be accepted. Please open this issue before creating a PR.

If anyone needs it, here are some examples of earlier proposals for supporting PHP syntaxes from before PHP 8.4:

Timeline

For anyone coming to this ticket to see when syntax support for PHP 8.4 syntaxes is expected, please do NOT spam this ticket with repeated comments asking for a timeline.
It will be ready when it's ready and whatever is ready will be included in a release forthwith.

Seriously, to add syntax support for PHP 8.4, a completely silly amount of work will be needed and people need to sleep once in a while as well (and should get a life), so please be patient.

To quote myself from #731 (comment):

... property hooks is the bane of my existence and will be a nightmare to add support for in PHPCS. The tokenizer support alone is going to take months of work, as it is not 1 syntax they have added, but over a dozen new syntaxes, all under one RFC...
Only after syntax support is available through the Tokenizer can we start fixing individual sniffs and I expect 60-70% of sniffs in the wider PHPCS field (including external standards) will need updates, or at the very least additional tests with property hooks.

I spoke up about this at the time (and about other idiocracies in property hooks, it's a massive footgun), but unfortunately to no avail.
If you want to read my full analysis of the problems with property hooks, have a read through here: https://externals.io/message/123048#123080

Oh and this comment from me on the Internals mailinglist should also help illuminate why so many sniffs will need updates and how problematic property hooks are: https://externals.io/message/123048#123118

All in all, please be patient, I expect it will be quite a while before PHPCS will have full support for property hooks.

Funding for this would help. Finding a way to clone me, would help even more.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions