diff --git a/.gitattributes b/.gitattributes index f9118ff..d3625d7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7,7 +7,7 @@ # /.gitattributes export-ignore /.gitignore export-ignore -/.travis.yml export-ignore +/.github export-ignore /phpcs.xml.dist export-ignore /phpunit.xml.dist export-ignore /phpunit-bootstrap.php export-ignore diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml new file mode 100644 index 0000000..31b658c --- /dev/null +++ b/.github/workflows/cs.yml @@ -0,0 +1,66 @@ +name: CS + +on: + # Run on all pushes and on all pull requests. + # Prevent the build from running when there are only irrelevant changes. + push: + paths-ignore: + - '**.md' + pull_request: + paths-ignore: + - '**.md' + +jobs: + checkcs: + name: 'Basic CS and QA checks' + runs-on: ubuntu-latest + + env: + XMLLINT_INDENT: ' ' + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + coverage: none + + - name: 'Composer: adjust dependencies' + run: | + # The sniff stage doesn't run the unit tests, so no need for PHPUnit. + composer remove --no-update --dev phpunit/phpunit --no-scripts + # Using PHPCS `master` as an early detection system for bugs upstream. + composer require --no-update squizlabs/php_codesniffer:"dev-master" + + # Install dependencies and handle caching in one go. + # @link https://github.com/marketplace/actions/install-composer-dependencies + - name: Install Composer dependencies + uses: "ramsey/composer-install@v1" + + - name: Install xmllint + run: sudo apt-get install --no-install-recommends -y libxml2-utils + + # Show XML violations inline in the file diff. + # @link https://github.com/marketplace/actions/xmllint-problem-matcher + - uses: korelstar/xmllint-problem-matcher@v1 + + # Validate the XML file. + # @link http://xmlsoft.org/xmllint.html + - name: Validate ruleset against schema + run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd PHPCSDebug/ruleset.xml + + # Check the code-style consistency of the XML file. + - name: Check XML code style + run: diff -B ./PHPCSDebug/ruleset.xml <(xmllint --format "./PHPCSDebug/ruleset.xml") + + # Check the code-style consistency of the PHP files. + - name: Check PHP code style + run: composer check-cs + + # Validate the composer.json file. + # @link https://getcomposer.org/doc/03-cli.md#validate + - name: Validate Composer installation + run: composer validate --no-check-all --strict diff --git a/.github/workflows/quicktest.yml b/.github/workflows/quicktest.yml new file mode 100644 index 0000000..97e2f1f --- /dev/null +++ b/.github/workflows/quicktest.yml @@ -0,0 +1,80 @@ +name: Quicktest + +on: + # Run on pushes, including merges, to all branches except `master`. + push: + branches-ignore: + - master + paths-ignore: + - '**.md' + +jobs: + #### QUICK TEST STAGE #### + # This is a much quicker test which only runs the unit tests and linting against the low/high + # supported PHP/PHPCS combinations. + quicktest: + runs-on: ubuntu-latest + + strategy: + matrix: + php: ['5.4', 'latest'] + phpcs_version: ['dev-master'] + lint: [true] + + include: + - php: '7.2' + phpcs_version: '3.1.0' + lint: false + - php: '5.4' + phpcs_version: '3.1.0' + lint: false + + name: "QTest${{ matrix.lint && ' + Lint' || '' }}: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}" + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + # On stable PHPCS versions, allow for PHP deprecation notices. + # Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore. + - name: Setup ini config + id: set_ini + run: | + if [ "${{ matrix.phpcs_version }}" != "dev-master" ]; then + echo '::set-output name=PHP_INI::error_reporting=E_ALL & ~E_DEPRECATED' + else + echo '::set-output name=PHP_INI::error_reporting=E_ALL' + fi + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + ini-values: ${{ steps.set_ini.outputs.PHP_INI }} + coverage: none + + - name: 'Composer: adjust dependencies' + run: | + # Set the PHPCS version to be used in the tests. + composer require --no-update squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-scripts + # Remove the PHPCSDevCS dependency as it has different PHPCS requirements and would block installs. + composer remove --no-update --dev phpcsstandards/phpcsdevcs --no-scripts + + # Install dependencies and handle caching in one go. + # @link https://github.com/marketplace/actions/install-composer-dependencies + - name: Install Composer dependencies + uses: "ramsey/composer-install@v1" + + - name: Lint against parse errors + if: ${{ matrix.lint }} + run: composer lint + + # Check that any sniffs available are feature complete. + # This also acts as an integration test for the feature completeness script, + # which is why it is run against various PHP versions and not in the "Sniff" stage. + - name: Check for feature completeness + if: ${{ matrix.lint }} + run: composer check-complete + + - name: Run the unit tests + run: composer run-tests diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..4b4e0bf --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,120 @@ +name: Test + +on: + # Run on pushes to `master` and on all pull requests. + push: + branches: + - master + pull_request: + paths-ignore: + - '**.md' + +jobs: + #### TEST STAGE #### + test: + runs-on: ubuntu-latest + + strategy: + # Keys: + # - experimental: Whether the build is "allowed to fail". + matrix: + # IMPORTANT: test runs shouldn't fail because of PHPCS being incompatible with a PHP version. + # - PHPCS will run without errors on PHP 5.4 - 7.2 on any version. + # - PHP 7.3 needs PHPCS 3.3.1+ to run without errors. + # - PHP 7.4 needs PHPCS 3.5.0+ to run without errors. + # - PHP 8.0 needs PHPCS 3.5.7+ to run without errors. + php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2'] + phpcs_version: ['3.1.0', 'dev-master'] + experimental: [false] + + include: + # Complete the matrix, while preventing issues with PHPCS versions incompatible with certain PHP versions. + - php: '8.0' + phpcs_version: 'dev-master' + experimental: false + - php: '8.0' + phpcs_version: '3.5.7' + experimental: false + + - php: '7.4' + phpcs_version: 'dev-master' + experimental: false + - php: '7.4' + phpcs_version: '3.5.0' + experimental: false + + - php: '7.3' + phpcs_version: 'dev-master' + experimental: false + - php: '7.3' + phpcs_version: '3.3.1' + experimental: false + + # Experimental builds. These are allowed to fail. + - php: '7.4' + phpcs_version: '4.0.x-dev' + experimental: true + + - php: '8.1' # Nightly. + phpcs_version: 'dev-master' + experimental: true + + name: "Test${{ matrix.phpcs_version == 'dev-master' && ' + Lint' || '' }}: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}" + + continue-on-error: ${{ matrix.experimental }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup ini config + id: set_ini + run: | + # On stable PHPCS versions, allow for PHP deprecation notices. + # Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore. + if [[ "${{ matrix.phpcs_version }}" != "dev-master" && "${{ matrix.phpcs_version }}" != "4.0.x-dev" ]]; then + echo '::set-output name=PHP_INI::error_reporting=E_ALL & ~E_DEPRECATED' + else + echo '::set-output name=PHP_INI::error_reporting=E_ALL' + fi + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + ini-values: ${{ steps.set_ini.outputs.PHP_INI }} + coverage: none + + - name: 'Composer: adjust dependencies' + run: | + # Set the PHPCS version to be used in the tests. + composer require --no-update squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-scripts + # Remove the PHPCSDevCS dependency as it has different PHPCS requirements and would block installs. + composer remove --no-update --dev phpcsstandards/phpcsdevcs --no-scripts + + # Install dependencies and handle caching in one go. + # @link https://github.com/marketplace/actions/install-composer-dependencies + - name: Install Composer dependencies - normal + if: ${{ matrix.php < 8.1 }} + uses: "ramsey/composer-install@v1" + + # For PHP "nightly", we need to install with ignore platform reqs as not all dependencies allow installation. + - name: Install Composer dependencies - with ignore platform + if: ${{ matrix.php >= 8.1 }} + uses: "ramsey/composer-install@v1" + with: + composer-options: --ignore-platform-reqs + + - name: Lint against parse errors + if: matrix.phpcs_version == 'dev-master' + run: composer lint + + # Check that any sniffs available are feature complete. + # This also acts as an integration test for the feature completeness script, + # which is why it is run against various PHP versions and not in the "Sniff" stage. + - name: Check for feature completeness + if: matrix.phpcs_version == 'dev-master' + run: composer check-complete + + - name: Run the unit tests + run: composer run-tests diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f8be8d6..0000000 --- a/.travis.yml +++ /dev/null @@ -1,170 +0,0 @@ -dist: trusty - -language: php - -## Cache composer and apt downloads. -cache: - apt: true - directories: - # Cache directory for older Composer versions. - - $HOME/.composer/cache/files - # Cache directory for more recent Composer versions. - - $HOME/.cache/composer/files - -# Note: PHP 7.3, 7.4 and nightly are added via "jobs". -php: - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - 7.1 - - 7.2 - -env: - # PHPCS `master` - - PHPCS_VERSION="dev-master" LINT=1 - # Lowest supported PHPCS version. - - PHPCS_VERSION="3.0.2" - -# Define the stages used. -# For non-PRs, only the sniff and quicktest stages are run. -# For pull requests and merges, the full script is run (skipping quicktest). -# Note: for pull requests, "develop" is the base branch name. -# See: https://docs.travis-ci.com/user/conditions-v1 -stages: - - name: sniff - - name: quicktest - if: type = push AND branch NOT IN (stable, develop) - - name: test - if: branch IN (stable, develop) - -jobs: - fast_finish: true - include: - #### SNIFF STAGE #### - - stage: sniff - php: 7.4 - env: PHPCS_VERSION="dev-master" - addons: - apt: - packages: - - libxml2-utils - script: - # Check the code style of the code base. - - composer check-cs - - # Validate the xml file. - # @link http://xmlsoft.org/xmllint.html - - xmllint --noout --schema ./vendor/squizlabs/php_codesniffer/phpcs.xsd ./PHPCSDebug/ruleset.xml - - # Check the code-style consistency of the xml files. - - diff -B ./PHPCSDebug/ruleset.xml <(xmllint --format "./PHPCSDebug/ruleset.xml") - - # Validate the composer.json file. - # @link https://getcomposer.org/doc/03-cli.md#validate - - composer validate --no-check-all --strict - - #### QUICK TEST STAGE #### - # This is a much quicker test which only runs the unit tests and linting against the low/high - # supported PHP/PHPCS combinations. - - stage: quicktest - php: 7.4 - env: PHPCS_VERSION="dev-master" LINT=1 - - stage: quicktest - php: 7.2 - env: PHPCS_VERSION="3.0.2" - - - stage: quicktest - php: 5.4 - env: PHPCS_VERSION="dev-master" LINT=1 - - stage: quicktest - php: 5.4 - env: PHPCS_VERSION="3.0.2" - - #### TEST STAGE #### - # Additional builds to prevent issues with PHPCS versions incompatible with certain PHP versions. - - stage: test - php: 7.3 - env: PHPCS_VERSION="dev-master" LINT=1 - # PHPCS is only compatible with PHP 7.3 as of version 3.3.1. - - php: 7.3 - env: PHPCS_VERSION="3.3.1" - - php: 7.4 - env: PHPCS_VERSION="dev-master" - # PHPCS is only compatible with PHP 7.4 as of version 3.5.0. - - php: 7.4 - env: PHPCS_VERSION="3.5.0" - - # Builds against unstable versions which are allowed to fail for now. - - stage: test - php: 7.4 - env: PHPCS_VERSION="4.0.x-dev" - - php: "nightly" - env: PHPCS_VERSION="dev-master" LINT=1 - - allow_failures: - # Allow failures for unstable builds. - - php: "nightly" - - env: PHPCS_VERSION="4.0.x-dev" - - -before_install: - # Speed up build time by disabling Xdebug when its not needed. - - phpenv config-rm xdebug.ini || echo 'No xdebug config.' - - # On stable PHPCS versions, allow for PHP deprecation notices. - # Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore. - - | - if [[ "${TRAVIS_BUILD_STAGE_NAME^}" != "Sniff" && "$PHPCS_VERSION" != "dev-master" && "$PHPCS_VERSION" != "4.0.x-dev" ]]; then - echo 'error_reporting = E_ALL & ~E_DEPRECATED' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - fi - - - export XMLLINT_INDENT=" " - - # Set up test environment using Composer. - - | - if [[ "${TRAVIS_BUILD_STAGE_NAME^}" != "Sniff" ]]; then - # Remove the PHPCSDevCS dependency as it has different PHPCS requirements and would block installs. - composer remove --dev phpcsstandards/phpcsdevcs --no-update --no-scripts - fi - - | - if [[ $PHPCS_VERSION != "n/a" ]]; then - composer require --no-update --no-scripts squizlabs/php_codesniffer:${PHPCS_VERSION} - fi - - | - if [[ "${TRAVIS_BUILD_STAGE_NAME^}" == "Sniff" ]]; then - # The sniff stage doesn't run the unit tests, so no need for PHPUnit. - composer remove --dev phpunit/phpunit --no-update --no-scripts - elif [[ "$PHPCS_VERSION" < "3.1.0" ]]; then - # PHPCS < 3.1.0 is not compatible with PHPUnit 6.x. - composer require --dev phpunit/phpunit:"^4.0||^5.0" --no-update --no-scripts - elif [[ "$PHPCS_VERSION" < "3.2.3" ]]; then - # PHPCS < 3.2.3 is not compatible with PHPUnit 7.x. - composer require --dev phpunit/phpunit:"^4.0||^5.0||^6.0" --no-update --no-scripts - fi - - # --prefer-dist will allow for optimal use of the travis caching ability. - # The Composer PHPCS plugin takes care of setting the installed_paths for PHPCS. - - | - if [[ $TRAVIS_PHP_VERSION == "nightly" ]]; then - # Not all dependencies allow for installing on nightly yet, so ignore platform requirements. - composer install --prefer-dist --no-suggest --ignore-platform-reqs - elif [[ "$PHPCS_VERSION" == "4.0.x-dev" ]]; then - # PHPCS 4.x does not ship by default with the base test case, so source is needed. - composer install --prefer-source --no-suggest - else - composer install --prefer-dist --no-suggest - fi - - -script: - # Lint PHP files against parse errors. - - if [[ "$LINT" == "1" ]]; then composer lint; fi - - # Check that any sniffs available are feature complete. - # This also acts as an integration test for the feature completeness script, - # which is why it is run against various PHP versions and not in the "Sniff" stage. - - if [[ "$LINT" == "1" ]]; then composer check-complete; fi - - # Run the unit tests. - - if [[ $PHPCS_VERSION != "n/a" ]]; then composer run-tests; fi diff --git a/CHANGELOG.md b/CHANGELOG.md index 707b6a0..d0db40a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,18 @@ This projects adheres to [Keep a CHANGELOG](http://keepachangelog.com/) and uses _Nothing yet._ +## [1.1.0] - 2020-12-20 + +### Added +* New column "nested parentheses count" - `( #)` - in the output of the `PHPCSDebug.Debug.TokenList` sniff. + +### Changed +* The minimum required PHPCS version for the `PHPCSDebug` standard has been raised to PHPCS `3.1.0`. +* `PHPCSDebug.Debug.TokenList`: The column separator has been changed from `::` to `|`. +* All functionality is now also tested against PHP 8.0. +* Miscellaneous updates to the development environment and CI scripts. + + ## [1.0.1] - 2020-06-28 ### Changed @@ -25,7 +37,8 @@ Initial release containing: * A `PHPCSDebug` standard to help debugging sniffs. -[Unreleased]: https://github.com/PHPCSStandards/PHPCSDevTools/compare/master...HEAD +[Unreleased]: https://github.com/PHPCSStandards/PHPCSDevTools/compare/stable...HEAD +[1.1.0]: https://github.com/PHPCSStandards/PHPCSDevTools/compare/1.0.1...1.1.0 [1.0.1]: https://github.com/PHPCSStandards/PHPCSDevTools/compare/1.0.0...1.0.1 [Dealerdirect Composer PHPCS plugin]: https://github.com/Dealerdirect/phpcodesniffer-composer-installer/ diff --git a/PHPCSDebug/Sniffs/Debug/TokenListSniff.php b/PHPCSDebug/Sniffs/Debug/TokenListSniff.php index 635ac45..f19bfba 100644 --- a/PHPCSDebug/Sniffs/Debug/TokenListSniff.php +++ b/PHPCSDebug/Sniffs/Debug/TokenListSniff.php @@ -81,14 +81,16 @@ public function process(File $phpcsFile, $stackPtr) $ptrPadding = \max(3, \strlen($last)); $linePadding = \strlen($tokens[$last]['line']); + $sep = ' | '; echo \PHP_EOL; echo \str_pad('Ptr', $ptrPadding, ' ', \STR_PAD_BOTH), - ' :: ', \str_pad('Ln', ($linePadding + 1), ' ', \STR_PAD_BOTH), - ' :: ', \str_pad('Col', 4, ' ', \STR_PAD_BOTH), - ' :: ', 'Cond', - ' :: ', \str_pad('Token Type', 26), // Longest token type name is 26 chars. - ' :: [len]: Content', \PHP_EOL; + $sep, \str_pad('Ln', ($linePadding + 1), ' ', \STR_PAD_BOTH), + $sep, 'Col ', + $sep, 'Cond', + $sep, '( #)', + $sep, \str_pad('Token Type', 26), // Longest token type name is 26 chars. + $sep, '[len]: Content', \PHP_EOL; echo \str_repeat('-', ($ptrPadding + $linePadding + 35 + 16 + 18)), \PHP_EOL; @@ -111,18 +113,22 @@ public function process(File $phpcsFile, $stackPtr) $content = \str_replace("\t", '\t', $content); } if (isset($token['orig_content'])) { - $content .= ' :: Orig: ' . \str_replace("\t", '\t', $token['orig_content']); + $content .= $sep . 'Orig: ' . \str_replace("\t", '\t', $token['orig_content']); } } - $conditionCount = \count($token['conditions']); + $parenthesesCount = 0; + if (isset($token['nested_parenthesis'])) { + $parenthesesCount = \count($token['nested_parenthesis']); + } echo \str_pad($ptr, $ptrPadding, ' ', \STR_PAD_LEFT), - ' :: L', \str_pad($token['line'], $linePadding, '0', \STR_PAD_LEFT), - ' :: C', \str_pad($token['column'], 3, ' ', \STR_PAD_LEFT), - ' :: CC', \str_pad($conditionCount, 2, ' ', \STR_PAD_LEFT), - ' :: ', \str_pad($token['type'], 26), // Longest token type name is 26 chars. - ' :: [', $token['length'], ']: ', $content, \PHP_EOL; + $sep, 'L', \str_pad($token['line'], $linePadding, '0', \STR_PAD_LEFT), + $sep, 'C', \str_pad($token['column'], 3, ' ', \STR_PAD_LEFT), + $sep, 'CC', \str_pad($token['level'], 2, ' ', \STR_PAD_LEFT), + $sep, '(', \str_pad($parenthesesCount, 2, ' ', \STR_PAD_LEFT), ')', + $sep, \str_pad($token['type'], 26), // Longest token type name is 26 chars. + $sep, '[', $token['length'], ']: ', $content, \PHP_EOL; } // Only do this once per file. diff --git a/PHPCSDebug/Tests/Debug/TokenListUnitTest.php b/PHPCSDebug/Tests/Debug/TokenListUnitTest.php index 80ed928..1c00391 100644 --- a/PHPCSDebug/Tests/Debug/TokenListUnitTest.php +++ b/PHPCSDebug/Tests/Debug/TokenListUnitTest.php @@ -10,7 +10,7 @@ namespace PHPCSDebug\Tests\Debug; -use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; +use PHPCSUtils\TestUtils\UtilityMethodTestCase; /** * Unit test class for the TokenList sniff. @@ -19,57 +19,46 @@ * * @since 1.0.0 */ -class TokenListUnitTest extends AbstractSniffUnitTest +class TokenListUnitTest extends UtilityMethodTestCase { /** - * Cache any output generated during the test. + * Set the name of a sniff to pass to PHPCS to limit the run (and force it to record errors). * - * @var string + * @var array */ - public static $output = ''; + protected static $selectedSniff = ['PHPCSDebug.Debug.TokenList']; /** - * Sets up this unit test. + * Test the actual output of the TokenList sniff. * * @return void */ - protected function setUp() + public function testOutput() { - parent::setUp(); + $expected = "\n"; + $expected .= 'Ptr | Ln | Col | Cond | ( #) | Token Type | [len]: Content' . "\n"; + $expected .= '-------------------------------------------------------------------------' . "\n"; + $expected .= ' 0 | L1 | C 1 | CC 0 | ( 0) | T_OPEN_TAG | [5]: expectOutputString($expected); + $this->setOutputCallback([$this, 'normalizeLineEndings']); - parent::tearDown(); + self::$phpcsFile->process(); } /** - * Returns the lines where errors should occur. + * Callback function to normalize line endings in generated output. * - * @return array => - */ - public function getErrorList() - { - return []; - } - - /** - * Returns the lines where warnings should occur. + * @param string $output The output as send to screen. * - * @return array => + * @return string The output with *nix line endings. */ - public function getWarningList() + public function normalizeLineEndings($output) { - return []; + return \str_replace(["\r\n", "\r"], "\n", $output); } } diff --git a/PHPCSDebug/Tests/Debug/TokenListZUnitTest.php b/PHPCSDebug/Tests/Debug/TokenListZUnitTest.php deleted file mode 100644 index 8128955..0000000 --- a/PHPCSDebug/Tests/Debug/TokenListZUnitTest.php +++ /dev/null @@ -1,46 +0,0 @@ -assertNotEmpty($output); - - $expected = "\n"; - $expected .= 'Ptr :: Ln :: Col :: Cond :: Token Type :: [len]: Content' . "\n"; - $expected .= '-------------------------------------------------------------------------' . "\n"; - $expected .= ' 0 :: L1 :: C 1 :: CC 0 :: T_OPEN_TAG :: [5]: assertSame($expected, $output); - } -} diff --git a/README.md b/README.md index fcd1831..29742ed 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,15 @@ PHPCSDevTools for developers of PHP_CodeSniffer sniffs ===================================================== [![Latest Stable Version](https://poser.pugx.org/phpcsstandards/phpcsdevtools/v/stable)](https://packagist.org/packages/phpcsstandards/phpcsdevtools) -[![Travis Build Status](https://travis-ci.com/PHPCSStandards/PHPCSDevTools.svg?branch=stable)](https://travis-ci.com/PHPCSStandards/PHPCSDevTools/branches) [![Release Date of the Latest Version](https://img.shields.io/github/release-date/PHPCSStandards/PHPCSDevTools.svg?maxAge=1800)](https://github.com/PHPCSStandards/PHPCSDevTools/releases) :construction: [![Latest Unstable Version](https://img.shields.io/badge/unstable-dev--develop-e68718.svg?maxAge=2419200)](https://packagist.org/packages/phpcsstandards/phpcsdevtools#dev-develop) -[![Travis Build Status](https://travis-ci.com/PHPCSStandards/PHPCSDevTools.svg?branch=develop)](https://travis-ci.com/PHPCSStandards/PHPCSDevTools/branches) [![Last Commit to Unstable](https://img.shields.io/github/last-commit/PHPCSStandards/PHPCSDevTools/develop.svg)](https://github.com/PHPCSStandards/PHPCSDevTools/commits/develop) [![Minimum PHP Version](https://img.shields.io/packagist/php-v/phpcsstandards/phpcsdevtools.svg?maxAge=3600)](https://packagist.org/packages/phpcsstandards/phpcsdevtools) -[![Tested on PHP 5.4 to nightly](https://img.shields.io/badge/tested%20on-PHP%205.4%20|%205.5%20|%205.6%20|%207.0%20|%207.1%20|%207.2%20|%207.3%20|%207.4%20|%20nightly-brightgreen.svg?maxAge=2419200)](https://travis-ci.com/PHPCSStandards/PHPCSDevTools) +[![Build Status CS](https://github.com/PHPCSStandards/PHPCSDevTools/workflows/CS/badge.svg?branch=develop)](https://github.com/PHPCSStandards/PHPCSDevTools/actions) +[![Build Status Test](https://github.com/PHPCSStandards/PHPCSDevTools/workflows/Test/badge.svg?branch=develop)](https://github.com/PHPCSStandards/PHPCSDevTools/actions) +[![Tested on PHP 5.4 to nightly](https://img.shields.io/badge/tested%20on-PHP%205.4%20|%205.5%20|%205.6%20|%207.0%20|%207.1%20|%207.2%20|%207.3%20|%207.4%20|%208.0%20|%20nightly-brightgreen.svg?maxAge=2419200)](https://travis-ci.com/PHPCSStandards/PHPCSDevTools) [![License: LGPLv3](https://poser.pugx.org/phpcsstandards/phpcsdevtools/license)](https://github.com/PHPCSStandards/PHPCSDevTools/blob/stable/LICENSE) ![Awesome](https://img.shields.io/badge/awesome%3F-yes!-brightgreen.svg) @@ -122,7 +122,7 @@ Once this project is installed, you will see a new `PHPCSDebug` ruleset in the l For now, this standard only contains one sniff: `PHPCSDebug.Debug.TokenList`. This sniff will display compact, but detailed information about the tokens found in a (test case) file. -This sniff is compatible with PHPCS 3.0.2+. +This sniff is compatible with PHPCS 3.1.0+. Typical usage: * Set up a test case file for a new sniff you intend to write. @@ -137,34 +137,34 @@ phpcs ./SniffNameUnitTest.inc --standard=YourStandard,PHPCSDebug --sniffs=YourSt The output will look something along the lines of: ``` -Ptr :: Ln :: Col :: Cond :: Token Type :: [len]: Content +Ptr | Ln | Col | Cond | ( #) | Token Type | [len]: Content ------------------------------------------------------------------------- - 0 :: L1 :: C 1 :: CC 0 :: T_OPEN_TAG :: [5]: excludedDirs = []; continue; } diff --git a/VERSION b/VERSION index 7f20734..1cc5f65 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.1 \ No newline at end of file +1.1.0 \ No newline at end of file diff --git a/composer.json b/composer.json index e8abe93..f367b92 100644 --- a/composer.json +++ b/composer.json @@ -21,19 +21,22 @@ }, "require" : { "php" : ">=5.4", - "squizlabs/php_codesniffer" : "^3.0.2", + "squizlabs/php_codesniffer" : "^3.1.0", "dealerdirect/phpcodesniffer-composer-installer" : "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7" }, "require-dev" : { "roave/security-advisories" : "dev-master", - "phpunit/phpunit" : "^4.5 || ^5.0 || ^6.0 || ^7.0", + "phpunit/phpunit" : "^4.5 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0", "php-parallel-lint/php-parallel-lint": "^1.0", "php-parallel-lint/php-console-highlighter": "^0.5", - "phpcsstandards/phpcsdevcs": "^1.0" + "phpcsstandards/phpcsdevcs": "^1.1.1", + "phpcsstandards/phpcsutils" : "^1.0" }, "bin": [ "bin/phpcs-check-feature-completeness" ], + "minimum-stability": "dev", + "prefer-stable": true, "scripts" : { "lint": [ "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --exclude vendor --exclude .git" @@ -45,7 +48,7 @@ "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf" ], "run-tests": [ - "@php ./vendor/phpunit/phpunit/phpunit --filter PHPCSDebug ./vendor/squizlabs/php_codesniffer/tests/AllTests.php" + "@php ./vendor/phpunit/phpunit/phpunit" ], "check-complete": [ "@php ./bin/phpcs-check-feature-completeness ./PHPCSDebug" diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 6d60988..27496a6 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -44,9 +44,6 @@ - - -