diff --git a/.github/build/Website.php b/.github/build/Website.php
new file mode 100644
index 0000000..9ebb41d
--- /dev/null
+++ b/.github/build/Website.php
@@ -0,0 +1,285 @@
+ string target>
+ */
+ const FILES_TO_COPY = [
+ 'README.md' => 'index.md',
+ ];
+
+ /**
+ * Frontmatter.
+ *
+ * @var string
+ */
+ const FRONTMATTER = '---
+---
+';
+
+ /**
+ * Resolved path to project root (with trailing slash).
+ *
+ * @var string
+ */
+ private $realRoot;
+
+ /**
+ * Resolved path to target directory (with trailing slash).
+ *
+ * @var string
+ */
+ private $realTarget;
+
+ /**
+ * Constructor
+ *
+ * @return void
+ */
+ public function __construct()
+ {
+ // Check if the target directory exists and if not, create it.
+ $targetDir = self::PROJECT_ROOT . self::TARGET_DIR;
+
+ if (@\is_dir($targetDir) === false) {
+ if (@\mkdir($targetDir, 0777, true) === false) {
+ throw new RuntimeException(\sprintf('Failed to create the %s directory.', $targetDir));
+ }
+ }
+
+ $realPath = \realpath($targetDir);
+ if ($realPath === false) {
+ throw new RuntimeException(\sprintf('Failed to find the %s directory.', $targetDir));
+ }
+
+ $this->realRoot = \realpath(self::PROJECT_ROOT) . '/';
+ $this->realTarget = $realPath . '/';
+ }
+
+ /**
+ * Run the transformation.
+ *
+ * @return int Exit code.
+ */
+ public function run(): int
+ {
+ $exitcode = 0;
+
+ try {
+ $this->copyFiles();
+ $this->transformIndex();
+ } catch (RuntimeException $e) {
+ echo 'ERROR: ', $e->getMessage(), \PHP_EOL;
+ $exitcode = 1;
+ }
+
+ return $exitcode;
+ }
+
+ /**
+ * Copy files to the target directory.
+ *
+ * @return void
+ */
+ private function copyFiles(): void
+ {
+ foreach (self::FILES_TO_COPY as $source => $target) {
+ $source = $this->realRoot . $source;
+ if (empty($target)) {
+ $target = $this->realTarget . $source;
+ } else {
+ $target = $this->realTarget . $target;
+ }
+
+ // Bit round-about way of copying the files, but we need to make sure the target dir exists.
+ $contents = $this->getContents($source);
+ $this->putContents($target, $contents);
+ }
+ }
+
+ /**
+ * Transform the README to a usable homepage.
+ *
+ * - Remove the title and subtitle as those would become duplicate.
+ * - Remove most of the badges, except for the first three.
+ * - Transform those badges into HTML.
+ * - Add frontmatter.
+ *
+ * @return void
+ *
+ * @throws \RuntimeException When any of the regexes do not yield any results.
+ */
+ private function transformIndex(): void
+ {
+ // Read the file.
+ $target = $this->realTarget . '/index.md';
+ $contents = $this->getContents($target);
+
+ // Grab the start of the document.
+ $matched = \preg_match('`^(.+)\* \[Installation\]`s', $contents, $matches);
+ if ($matched !== 1) {
+ throw new RuntimeException('Failed to match start of document. Adjust the regex');
+ }
+
+ $startOfDoc = $matches[1];
+
+ // Grab the first few badges from the start of the document.
+ $matched = \preg_match(
+ '`((?:\[!\[[^\]]+\]\([^\)]+\)\]\([^\)]+\)[\n\r]+)+):construction:`',
+ $startOfDoc,
+ $matches
+ );
+ if ($matched !== 1) {
+ throw new RuntimeException('Failed to match badges. Adjust the regex');
+ }
+
+ $badges = \explode("\n", $matches[1]);
+ $badges = \array_filter($badges);
+ $badges = \array_map([$this, 'mdBadgeToHtml'], $badges);
+ $badges = \implode("\n ", $badges);
+
+ $replacement = \sprintf(
+ '%s
+
+
+
+%s
+
+
+
+',
+ self::FRONTMATTER,
+ ' ' . $badges
+ );
+
+ $contents = \str_replace($startOfDoc, $replacement, $contents);
+
+ $this->putContents($target, $contents);
+ }
+
+ /**
+ * Transform markdown badges into HTML badges.
+ *
+ * Jekyll runs into trouble doing this when we also want to keep the wrapper div with aria-hidden="true".
+ *
+ * @param string $mdBadge Markdown badge code.
+ *
+ * @return string
+ */
+ private function mdBadgeToHtml(string $mdBadge): string
+ {
+ $mdBadge = trim($mdBadge);
+
+ $matched = \preg_match(
+ '`^\[!\[(?[^\]]+)\]\((?[^\)]+)\)\]\((?[^\)]+)\)$`',
+ $mdBadge,
+ $matches
+ );
+ if ($matched !== 1) {
+ throw new RuntimeException(\sprintf('Failed to parse the badge. Adjust the regex. Received: %s', $mdBadge));
+ }
+
+ return \sprintf(
+ '',
+ $matches['href'],
+ $matches['imgurl'],
+ $matches['alt']
+ );
+ }
+
+ /**
+ * Retrieve the contents of a file.
+ *
+ * @param string $source Path to the source file.
+ *
+ * @return string
+ *
+ * @throws \RuntimeException When the contents of the file could not be retrieved.
+ */
+ private function getContents(string $source): string
+ {
+ $contents = \file_get_contents($source);
+ if (!$contents) {
+ throw new RuntimeException(\sprintf('Failed to read doc file: %s', $source));
+ }
+
+ return $contents;
+ }
+
+ /**
+ * Write a string to a file.
+ *
+ * @param string $target Path to the target file.
+ * @param string $contents File contents to write.
+ *
+ * @return void
+ *
+ * @throws \RuntimeException When the target directory could not be created.
+ * @throws \RuntimeException When the file could not be written to the target directory.
+ */
+ private function putContents(string $target, string $contents): void
+ {
+ // Check if the target directory exists and if not, create it.
+ $targetDir = \dirname($target);
+
+ if (@\is_dir($targetDir) === false) {
+ if (@\mkdir($targetDir, 0777, true) === false) {
+ throw new RuntimeException(\sprintf('Failed to create the %s directory.', $targetDir));
+ }
+ }
+
+ // Make sure the file always ends on a new line.
+ $contents = \rtrim($contents) . "\n";
+ if (\file_put_contents($target, $contents) === false) {
+ throw new RuntimeException(\sprintf('Failed to write to target location: %s', $target));
+ }
+ }
+}
diff --git a/.github/build/update-website.php b/.github/build/update-website.php
new file mode 100644
index 0000000..4dc353a
--- /dev/null
+++ b/.github/build/update-website.php
@@ -0,0 +1,27 @@
+#!/usr/bin/env php
+run();
+
+exit($websiteUpdateSuccess);
diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml
index 31b658c..9a876b2 100644
--- a/.github/workflows/cs.yml
+++ b/.github/workflows/cs.yml
@@ -4,11 +4,15 @@ 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'
+ # Allow manually triggering the workflow.
+ workflow_dispatch:
+
+# Cancels all previous workflow runs for the same branch that have not yet completed.
+concurrency:
+ # The concurrency group contains the workflow name and the branch name.
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
jobs:
checkcs:
@@ -20,28 +24,36 @@ jobs:
steps:
- name: Checkout code
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
+ tools: cs2pr
+
+ # 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
- 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
+ composer remove --no-update --dev phpunit/phpunit --no-scripts --no-interaction
# Using PHPCS `master` as an early detection system for bugs upstream.
- composer require --no-update squizlabs/php_codesniffer:"dev-master"
+ composer require --no-update squizlabs/php_codesniffer:"dev-master" --no-interaction
# 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"
+ uses: "ramsey/composer-install@v2"
- name: Install xmllint
- run: sudo apt-get install --no-install-recommends -y libxml2-utils
+ run: |
+ sudo apt-get update
+ 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
@@ -58,9 +70,8 @@ jobs:
# Check the code-style consistency of the PHP files.
- name: Check PHP code style
- run: composer check-cs
+ continue-on-error: true
+ run: composer checkcs -- --report-full --report-checkstyle=./phpcs-report.xml
- # 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
+ - name: Show PHPCS results in PR
+ run: cs2pr ./phpcs-report.xml
diff --git a/.github/workflows/quicktest.yml b/.github/workflows/quicktest.yml
index b3ed032..a563388 100644
--- a/.github/workflows/quicktest.yml
+++ b/.github/workflows/quicktest.yml
@@ -5,8 +5,14 @@ on:
push:
branches-ignore:
- stable
- paths-ignore:
- - '**.md'
+ # Allow manually triggering the workflow.
+ workflow_dispatch:
+
+# Cancels all previous workflow runs for the same branch that have not yet completed.
+concurrency:
+ # The concurrency group contains the workflow name and the branch name.
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
jobs:
#### QUICK TEST STAGE ####
@@ -19,21 +25,18 @@ jobs:
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
+ uses: actions/checkout@v3
# 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.
@@ -41,9 +44,9 @@ jobs:
id: set_ini
run: |
if [ "${{ matrix.phpcs_version }}" != "dev-master" ]; then
- echo '::set-output name=PHP_INI::error_reporting=E_ALL & ~E_DEPRECATED'
+ echo '::set-output name=PHP_INI::error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On'
else
- echo '::set-output name=PHP_INI::error_reporting=E_ALL'
+ echo '::set-output name=PHP_INI::error_reporting=-1, display_errors=On'
fi
- name: Install PHP
@@ -56,19 +59,23 @@ jobs:
- 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
+ composer require --no-update squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-scripts --no-interaction
# Remove the PHPCSDevCS dependency as it has different PHPCS requirements and would block installs.
- composer remove --no-update --dev phpcsstandards/phpcsdevcs --no-scripts
+ composer remove --no-update --dev phpcsstandards/phpcsdevcs --no-scripts --no-interaction
# 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"
+ uses: "ramsey/composer-install@v2"
- - name: Lint against parse errors
- if: ${{ matrix.lint }}
+ - name: Lint against parse errors (PHP 7.2+)
+ if: ${{ matrix.phpcs_version == 'dev-master' && matrix.php >= '7.2' }}
run: composer lint
+ - name: Lint against parse errors (PHP < 7.2)
+ if: ${{ matrix.phpcs_version == 'dev-master' && matrix.php < '7.2' }}
+ run: composer lintlt72
+
# 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.
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index faa237d..0c00111 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -6,8 +6,14 @@ on:
branches:
- stable
pull_request:
- paths-ignore:
- - '**.md'
+ # Allow manually triggering the workflow.
+ workflow_dispatch:
+
+# Cancels all previous workflow runs for the same branch that have not yet completed.
+concurrency:
+ # The concurrency group contains the workflow name and the branch name.
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
jobs:
#### TEST STAGE ####
@@ -23,12 +29,20 @@ jobs:
# - 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 8.1 needs PHPCS 3.6.1+ 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.1'
+ phpcs_version: 'dev-master'
+ experimental: false
+ - php: '8.1'
+ phpcs_version: '3.6.1'
+ experimental: false
+
- php: '8.0'
phpcs_version: 'dev-master'
experimental: false
@@ -55,7 +69,7 @@ jobs:
phpcs_version: '4.0.x-dev'
experimental: true
- - php: '8.1' # Nightly.
+ - php: '8.2' # Nightly.
phpcs_version: 'dev-master'
experimental: true
@@ -65,7 +79,7 @@ jobs:
steps:
- name: Checkout code
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
- name: Setup ini config
id: set_ini
@@ -73,9 +87,9 @@ jobs:
# 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'
+ echo '::set-output name=PHP_INI::error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On'
else
- echo '::set-output name=PHP_INI::error_reporting=E_ALL'
+ echo '::set-output name=PHP_INI::error_reporting=-1, display_errors=On'
fi
- name: Install PHP
@@ -84,30 +98,35 @@ jobs:
php-version: ${{ matrix.php }}
ini-values: ${{ steps.set_ini.outputs.PHP_INI }}
coverage: none
+ tools: cs2pr
- 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
+ composer require --no-update squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-scripts --no-interaction
# Remove the PHPCSDevCS dependency as it has different PHPCS requirements and would block installs.
- composer remove --no-update --dev phpcsstandards/phpcsdevcs --no-scripts
+ composer remove --no-update --dev phpcsstandards/phpcsdevcs --no-scripts --no-interaction
# 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"
+ if: ${{ matrix.php < 8.2 }}
+ uses: "ramsey/composer-install@v2"
# 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"
+ if: ${{ matrix.php >= 8.2 }}
+ uses: "ramsey/composer-install@v2"
with:
composer-options: --ignore-platform-reqs
- - name: Lint against parse errors
- if: matrix.phpcs_version == 'dev-master'
- run: composer lint
+ - name: Lint against parse errors (PHP 7.2+)
+ if: ${{ matrix.phpcs_version == 'dev-master' && matrix.php >= '7.2' }}
+ run: composer lint -- --checkstyle | cs2pr
+
+ - name: Lint against parse errors (PHP < 7.2)
+ if: ${{ matrix.phpcs_version == 'dev-master' && matrix.php < '7.2' }}
+ run: composer lintlt72 -- --checkstyle | cs2pr
# Check that any sniffs available are feature complete.
# This also acts as an integration test for the feature completeness script,
diff --git a/.github/workflows/update-website.yml b/.github/workflows/update-website.yml
new file mode 100644
index 0000000..91c0e88
--- /dev/null
+++ b/.github/workflows/update-website.yml
@@ -0,0 +1,100 @@
+name: Build website
+
+on:
+ # Trigger the workflow whenever a new tag is created.
+ push:
+ branches:
+ - 'stable'
+ # And whenever this workflow or one of the associated scripts is updated (for a dry-run).
+ pull_request:
+ branches-ignore:
+ - 'stable'
+ paths:
+ - '.github/workflows/update-website.yml'
+ - '.github/build/**'
+ # Also allow manually triggering the workflow.
+ workflow_dispatch:
+
+# Cancels all previous workflow runs for the same branch that have not yet completed.
+concurrency:
+ # The concurrency group contains the workflow name and the branch name.
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ prepare:
+ name: "Update website files"
+ # Don't run on forks.
+ if: github.repository == 'PHPCSStandards/PHPCSDevTools'
+
+ runs-on: ubuntu-latest
+ steps:
+ # By default use the `stable` branch as the published docs should always
+ # reflect the latest release.
+ # For testing changes to the workflow or the scripts, use the PR branch
+ # to have access to the latest version of the workflow/scripts.
+ - name: Determine branch to use
+ id: base_branch
+ env:
+ REF: ${{ github.ref }}
+ run: |
+ if [ "${{ github.event_name }}" == "pull_request" ]; then
+ echo "::set-output name=BRANCH::$REF"
+ else
+ echo '::set-output name=BRANCH::stable'
+ fi
+
+ - name: Checkout code
+ uses: actions/checkout@v3
+ with:
+ ref: ${{ steps.base_branch.outputs.BRANCH }}
+
+ - name: Install PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: '8.1'
+ ini-values: error_reporting=-1, display_errors=On, log_errors_max_len=0
+ coverage: none
+
+ - name: Prepare the files which will be deployed to the GH Pages website
+ run: php .github/build/update-website.php
+
+ - name: "Set variable: short sha"
+ id: set_sha
+ env:
+ SHA: ${{ github.sha }}
+ run: |
+ shortsha=$(echo "$SHA" | cut -b 1-6)
+ echo "::set-output name=SHORTSHA::$shortsha"
+
+ - name: Prepare commit message
+ id: commit_msg
+ env:
+ REF_NAME: ${{ github.ref_name }}
+ COMMIT_MSG: ${{ github.event.head_commit.message }}
+ run: |
+ if [[ "${{ github.event_name }}" == 'push' && "${{ github.ref_type }}" == 'tag' ]]; then
+ echo "::set-output name=MSG::Update website for release of version $REF_NAME"
+ else
+ echo "::set-output name=MSG::Sync website after commit (sha: ${{ steps.set_sha.outputs.SHORTSHA }})"
+ fi
+
+ - name: Check GitHub Pages status
+ uses: crazy-max/ghaction-github-status@v2
+ with:
+ pages_threshold: major_outage
+
+ - name: Deploy the website
+ if: success()
+ uses: crazy-max/ghaction-github-pages@v2
+ with:
+ build_dir: 'deploy'
+ target_branch: 'gh-pages'
+ keep_history: true
+ #allow_empty_commit: false # Turn on after verification that it all works as expected.
+ jekyll: true
+ commit_message: ${{ steps.commit_msg.outputs.MSG }}
+ dry_run: ${{ steps.base_branch.outputs.BRANCH != 'stable' }}
+ verbose: ${{ matrix.verbose }}
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.gitignore b/.gitignore
index 63850bb..8561573 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+deploy/
vendor/
composer.lock
.phpcs.xml
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d0db40a..6629530 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,17 @@ This projects adheres to [Keep a CHANGELOG](http://keepachangelog.com/) and uses
_Nothing yet._
+## [1.1.1] - 2022-04-27
+
+### Changed
+* `PHPCSDebug.Debug.TokenList`: readability improvement (alignment of content length).
+* All functionality is now also tested against PHP 8.1.
+* Update to the installation instructions to allow for Composer 2.2+.
+* Minor other documentation improvements.
+* The documentation of the project will now also be available at .
+* Miscellaneous updates to the development environment and CI scripts.
+
+
## [1.1.0] - 2020-12-20
### Added
@@ -26,7 +37,7 @@ _Nothing yet._
### Changed
* The `master` branch has been renamed to `stable`.
-* The version requirements for the [Dealerdirect Composer PHPCS plugin] have been widened to allow installation of releases from the `0.7.x` range, which brings compatibility with Composer 2.0.
+* The version requirements for the [Composer PHPCS plugin] have been widened to allow installation of releases from the `0.7.x` range, which brings compatibility with Composer 2.0.
* Miscellaneous updates to the development environment and CI scripts.
@@ -38,7 +49,8 @@ Initial release containing:
[Unreleased]: https://github.com/PHPCSStandards/PHPCSDevTools/compare/stable...HEAD
+[1.1.1]: https://github.com/PHPCSStandards/PHPCSDevTools/compare/1.1.0...1.1.1
[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/
+[Composer PHPCS plugin]: https://github.com/PHPCSStandards/composer-installer
diff --git a/PHPCSDebug/Sniffs/Debug/TokenListSniff.php b/PHPCSDebug/Sniffs/Debug/TokenListSniff.php
index f19bfba..069612a 100644
--- a/PHPCSDebug/Sniffs/Debug/TokenListSniff.php
+++ b/PHPCSDebug/Sniffs/Debug/TokenListSniff.php
@@ -128,7 +128,7 @@ public function process(File $phpcsFile, $stackPtr)
$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;
+ $sep, '[', \str_pad($token['length'], 3, ' ', \STR_PAD_LEFT), ']: ', $content, \PHP_EOL;
}
// Only do this once per file.
diff --git a/PHPCSDebug/Tests/Debug/TokenListUnitTest.php b/PHPCSDebug/Tests/Debug/TokenListUnitTest.php
index 1c00391..fe64ccf 100644
--- a/PHPCSDebug/Tests/Debug/TokenListUnitTest.php
+++ b/PHPCSDebug/Tests/Debug/TokenListUnitTest.php
@@ -39,10 +39,10 @@ public function testOutput()
$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']);
diff --git a/README.md b/README.md
index 29742ed..f0f6886 100644
--- a/README.md
+++ b/README.md
@@ -1,22 +1,26 @@
PHPCSDevTools for developers of PHP_CodeSniffer sniffs
=====================================================
+
+
[![Latest Stable Version](https://poser.pugx.org/phpcsstandards/phpcsdevtools/v/stable)](https://packagist.org/packages/phpcsstandards/phpcsdevtools)
[![Release Date of the Latest Version](https://img.shields.io/github/release-date/PHPCSStandards/PHPCSDevTools.svg?maxAge=1800)](https://github.com/PHPCSStandards/PHPCSDevTools/releases)
+[![Changelog](https://img.shields.io/github/v/release/PHPCSStandards/PHPCSDevTools?label=Changelog&sort=semver)](https://github.com/PHPCSStandards/PHPCSDevTools/blob/stable/CHANGELOG.md)
:construction:
[![Latest Unstable Version](https://img.shields.io/badge/unstable-dev--develop-e68718.svg?maxAge=2419200)](https://packagist.org/packages/phpcsstandards/phpcsdevtools#dev-develop)
[![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)
-[![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)
+[![Build Status CS](https://github.com/PHPCSStandards/PHPCSDevTools/actions/workflows/cs.yml/badge.svg)](https://github.com/PHPCSStandards/PHPCSDevTools/actions/workflows/cs.yml)
+[![Build Status Test](https://github.com/PHPCSStandards/PHPCSDevTools/actions/workflows/test.yml/badge.svg)](https://github.com/PHPCSStandards/PHPCSDevTools/actions/workflows/test.yml)
+[![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|%208.1%20|%20nightly-brightgreen.svg?maxAge=2419200)](https://github.com/PHPCSStandards/PHPCSDevTools/actions?query=workflow%3ATest)
[![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)
+
-This is a set of tools to aid developers of sniffs for [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
+This is a set of tools to assist developers of sniffs for [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
* [Installation](#installation)
+ [Composer Project-based Installation](#composer-project-based-installation)
@@ -36,6 +40,7 @@ Installation
Run the following from the root of your project:
```bash
+composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer require --dev phpcsstandards/phpcsdevtools:^1.0
```
@@ -43,10 +48,11 @@ composer require --dev phpcsstandards/phpcsdevtools:^1.0
If you work on several different sniff repos, you may want to install this toolset globally:
```bash
+composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer global require --dev phpcsstandards/phpcsdevtools:^1.0
```
-Composer will automatically install dependencies and register the PHPCSDebug standard with PHP_CodeSniffer using the [DealerDirect Composer PHPCS plugin](https://github.com/Dealerdirect/phpcodesniffer-composer-installer/).
+Composer will automatically install dependencies and register the PHPCSDebug standard with PHP_CodeSniffer using the [Composer PHPCS plugin](https://github.com/PHPCSStandards/composer-installer).
### Stand-alone Installation
@@ -59,7 +65,7 @@ Composer will automatically install dependencies and register the PHPCSDebug sta
```bash
phpcs --config-set installed_paths /path/to/PHPCSDevTools
```
- :warning: **Warning**: The `installed_paths` command overwrites any previously set `installed_paths`. If you have previously set `installed_paths` for other external standards, run `phpcs --config-show` first and then run the `installed_paths` command with all the paths you need separated by comma's, i.e.:
+ :warning: **Warning**: The `installed_paths` command overwrites any previously set `installed_paths`. If you have previously set `installed_paths` for other external standards, run `phpcs --config-show` first and then run the `installed_paths` command with all the paths you need separated by commas, i.e.:
```bash
phpcs --config-set installed_paths /path/1,/path/2,/path/3
```
@@ -139,32 +145,32 @@ The output will look something along the lines of:
```
Ptr | Ln | Col | Cond | ( #) | Token Type | [len]: Content
-------------------------------------------------------------------------
- 0 | L1 | C 1 | CC 0 | ( 0) | T_OPEN_TAG | [5]: