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
The WPCS native sniffs will need to be reviewed to make sure that they handle those correctly.
As of PHPCS 3.5.3 the tokenization of numbers using separators is backfilled for older PHP versions, so I'd strongly recommend we update the minimum PHPCS requirement of WPCS to PHPCS 3.5.3 in the near future as it will be hard to handle this without the backfilled tokenization.
Any sniff which examines T_LNUMBER and T_DNUMBER tokens is affected for the token walking part until PHPCS 3.5.3.
If the numeric value of a T_LNUMBER of T_DNUMBER needs to be examined - like in the CronInterval sniff, but probably in a few more sniffs -, the numeric value of the $token['content'] will need to be cast to (int)/(float) before doing any comparison or calculations with that number.
PHPCSUtils contains a few utilities for recognizing and dealing with numeric literals with underscores for those PHPCS versions which don't properly support them yet (= PHPCS < 3.5.4. Support was added in 3.5.3, but very buggy, I fixed that in 3.5.4)
PHP 7.4 introduces numeric literal separators.
The WPCS native sniffs will need to be reviewed to make sure that they handle those correctly.
As of PHPCS 3.5.3 the tokenization of numbers using separators is backfilled for older PHP versions, so I'd strongly recommend we update the minimum PHPCS requirement of WPCS to PHPCS 3.5.3 in the near future as it will be hard to handle this without the backfilled tokenization.
T_LNUMBER
andT_DNUMBER
tokens is affected for the token walking part until PHPCS 3.5.3.T_LNUMBER
ofT_DNUMBER
needs to be examined - like in theCronInterval
sniff, but probably in a few more sniffs -, the numeric value of the$token['content']
will need to be cast to(int)
/(float)
before doing any comparison or calculations with that number.Refs:
Related to #764
The text was updated successfully, but these errors were encountered: