magento-coding-standard icon indicating copy to clipboard operation
magento-coding-standard copied to clipboard

Compatibility with PHP 8

Open karyna-tsymbal-atwix opened this issue 2 years ago • 2 comments

Preconditions

In PHP 8, functions like token_get_all treat namespaced names as single token, e.g.

// Before: T_NS_SEPARATOR T_STRING
// After:  T_NAME_FULLY_QUALIFIED

Details: https://wiki.php.net/rfc/namespaced_names_as_token

There are couple places in the code that rely on the php7-style implementation:

\Magento2\Sniffs\Exceptions\ThrowCatchSniff::getFullClassName
\Magento2\Sniffs\NamingConvention\ReservedWordsSniff::validateNamespace

Expected result

These methods should be checked and updated, the logic should work on PHP 8 as it was on PHP 7.

example from the main repo where new approach is used together with the old one: https://github.com/magento/magento2/blob/platform-health/setup/src/Magento/Setup/Module/Di/Code/Reader/FileClassScanner.php#L155

karyna-tsymbal-atwix avatar Sep 29 '21 09:09 karyna-tsymbal-atwix

@magento export issue to Jira project AC as Story

xmav avatar Sep 29 '21 14:09 xmav

:x: Cannot export the issue. GitHub repo magento/magento-coding-standard is not supported in JIRA project AC and type Story.

github-jira-sync-bot avatar Sep 29 '21 14:09 github-jira-sync-bot