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

Upgrade PHPCompatibility to 7.1.5 #45

Merged
merged 2 commits into from
Jan 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions PHPCompatibility/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,25 @@ matrix:
- php: nightly
env: PHPCS_VERSION="2.9.x-dev"

- php: hhvm
dist: trusty
env: PHPCS_VERSION=">=1.5.1,<2.0"
- php: hhvm
dist: trusty
env: PHPCS_VERSION="2.9.x-dev"

allow_failures:
# Allow failures for unstable builds.
- php: nightly
- php: hhvm

before_install:
- export XMLLINT_INDENT=" "
# PHP 5.3+: set up test environment using Composer.
- if [[ $TRAVIS_PHP_VERSION > "5.2" ]]; then composer self-update; fi
- if [[ $TRAVIS_PHP_VERSION > "5.2" && $TRAVIS_PHP_VERSION != "nightly" ]]; then composer require --dev satooshi/php-coveralls:${COVERALLS_VERSION}; fi
- if [[ $TRAVIS_PHP_VERSION > "5.2" && $COVERALLS_VERSION ]]; then composer require --dev satooshi/php-coveralls:${COVERALLS_VERSION};fi
- if [[ $TRAVIS_PHP_VERSION > "5.2" ]]; then composer require squizlabs/php_codesniffer:${PHPCS_VERSION}; fi
- if [[ $TRAVIS_PHP_VERSION == hhv* ]]; then composer require phpunit/phpunit:~4.0; fi
- if [[ $TRAVIS_PHP_VERSION > "5.2" ]]; then composer install; fi
# PHP 5.2: set up test environment using git cloning.
- if [[ $TRAVIS_PHP_VERSION < "5.3" ]]; then export PHPCS_DIR=/tmp/phpcs; fi
Expand All @@ -74,7 +83,7 @@ before_install:
- if [[ $TRAVIS_PHP_VERSION < "5.3" ]]; then $PHPCS_BIN --config-set installed_paths "$(dirname "$(pwd)")"; fi

before_script:
- if [[ $TRAVIS_PHP_VERSION > "5.2" && $TRAVIS_PHP_VERSION != "nightly" ]]; then mkdir -p build/logs; fi
- if [[ $COVERALLS_VERSION ]]; then mkdir -p build/logs; fi
- phpenv rehash

script:
Expand All @@ -83,15 +92,16 @@ script:
- if [[ $TRAVIS_PHP_VERSION > "5.2" ]]; then find -L . -path ./Tests/sniff-examples -prune -o -path ./vendor -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l; fi
- if [[ $TRAVIS_PHP_VERSION < "5.3" ]]; then find -L . -path ./Tests/sniff-examples -prune -o -path ./Tests/PHPUnit6Compat.php -prune -o -path ./vendor -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l; fi
# Check the code style of the code base.
- if [[ "$SNIFF" == "1" ]]; then vendor/bin/phpcs . --standard=./phpcs.xml; fi
- if [[ "$SNIFF" == "1" ]]; then vendor/bin/phpcs . --standard=./phpcs.xml --runtime-set ignore_warnings_on_exit 1; fi
# Run the unit tests.
- if [[ $TRAVIS_PHP_VERSION > "5.2" && $TRAVIS_PHP_VERSION != "nightly" ]]; then phpunit --configuration phpunit-travis.xml --coverage-clover build/logs/clover.xml; fi
- if [[ $COVERALLS_VERSION ]]; then phpunit --configuration phpunit-travis.xml --coverage-clover build/logs/clover.xml; fi
- if [[ $TRAVIS_PHP_VERSION == "5.2" || $TRAVIS_PHP_VERSION == "nightly" ]]; then phpunit --configuration phpunit.xml; fi
- if [[ $TRAVIS_PHP_VERSION == hhv* ]]; then vendor/bin/phpunit --configuration phpunit.xml; fi
# Validate the xml file.
# @link http://xmlsoft.org/xmllint.html
- if [[ "$SNIFF" == "1" ]]; then xmllint --noout ./ruleset.xml; fi
# Check the code-style consistency of the xml files.
- if [[ "$SNIFF" == "1" ]]; then diff -B ./ruleset.xml <(xmllint --format "./ruleset.xml"); fi

after_success:
- if [[ $TRAVIS_PHP_VERSION > "5.2" && $TRAVIS_PHP_VERSION != "nightly" ]]; then php vendor/bin/coveralls -v -x build/logs/clover.xml; fi
- if [[ $COVERALLS_VERSION ]]; then php vendor/bin/coveralls -v -x build/logs/clover.xml; fi
2 changes: 1 addition & 1 deletion PHPCompatibility/AbstractRemovedFeatureSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function getErrorInfo(array $itemArray, array $itemInfo)
if ($removed === true && $errorInfo['removed'] === '') {
$errorInfo['removed'] = $version;
$errorInfo['error'] = true;
} else if ($errorInfo['deprecated'] === '') {
} elseif ($errorInfo['deprecated'] === '') {
$errorInfo['deprecated'] = $version;
}
}
Expand Down
40 changes: 39 additions & 1 deletion PHPCompatibility/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,42 @@ The `patch` version numbers are specific to this library.
_Nothing yet._


## [7.1.5] - 2017-07-17

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

### Added
- :star: The `NewKeywords` sniff will now also sniff for `yield from` which was introduced in PHP 7.0. [#477](https://github.com/wimg/PHPCompatibility/pull/477). Fixes [#476](https://github.com/wimg/PHPCompatibility/issues/476)
- :books: The LGPL-3.0 license. [#447](https://github.com/wimg/PHPCompatibility/pull/447)

### Changed
- :rewind: The `NewExecutionDirectives` sniff will now also report on execution directives when used in combination with PHPCS 2.0.0-2.3.3. [#451](https://github.com/wimg/PHPCompatibility/pull/451)
- :rewind: The `getMethodParameters()` utility method will no longer break when used with PHPCS 1.5.x < 1.5.6. This affected a number of sniffs. [#452](https://github.com/wimg/PHPCompatibility/pull/452)
- :rewind: The `inUseScope()` utility method will no longer break when used with PHPCS 2.0.0 - 2.2.0. This affected a number of sniffs. [#454](https://github.com/wimg/PHPCompatibility/pull/454)
- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#443](https://github.com/wimg/PHPCompatibility/pull/443), [#474](https://github.com/wimg/PHPCompatibility/pull/474)
- :pencil2: Renamed a test file for consistency. [#453](https://github.com/wimg/PHPCompatibility/pull/453)
- :wrench: Code style clean up. [#429](https://github.com/wimg/PHPCompatibility/pull/429)
- :wrench: Prevent Composer installing PHPCS 3.x. **_PHPCS 3.x is not (yet) supported by the PHPCompatibility standard, but will be in the near future._** [#444](https://github.com/wimg/PHPCompatibility/pull/444)
- :green_heart: The code base will now be checked for consistent code style during build testing. [#429](https://github.com/wimg/PHPCompatibility/pull/429)
- :green_heart: The sniffs are now also tested against HHVM for consistent results. _Note: the sniffs do not contain any HHVM specific checks nor is there any intention to add them at this time._ [#450](https://github.com/wimg/PHPCompatibility/pull/450)
- :books: Made it explicit that - at this moment - PHPCS 3.x is not (yet) supported. [#444](https://github.com/wimg/PHPCompatibility/pull/444)
- :books: Minor improvements to the Readme. [#448](https://github.com/wimg/PHPCompatibility/pull/448), [#449](https://github.com/wimg/PHPCompatibility/pull/449), [#468](https://github.com/wimg/PHPCompatibility/pull/468)
- :books: Minor improvements to the Contributing guidelines. [#467](https://github.com/wimg/PHPCompatibility/pull/467)

### Removed
- :no_entry_sign: The `DefaultTimeZoneRequired` sniff. This sniff was checking server settings rather than code. [#458](https://github.com/wimg/PHPCompatibility/pull/458). Fixes [#457](https://github.com/wimg/PHPCompatibility/issues/457)
- :no_entry_sign: The `NewMagicClassConstant` sniff as introduced in v 7.1.4 contained two additional checks for not strictly compatibility related issues. One of these was plainly wrong, the other opinionated. Both have been removed. [#442](https://github.com/wimg/PHPCompatibility/pull/442). Fixes [#436](https://github.com/wimg/PHPCompatibility/issues/436)

### Fixed
- :bug: `NewClass` sniff: was reporting an incorrect introduction version number for a few of the Exception classes. [#441](https://github.com/wimg/PHPCompatibility/pull/441). Fixes [#440](https://github.com/wimg/PHPCompatibility/issues/440).
- :bug: `ForbiddenBreakContinueVariableArguments` sniff: was incorrectly reporting an error if the `break` or `continue` was followed by a PHP closing tag (breaking out of PHP). [#462](https://github.com/wimg/PHPCompatibility/pull/462). Fixes [#460](https://github.com/wimg/PHPCompatibility/issues/460)
- :bug: `ForbiddenGlobalVariableVariable` sniff: was incorrectly reporting an error if the `global` statement was followed by a PHP closing tag (breaking out of PHP). [#463](https://github.com/wimg/PHPCompatibility/pull/463).
- :bug: `DeprecatedFunctions` sniff: was reporting false positives for classes using the same name as a deprecated function. [#465](https://github.com/wimg/PHPCompatibility/pull/465). Fixes [#464](https://github.com/wimg/PHPCompatibility/issues/464)

### Credits
Thanks go out to [Juliette Reinders Folmer] and [Mark Clements] for their contributions to this version. :clap:


## [7.1.4] - 2017-05-06

See all related issues and PRs in the [7.1.4 milestone].
Expand Down Expand Up @@ -589,7 +625,8 @@ See all related issues and PRs in the [5.5 milestone].



[Unreleased]: https://github.com/wimg/PHPCompatibility/compare/7.1.4...HEAD
[Unreleased]: https://github.com/wimg/PHPCompatibility/compare/7.1.5...HEAD
[7.1.5]: https://github.com/wimg/PHPCompatibility/compare/7.1.4...7.1.5
[7.1.4]: https://github.com/wimg/PHPCompatibility/compare/7.1.3...7.1.4
[7.1.3]: https://github.com/wimg/PHPCompatibility/compare/7.1.2...7.1.3
[7.1.2]: https://github.com/wimg/PHPCompatibility/compare/7.1.1...7.1.2
Expand All @@ -606,6 +643,7 @@ See all related issues and PRs in the [5.5 milestone].
[7.0]: https://github.com/wimg/PHPCompatibility/compare/5.6...7.0
[5.6]: https://github.com/wimg/PHPCompatibility/compare/5.5...5.6

[7.1.5 milestone]: https://github.com/wimg/PHPCompatibility/milestone/17
[7.1.4 milestone]: https://github.com/wimg/PHPCompatibility/milestone/15
[7.1.3 milestone]: https://github.com/wimg/PHPCompatibility/milestone/14
[7.1.2 milestone]: https://github.com/wimg/PHPCompatibility/milestone/13
Expand Down
31 changes: 18 additions & 13 deletions PHPCompatibility/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
Hi, thank you for your interest in contributing to PHPCompatibility! We look forward to working with you.

Reporting bugs
--------------

Before reporting a bug, you should check what sniff an error is coming from.
Run `phpcs` with the `-s` flag will show the names of the sniffs with each error.
Running `phpcs` with the `-s` flag will show the names of the sniffs with each error.

Bug reports containing a minimal code sample which can be used to reproduce the issue are highly appreciated as those are most easily actionable.

Expand All @@ -18,36 +20,40 @@ Pull requests

Contributions in the form of pull requests are very welcome.

To start contributing, fork the repository, create a new branch in your fork, make your intended changes and pull the branch aginst the `master` branch of this repository.
To start contributing, fork the repository, create a new branch in your fork, make your intended changes and pull the branch against the `master` branch of this repository.

Please make sure that your pull request contains unit tests covering what's being addressed by it.

All code should be compatible with PHPCS 1.5.6 and PHPCS 2.x.
All code should be compatible with PHP 5.1 to PHP nightly.
All code should comply with the PHPCompatibility coding standards. The ruleset used by PHPCompatibility is largely based on PSR2 with minor variations and some additional checks for documentation and such.


Running the Sniff Tests
-----------------------
All the sniffs are fully tested with PHPUnit tests. In order to run the tests
on the sniffs, the following installation steps are required.

1. Install the master branch of `PHP_CodeSniffer`
[https://github.com/squizlabs/PHP_CodeSniffer.git].
1. Install the latest release from the `2.x` branch of [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer.git).

This can be done with composer using the following command:

This can be done with composer by adding the following into
`~/.composer/composer.json`:
$ composer require "squizlabs/php_codesniffer=^2.0"

or by adding the following into `~/.composer/composer.json`:
```json
{
"require": {
"phpunit/phpunit": "3.7.*",
"squizlabs/php_codesniffer": ">=2.0"
"phpunit/phpunit": ">=4.0",
"squizlabs/php_codesniffer": "^2.0"
}
}
```

2. Run the following command to compose in the versions indicated in the above
global composer.json file:

$ composer.phar global install
$ composer global install

3. Update your system `$PATH` to include the globally composed files:

Expand All @@ -58,11 +64,10 @@ on the sniffs, the following installation steps are required.

$ ln -s /path/to/PHPCompatibility ~/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility

5. Verify standard is available with `phpcs -i`. The output should include
`PHPCompatibility`
5. Verify the standard is available with `phpcs -i`. The output should include `PHPCompatibility`.

6. Run the tests by running `phpunit` in the root directory of
PHPCompatibility. It will read the `phpunit.xml` file and execute the tests
6. Run the tests by running `phpunit` in the root directory of PHPCompatibility.
It will read the `phpunit.xml` file and execute the tests.


#### Issues when running the PHPCS Unit tests for another standard
Expand Down
Loading