Skip to content

Compatibility with PHP 8 #295

Open
Open
@karyna-t

Description

@karyna-t

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

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