Skip to content

Commit

Permalink
Merge pull request #926 from PHPCompatibility/develop
Browse files Browse the repository at this point in the history
Release PHPCompatibility 9.3.3
  • Loading branch information
jrfnl committed Nov 11, 2019
2 parents bfca2be + f79c3a2 commit 1af08ca
Show file tree
Hide file tree
Showing 32 changed files with 573 additions and 30 deletions.
22 changes: 19 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ From version 8.0.0 onwards, [Semantic Versioning](http://semver.org/) is used.

_Nothing yet._

## [9.3.3] - 2019-11-11

See all related issues and PRs in the [9.3.3 milestone].

### Added
- :star: `PHPCompatibility.Constants.NewConstants` sniff: detection of yet more (undocumented) PHP 7.2 Sodium constants. [#924](https://github.com/PHPCompatibility/PHPCompatibility/pull/924)
- :star: `PHPCompatibility.Keywords.ForbiddenNames` sniff: detect the use of more reserved keywords which are not allowed to be used to name certain constructs. [#923](https://github.com/PHPCompatibility/PHPCompatibility/pull/923). Fixes [#922](https://github.com/PHPCompatibility/PHPCompatibility/issues/922)

### Fixed
- :bug: `PHPCompatibility.FunctionNameRestrictions.RemovedPHP4StyleConstructors`: false positive detecting PHP4-style constructors when declared in interfaces. The class implementing the interface will not have the same name as the interface, so the actual method would not be regarded as a PHP4 style constructor. [#921](https://github.com/PHPCompatibility/PHPCompatibility/pull/921)

### Credits
Thanks go out to [Nikhil] for their contribution to this version. :clap:


## [9.3.2] - 2019-10-16

See all related issues and PRs in the [9.3.2 milestone].
Expand All @@ -24,15 +39,15 @@ See all related issues and PRs in the [9.3.2 milestone].

### Changed
- :pushpin: `PHPCompatibility.FunctionNameRestrictions.RemovedPHP4StyleConstructors`: minor efficiency fix to make the sniff faster. [#912](https://github.com/PHPCompatibility/PHPCompatibility/pull/912)
- :pushpin: `PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames`: functions marked as `@deprecated` in the function docblock will now be ignored by this sniff. [#917](https://github.com/PHPCompatibility/PHPCompatibility/pull/917)
- :pushpin: `PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames`: functions marked as `@deprecated` in the function docblock will now be ignored by this sniff. [#917](https://github.com/PHPCompatibility/PHPCompatibility/pull/917). Fixes [#911](https://github.com/PHPCompatibility/PHPCompatibility/issues/911)
- :pencil: `PHPCompatibility.FunctionDeclarations.ForbiddenToStringParameters`: the `$ooScopeTokens` property is now `protected`, it should never have been `public` in the first place. [#907](https://github.com/PHPCompatibility/PHPCompatibility/pull/907)
- :recycle: More code documentation fixes. [#903](https://github.com/PHPCompatibility/PHPCompatibility/pull/903), [#916](https://github.com/PHPCompatibility/PHPCompatibility/pull/916)
- :books: Readme/Contributing: various tweaks. [#904](https://github.com/PHPCompatibility/PHPCompatibility/pull/904), [#905](https://github.com/PHPCompatibility/PHPCompatibility/pull/905)

### Fixed
- :bug: `PHPCompatibility.FunctionUse.OptionalToRequiredFunctionParameters`: false positive when a class is instantiated which has the same name as one of the affected functions. [#914](https://github.com/PHPCompatibility/PHPCompatibility/pull/914)
- :bug: `PHPCompatibility.FunctionUse.OptionalToRequiredFunctionParameters`: false positive when a class is instantiated which has the same name as one of the affected functions. [#914](https://github.com/PHPCompatibility/PHPCompatibility/pull/914). Fixes [#913](https://github.com/PHPCompatibility/PHPCompatibility/issues/913)
- :bug: `PHPCompatibility.FunctionUse.RequiredToOptionalFunctionParameters`: false positive when a class is instantiated which has the same name as one of the affected functions. [#914](https://github.com/PHPCompatibility/PHPCompatibility/pull/914)
- :bug: `PHPCompatibility.MethodUse.NewDirectCallsToClone`: false positive on calling `__clone()` from within the class being cloned [#910](https://github.com/PHPCompatibility/PHPCompatibility/pull/910)
- :bug: `PHPCompatibility.MethodUse.NewDirectCallsToClone`: false positive on calling `__clone()` from within the class being cloned [#910](https://github.com/PHPCompatibility/PHPCompatibility/pull/910). Fixes [#629 (comment)](https://github.com/PHPCompatibility/PHPCompatibility/issues/629#issuecomment-532607809)
- :bug: `PHPCompatibility.Miscellaneous.ValidIntegers`: binary numbers using an uppercase `B` were not always recognized correctly. [#909](https://github.com/PHPCompatibility/PHPCompatibility/pull/909)


Expand Down Expand Up @@ -1419,6 +1434,7 @@ See all related issues and PRs in the [5.5 milestone].
[Mark Clements]: https://github.com/MarkMaldaba
[Michael Babker]: https://github.com/mbabker
[Nick Pack]: https://github.com/nickpack
[Nikhil]: https://github.com/Nikschavan
[Oliver Klee]: https://github.com/oliverklee
[Remko van Bezooijen]: https://github.com/emkookmer
[Rowan Collins]: https://github.com/IMSoP
Expand Down
64 changes: 64 additions & 0 deletions PHPCompatibility/Sniffs/Constants/NewConstantsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -2684,6 +2684,22 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
'7.1' => false,
'7.2' => true,
),
'SODIUM_BASE64_VARIANT_ORIGINAL' => array(
'7.1' => false,
'7.2' => true,
),
'SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING' => array(
'7.1' => false,
'7.2' => true,
),
'SODIUM_BASE64_VARIANT_URLSAFE' => array(
'7.1' => false,
'7.2' => true,
),
'SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING' => array(
'7.1' => false,
'7.2' => true,
),
'SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES' => array(
'7.1' => false,
'7.2' => true,
Expand Down Expand Up @@ -2732,6 +2748,22 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
'7.1' => false,
'7.2' => true,
),
'SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES' => array(
'7.1' => false,
'7.2' => true,
),
'SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NSECBYTES' => array(
'7.1' => false,
'7.2' => true,
),
'SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES' => array(
'7.1' => false,
'7.2' => true,
),
'SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_ABYTES' => array(
'7.1' => false,
'7.2' => true,
),
'SODIUM_CRYPTO_AUTH_BYTES' => array(
'7.1' => false,
'7.2' => true,
Expand Down Expand Up @@ -2924,6 +2956,38 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
'7.1' => false,
'7.2' => true,
),
'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_ABYTES' => array(
'7.1' => false,
'7.2' => true,
),
'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES' => array(
'7.1' => false,
'7.2' => true,
),
'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_KEYBYTES' => array(
'7.1' => false,
'7.2' => true,
),
'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_MESSAGEBYTES_MAX' => array(
'7.1' => false,
'7.2' => true,
),
'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE' => array(
'7.1' => false,
'7.2' => true,
),
'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PUSH' => array(
'7.1' => false,
'7.2' => true,
),
'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_REKEY' => array(
'7.1' => false,
'7.2' => true,
),
'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_FINAL' => array(
'7.1' => false,
'7.2' => true,
),
'SODIUM_CRYPTO_SIGN_BYTES' => array(
'7.1' => false,
'7.2' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public function register()
{
return array(
\T_CLASS,
\T_INTERFACE,
);
}

Expand Down
17 changes: 16 additions & 1 deletion PHPCompatibility/Sniffs/Keywords/ForbiddenNamesSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,20 @@ class ForbiddenNamesSniff extends Sniff
'continue' => 'all',
'declare' => 'all',
'default' => 'all',
'die' => 'all',
'do' => 'all',
'echo' => 'all',
'else' => 'all',
'elseif' => 'all',
'empty' => 'all',
'enddeclare' => 'all',
'endfor' => 'all',
'endforeach' => 'all',
'endif' => 'all',
'endswitch' => 'all',
'endwhile' => 'all',
'eval' => 'all',
'exit' => 'all',
'extends' => 'all',
'final' => '5.0',
'finally' => '5.5',
Expand All @@ -60,24 +65,34 @@ class ForbiddenNamesSniff extends Sniff
'goto' => '5.3',
'if' => 'all',
'implements' => '5.0',
'interface' => '5.0',
'include' => 'all',
'include_once' => 'all',
'instanceof' => '5.0',
'insteadof' => '5.4',
'interface' => '5.0',
'isset' => 'all',
'list' => 'all',
'namespace' => '5.3',
'new' => 'all',
'or' => 'all',
'print' => 'all',
'private' => '5.0',
'protected' => '5.0',
'public' => '5.0',
'require' => 'all',
'require_once' => 'all',
'return' => 'all',
'static' => 'all',
'switch' => 'all',
'throw' => '5.0',
'trait' => '5.4',
'try' => '5.0',
'unset' => 'all',
'use' => 'all',
'var' => 'all',
'while' => 'all',
'xor' => 'all',
'yield' => '5.5',
'__class__' => 'all',
'__dir__' => '5.3',
'__file__' => 'all',
Expand Down
16 changes: 16 additions & 0 deletions PHPCompatibility/Tests/Constants/NewConstantsUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -863,3 +863,19 @@ echo T_BAD_CHARACTER;
echo IMG_FILTER_SCATTER;
echo PASSWORD_ARGON2_PROVIDER;
echo SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13;
echo SODIUM_BASE64_VARIANT_ORIGINAL;
echo SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING;
echo SODIUM_BASE64_VARIANT_URLSAFE;
echo SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING;
echo SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES;
echo SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NSECBYTES;
echo SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES;
echo SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_ABYTES;
echo SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_ABYTES;
echo SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES;
echo SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_KEYBYTES;
echo SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_MESSAGEBYTES_MAX;
echo SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE;
echo SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PUSH;
echo SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_REKEY;
echo SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_FINAL;
16 changes: 16 additions & 0 deletions PHPCompatibility/Tests/Constants/NewConstantsUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,10 @@ public function dataNewConstant()
array('SODIUM_LIBRARY_VERSION', '7.1', array(627), '7.2'),
array('SODIUM_LIBRARY_MAJOR_VERSION', '7.1', array(628), '7.2'),
array('SODIUM_LIBRARY_MINOR_VERSION', '7.1', array(629), '7.2'),
array('SODIUM_BASE64_VARIANT_ORIGINAL', '7.1', array(866), '7.2'),
array('SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING', '7.1', array(867), '7.2'),
array('SODIUM_BASE64_VARIANT_URLSAFE', '7.1', array(868), '7.2'),
array('SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING', '7.1', array(869), '7.2'),
array('SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES', '7.1', array(630), '7.2'),
array('SODIUM_CRYPTO_AEAD_AES256GCM_NSECBYTES', '7.1', array(631), '7.2'),
array('SODIUM_CRYPTO_AEAD_AES256GCM_NPUBBYTES', '7.1', array(632), '7.2'),
Expand All @@ -701,6 +705,10 @@ public function dataNewConstant()
array('SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_NSECBYTES', '7.1', array(639), '7.2'),
array('SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES', '7.1', array(640), '7.2'),
array('SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_ABYTES', '7.1', array(641), '7.2'),
array('SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES', '7.1', array(870), '7.2'),
array('SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NSECBYTES', '7.1', array(871), '7.2'),
array('SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES', '7.1', array(872), '7.2'),
array('SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_ABYTES', '7.1', array(873), '7.2'),
array('SODIUM_CRYPTO_AUTH_BYTES', '7.1', array(642), '7.2'),
array('SODIUM_CRYPTO_AUTH_KEYBYTES', '7.1', array(643), '7.2'),
array('SODIUM_CRYPTO_BOX_SEALBYTES', '7.1', array(644), '7.2'),
Expand Down Expand Up @@ -744,6 +752,14 @@ public function dataNewConstant()
array('SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_SENSITIVE', '7.1', array(681), '7.2'),
array('SODIUM_CRYPTO_SCALARMULT_BYTES', '7.1', array(682), '7.2'),
array('SODIUM_CRYPTO_SCALARMULT_SCALARBYTES', '7.1', array(683), '7.2'),
array('SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_ABYTES', '7.1', array(874), '7.2'),
array('SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES', '7.1', array(875), '7.2'),
array('SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_KEYBYTES', '7.1', array(876), '7.2'),
array('SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_MESSAGEBYTES_MAX', '7.1', array(877), '7.2'),
array('SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE', '7.1', array(878), '7.2'),
array('SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PUSH', '7.1', array(879), '7.2'),
array('SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_REKEY', '7.1', array(880), '7.2'),
array('SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_FINAL', '7.1', array(881), '7.2'),
array('SODIUM_CRYPTO_SHORTHASH_BYTES', '7.1', array(684), '7.2'),
array('SODIUM_CRYPTO_SHORTHASH_KEYBYTES', '7.1', array(685), '7.2'),
array('SODIUM_CRYPTO_SECRETBOX_KEYBYTES', '7.1', array(686), '7.2'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public function dataIsDeprecated()
array(3),
array(18),
array(33),
array(37),
array(66),
);
}
Expand Down Expand Up @@ -86,6 +85,7 @@ public function dataNoFalsePositives()
array(9),
array(12),
array(26),
array(37),
array(41),
array(42),
array(47),
Expand Down
17 changes: 16 additions & 1 deletion PHPCompatibility/Tests/Keywords/ForbiddenNames/class-const.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,20 @@ class Foobar { const CONST = 1; }
class Foobar { const CONTINUE = 1; }
class Foobar { const DECLARE = 1; }
class Foobar { const DEFAULT = 1; }
class Foobar { const DIE = 1; }
class Foobar { const DO = 1; }
class Foobar { const ECHO = 1; }
class Foobar { const ELSE = 1; }
class Foobar { const ELSEIF = 1; }
class Foobar { const EMPTY = 1; }
class Foobar { const ENDDECLARE = 1; }
class Foobar { const ENDFOR = 1; }
class Foobar { const ENDFOREACH = 1; }
class Foobar { const ENDIF = 1; }
class Foobar { const ENDSWITCH = 1; }
class Foobar { const ENDWHILE = 1; }
class Foobar { const EVAL = 1; }
class Foobar { const EXIT = 1; }
class Foobar { const EXTENDS = 1; }
class Foobar { const FINAL = 1; }
class Foobar { const FINALLY = 1; }
Expand All @@ -32,24 +37,34 @@ class Foobar { const GLOBAL = 1; }
class Foobar { const GOTO = 1; }
class Foobar { const IF = 1; }
class Foobar { const IMPLEMENTS = 1; }
class Foobar { const INTERFACE = 1; }
class Foobar { const INCLUDE = 1; }
class Foobar { const INCLUDE_ONCE = 1; }
class Foobar { const INSTANCEOF = 1; }
class Foobar { const INSTEADOF = 1; }
class Foobar { const INTERFACE = 1; }
class Foobar { const ISSET = 1; }
class Foobar { const LIST = 1; }
class Foobar { const NAMESPACE = 1; }
class Foobar { const NEW = 1; }
class Foobar { const OR = 1; }
class Foobar { const PRINT = 1; }
class Foobar { const PRIVATE = 1; }
class Foobar { const PROTECTED = 1; }
class Foobar { const PUBLIC = 1; }
class Foobar { const REQUIRE = 1; }
class Foobar { const REQUIRE_ONCE = 1; }
class Foobar { const RETURN = 1; }
class Foobar { const STATIC = 1; }
class Foobar { const SWITCH = 1; }
class Foobar { const THROW = 1; }
class Foobar { const TRAIT = 1; }
class Foobar { const TRY = 1; }
class Foobar { const UNSET = 1; }
class Foobar { const USE = 1; }
class Foobar { const VAR = 1; }
class Foobar { const WHILE = 1; }
class Foobar { const XOR = 1; }
class Foobar { const YIELD = 1; }
class Foobar { const __CLASS__ = 1; }
class Foobar { const __DIR__ = 1; }
class Foobar { const __FILE__ = 1; }
Expand Down
17 changes: 16 additions & 1 deletion PHPCompatibility/Tests/Keywords/ForbiddenNames/class-extends.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,20 @@ class Foobar extends const {}
class Foobar extends continue {}
class Foobar extends declare {}
class Foobar extends default {}
class Foobar extends die {}
class Foobar extends do {}
class Foobar extends echo {}
class Foobar extends else {}
class Foobar extends elseif {}
class Foobar extends empty {}
class Foobar extends enddeclare {}
class Foobar extends endfor {}
class Foobar extends endforeach {}
class Foobar extends endif {}
class Foobar extends endswitch {}
class Foobar extends endwhile {}
class Foobar extends eval {}
class Foobar extends exit {}
class Foobar extends extends {}
class Foobar extends final {}
class Foobar extends finally {}
Expand All @@ -33,24 +38,34 @@ class Foobar extends global {}
class Foobar extends goto {}
class Foobar extends if {}
class Foobar extends implements {}
class Foobar extends interface {}
class Foobar extends include {}
class Foobar extends include_once {}
class Foobar extends instanceof {}
class Foobar extends insteadof {}
class Foobar extends interface {}
class Foobar extends isset {}
class Foobar extends list {}
class Foobar extends namespace {}
class Foobar extends new {}
class Foobar extends or {}
class Foobar extends print {}
class Foobar extends private {}
class Foobar extends protected {}
class Foobar extends public {}
class Foobar extends require {}
class Foobar extends require_once {}
class Foobar extends return {}
class Foobar extends static {}
class Foobar extends switch {}
class Foobar extends throw {}
class Foobar extends trait {}
class Foobar extends try {}
class Foobar extends unset {}
class Foobar extends use {}
class Foobar extends var {}
class Foobar extends while {}
class Foobar extends xor {}
class Foobar extends yield {}
class Foobar extends __CLASS__ {}
class Foobar extends __DIR__ {}
class Foobar extends __FILE__ {}
Expand Down

0 comments on commit 1af08ca

Please sign in to comment.