Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 7.4: New NewNumericLiteralSeparator sniff #984

Merged
merged 1 commit into from Apr 10, 2020

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Mar 27, 2020

New sniff to detect PHP 7.4 numeric literals with an underscore separator.

Added support for underscore separators in numeric literals. Some examples:

  6.674_083e-11; // float
  299_792_458;   // decimal
  0xCAFE_F00D;   // hexadecimal
   0b0101_1111;   // binary

Refs:

Related to #808

@jrfnl
Copy link
Member Author

jrfnl commented Mar 27, 2020

Note: I've added a new sniff category Numbers for this sniff and would like to suggest moving the PHPCompatibility.Miscellanous.ValidIntegers sniff to this category as well.

New sniff to detect PHP 7.4 numeric literals with an underscore separator.

> Added support for underscore separators in numeric literals. Some examples:
>
>       6.674_083e-11; // float
>       299_792_458;   // decimal
>       0xCAFE_F00D;   // hexadecimal
>        0b0101_1111;   // binary

Refs:
* https://www.php.net/manual/en/migration74.new-features.php#migration74.new-features.core.numeric-literal-separator
* https://github.com/php/php-src/blob/8f4e24eeef7bd1c39fabf5bea016abb287a4c606/UPGRADING#L189-L196
* https://wiki.php.net/rfc/numeric_literal_separator
* php/php-src#4165
* php/php-src@f74109d

Related to 808
@wimg wimg merged commit 27d1992 into develop Apr 10, 2020
@wimg wimg deleted the php74/new-numeric-literals-sniff branch April 10, 2020 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants