Skip to content

Commit

Permalink
Merge pull request #954 from PHPCompatibility/develop
Browse files Browse the repository at this point in the history
Release PHPCompatibility 9.3.5
  • Loading branch information
jrfnl committed Dec 27, 2019
2 parents 1f37659 + 1eeea36 commit 9fb3244
Show file tree
Hide file tree
Showing 267 changed files with 2,555 additions and 360 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@
#
*.md text
*.php text
*.inc text
17 changes: 8 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ php:
- 7.0
- 7.1
- 7.2
- "7.4snapshot"

env:
global:
Expand Down Expand Up @@ -70,7 +69,7 @@ jobs:
# These are basically the same builds as in the Coverage stage, but then without doing
# the code-coverage.
- stage: quicktest
php: 7.3
php: 7.4
env: PHPCS_VERSION="dev-master" LINT=1
- php: 7.3
env: PHPCS_VERSION="2.3.0"
Expand Down Expand Up @@ -109,8 +108,12 @@ jobs:
# While on PHPCS 2.x, the tests won't fail, on PHPCS 3.x < 3.3.1, they will.
- php: 7.3
env: PHPCS_VERSION="3.4.*" LINT=1
- php: "7.4snapshot"
env: PHPCS_VERSION=">=2.0,<3.0"
- php: 7.3
env: PHPCS_VERSION="dev-master"
- php: 7.4
env: PHPCS_VERSION=">=2.0,<3.0" LINT=1
- php: 7.4
env: PHPCS_VERSION="2.3.0"

#### CODE COVERAGE STAGE ####
# N.B.: Coverage is only checked on the lowest and highest stable PHP versions for all PHPCS versions.
Expand All @@ -121,7 +124,7 @@ jobs:
# would be preferred.
# Docs: https://docs.travis-ci.com/user/languages/php/#custom-php-configuration
- stage: coverage
php: 7.3
php: 7.4
env: PHPCS_VERSION="dev-master" COVERALLS_VERSION="^2.0" CUSTOM_INI=1
- php: 7.3
env: PHPCS_VERSION="2.3.0" COVERALLS_VERSION="^2.0"
Expand All @@ -139,10 +142,6 @@ jobs:
dist: precise
env: PHPCS_VERSION="2.3.0" COVERALLS_VERSION="^1.0"

allow_failures:
# Allow failures for unstable builds.
- php: "7.4snapshot"

before_install:
# Speed up build time by disabling Xdebug when its not needed.
- |
Expand Down
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,29 @@ From version 8.0.0 onwards, [Semantic Versioning](http://semver.org/) is used.

_Nothing yet._

## [9.3.5] - 2019-12-27

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

### Added
- :star: `PHPCompatibility.Classes.NewClasses` sniff: recognize the new `FFI` extension related classes as introduced in PHP 7.4. [#949](https://github.com/PHPCompatibility/PHPCompatibility/pull/949)
- :star: `PHPCompatibility.IniDirectives.NewIniDirectives` sniff: detect use of the new `FFI` extension related ini directives as introduced in PHP 7.4. [#949](https://github.com/PHPCompatibility/PHPCompatibility/pull/949)

### Changed
- :pencil: `PHPCompatibility.Syntax.NewShortArray`: improved clarity of the error message and made it consistent with other error messages in this standard. [#934](https://github.com/PHPCompatibility/PHPCompatibility/pull/934)
- :pencil: `PHPCompatibility.Interfaces.NewInterfaces`: updated the URL which is mentioned in select error messages. [#942](https://github.com/PHPCompatibility/PHPCompatibility/pull/942)
- :recycle: Another slew of code documentation fixes. [#937](https://github.com/PHPCompatibility/PHPCompatibility/pull/937), [#939](https://github.com/PHPCompatibility/PHPCompatibility/pull/939), [#940](https://github.com/PHPCompatibility/PHPCompatibility/pull/940), [#941](https://github.com/PHPCompatibility/PHPCompatibility/pull/941), [#943](https://github.com/PHPCompatibility/PHPCompatibility/pull/943), [#944](https://github.com/PHPCompatibility/PHPCompatibility/pull/944), [#951](https://github.com/PHPCompatibility/PHPCompatibility/pull/951), [#950](https://github.com/PHPCompatibility/PHPCompatibility/pull/950). Fixes [#734](https://github.com/PHPCompatibility/PHPCompatibility/issues/734).
- :green_heart: Travis: various tweaks. The builds against PHP 7.4 are no longer allowed to fail. [#935](https://github.com/PHPCompatibility/PHPCompatibility/pull/935), [#938](https://github.com/PHPCompatibility/PHPCompatibility/pull/938)
For running the sniffs on PHP 7.4, it is recommended to use PHP_CodeSniffer 3.5.0+ as PHP_CodeSniffer itself is
not compatible with PHP 7.4 until version 3.5.0.

### Fixed
- :bug: `PHPCompatibility.Classes.NewClasses`: two new PHP 7.4 classes were being checked as if they were Exceptions. [#945](https://github.com/PHPCompatibility/PHPCompatibility/pull/945)

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


## [9.3.4] - 2019-11-15

See all related issues and PRs in the [9.3.4 milestone].
Expand Down Expand Up @@ -1369,6 +1392,7 @@ See all related issues and PRs in the [5.5 milestone].


[Unreleased]: https://github.com/PHPCompatibility/PHPCompatibility/compare/master...HEAD
[9.3.5]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.4...9.3.5
[9.3.4]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.3...9.3.4
[9.3.3]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.2...9.3.3
[9.3.2]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.1...9.3.2
Expand Down Expand Up @@ -1399,6 +1423,7 @@ See all related issues and PRs in the [5.5 milestone].
[7.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/5.6...7.0
[5.6]: https://github.com/PHPCompatibility/PHPCompatibility/compare/5.5...5.6

[9.3.5 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/34
[9.3.4 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/33
[9.3.3 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/32
[9.3.2 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/31
Expand Down Expand Up @@ -1458,5 +1483,6 @@ See all related issues and PRs in the [5.5 milestone].
[Sergii Bondarenko]: https://github.com/BR0kEN-
[Tadas Juozapaitis]: https://github.com/kasp3r
[Tim Millwood]: https://github.com/timmillwood
[William Entriken]: https://github.com/fulldecent
[Yılmaz]: https://github.com/edigu
[Yoshiaki Yoshida]: https://github.com/kakakakakku
10 changes: 7 additions & 3 deletions PHPCSAliases.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* @copyright 2012-2019 PHPCompatibility Contributors
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
* @link https://github.com/PHPCompatibility/PHPCompatibility
*
* @since 8.0.0
*/

/*
Expand All @@ -19,11 +21,11 @@
* {@internal The PHPCS file have been reorganized in PHPCS 3.x, quite
* a few "old" classes have been split and spread out over several "new"
* classes. In other words, this will only work for a limited number
* of classes.}}
* of classes.}
*
* {@internal The `class_exists` wrappers are needed to play nice with other
* external PHPCS standards creating cross-version compatibility in the same
* manner.}}
* manner.}
*/
if (defined('PHPCOMPATIBILITY_PHPCS_ALIASES_SET') === false) {
if (interface_exists('\PHP_CodeSniffer_Sniff') === false) {
Expand Down Expand Up @@ -52,7 +54,9 @@ class_alias('PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCap
*
* {@internal When `installed_paths` is set via the ruleset, this autoloader
* is needed to run the sniffs.
* Upstream issue: {@link https://github.com/squizlabs/PHP_CodeSniffer/issues/1591} }}
* Upstream issue: {@link https://github.com/squizlabs/PHP_CodeSniffer/issues/1591} }
*
* @since 8.0.0
*/
spl_autoload_register(function ($class) {
// Only try & load our own classes.
Expand Down
18 changes: 18 additions & 0 deletions PHPCompatibility/AbstractComplexVersionSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

/**
* Abstract base class for sniffs based on complex arrays with PHP version information.
*
* @since 7.1.0
*/
abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersionInterface
{
Expand All @@ -23,6 +25,8 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
* Handle the retrieval of relevant information and - if necessary - throwing of an
* error/warning for an item.
*
* @since 7.1.0
*
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the relevant token in
* the stack.
Expand All @@ -44,6 +48,8 @@ public function handleFeature(File $phpcsFile, $stackPtr, array $itemInfo)
/**
* Determine whether an error/warning should be thrown for an item based on collected information.
*
* @since 7.1.0
*
* @param array $errorInfo Detail information about an item.
*
* @return bool
Expand All @@ -54,6 +60,8 @@ abstract protected function shouldThrowError(array $errorInfo);
/**
* Get an array of the non-PHP-version array keys used in a sub-array.
*
* @since 7.1.0
*
* @return array
*/
protected function getNonVersionArrayKeys()
Expand All @@ -66,6 +74,8 @@ protected function getNonVersionArrayKeys()
* Retrieve a subset of an item array containing only the array keys which
* contain PHP version information.
*
* @since 7.1.0
*
* @param array $itemArray Version and other information about an item.
*
* @return array Array with only the version information.
Expand All @@ -79,6 +89,8 @@ protected function getVersionArray(array $itemArray)
/**
* Get the item name to be used for the creation of the error code and in the error message.
*
* @since 7.1.0
*
* @param array $itemInfo Base information about the item.
* @param array $errorInfo Detail information about an item.
*
Expand All @@ -93,6 +105,8 @@ protected function getItemName(array $itemInfo, array $errorInfo)
/**
* Get the error message template for a specific sniff.
*
* @since 7.1.0
*
* @return string
*/
abstract protected function getErrorMsgTemplate();
Expand All @@ -101,6 +115,8 @@ abstract protected function getErrorMsgTemplate();
/**
* Allow for concrete child classes to filter the error message before it's passed to PHPCS.
*
* @since 7.1.0
*
* @param string $error The error message which was created.
* @param array $itemInfo Base information about the item this error message applies to.
* @param array $errorInfo Detail information about an item this error message applies to.
Expand All @@ -116,6 +132,8 @@ protected function filterErrorMsg($error, array $itemInfo, array $errorInfo)
/**
* Allow for concrete child classes to filter the error data before it's passed to PHPCS.
*
* @since 7.1.0
*
* @param array $data The error data array which was created.
* @param array $itemInfo Base information about the item this error message applies to.
* @param array $errorInfo Detail information about an item this error message applies to.
Expand Down
18 changes: 18 additions & 0 deletions PHPCompatibility/AbstractFunctionCallParameterSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

/**
* Abstract class to use as a base for examining the parameter values passed to function calls.
*
* @since 8.2.0
*/
abstract class AbstractFunctionCallParameterSniff extends Sniff
{
Expand All @@ -26,6 +28,8 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
* the method called is of the right class/object.
* Checking that is outside of the scope of this abstract sniff.
*
* @since 8.2.0
*
* @var bool False (default) if the sniff is looking for function calls.
* True if the sniff is looking for method calls.
*/
Expand All @@ -34,6 +38,8 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
/**
* Functions the sniff is looking for. Should be defined in the child class.
*
* @since 8.2.0
*
* @var array The only requirement for this array is that the top level
* array keys are the names of the functions you're looking for.
* Other than that, the array can have arbitrary content
Expand All @@ -45,6 +51,8 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
* List of tokens which when they preceed the $stackPtr indicate that this
* is not a function call.
*
* @since 8.2.0
*
* @var array
*/
private $ignoreTokens = array(
Expand All @@ -60,6 +68,8 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
/**
* Returns an array of tokens this test wants to listen for.
*
* @since 8.2.0
*
* @return array
*/
public function register()
Expand All @@ -74,6 +84,8 @@ public function register()
/**
* Processes this test, when one of its tokens is encountered.
*
* @since 8.2.0
*
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the current token in
* the stack passed in $tokens.
Expand Down Expand Up @@ -131,6 +143,8 @@ public function process(File $phpcsFile, $stackPtr)
/**
* Do a version check to determine if this sniff needs to run at all.
*
* @since 8.2.0
*
* If the check done in a child class is not specific to one PHP version,
* this function should return `false`.
*
Expand All @@ -144,6 +158,8 @@ abstract protected function bowOutEarly();
*
* This method has to be made concrete in child classes.
*
* @since 8.2.0
*
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the current token in the stack.
* @param string $functionName The token content (function name) which was matched.
Expand All @@ -161,6 +177,8 @@ abstract public function processParameters(File $phpcsFile, $stackPtr, $function
* Defaults to doing nothing. Can be overloaded in child classes to handle functions
* were parameters are expected, but none found.
*
* @since 8.2.0
*
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the current token in the stack.
* @param string $functionName The token content (function name) which was matched.
Expand Down
10 changes: 10 additions & 0 deletions PHPCompatibility/AbstractNewFeatureSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

/**
* Base class for new feature sniffs.
*
* @since 7.1.0
*/
abstract class AbstractNewFeatureSniff extends AbstractComplexVersionSniff
{
Expand All @@ -22,6 +24,8 @@ abstract class AbstractNewFeatureSniff extends AbstractComplexVersionSniff
/**
* Determine whether an error/warning should be thrown for an item based on collected information.
*
* @since 7.1.0
*
* @param array $errorInfo Detail information about an item.
*
* @return bool
Expand All @@ -35,6 +39,8 @@ protected function shouldThrowError(array $errorInfo)
/**
* Retrieve the relevant detail (version) information for use in an error message.
*
* @since 7.1.0
*
* @param array $itemArray Version and other information about the item.
* @param array $itemInfo Base information about the item.
*
Expand Down Expand Up @@ -66,6 +72,8 @@ public function getErrorInfo(array $itemArray, array $itemInfo)
/**
* Get the error message template for this sniff.
*
* @since 7.1.0
*
* @return string
*/
protected function getErrorMsgTemplate()
Expand All @@ -77,6 +85,8 @@ protected function getErrorMsgTemplate()
/**
* Generates the error or warning for this item.
*
* @since 7.1.0
*
* @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the relevant token in
* the stack.
Expand Down

0 comments on commit 9fb3244

Please sign in to comment.