Skip to content

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented Sep 11, 2018

This sniff will check that PHP type casts are:

  • lowercase;
  • short form, i.e. (bool) not (boolean);
  • normalized, i.e. (float) not (real).

The sniff also discourages the use of the (unset) and the (binary) casts, including the b"$string" binary cast, though it is susceptible to bug squizlabs/PHP_CodeSniffer#1574.

The sniff has been added to the WordPress-Core ruleset.

Once the minimum PHPCS version has gone up to PHPCS 3.3.0+, the lowercase check part of the sniff can be removed in favour of adding the Generic.PHP.LowerCaseType sniff to the ruleset instead.

Fixes #1481

This sniff will check that PHP type casts are:
- lowercase;
- short form, i.e. (bool) not (boolean);
- normalized, i.e. (float) not (real).

The sniff also discourages the use of the `(unset)` and the `(binary)` casts, including the `b"$string"` binary cast, though it is susceptible to bug squizlabs/PHP_CodeSniffer 1574.

The sniff has been added to the `WordPress-Core` ruleset.

Once the minimum PHPCS version has gone up to PHPCS 3.3.0+, the lowercase check part of the sniff can be removed in favour of adding the `Generic.PHP.LowerCaseType` sniff  to the ruleset instead.

Fixes 1481
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.

4 participants