Skip to content

Commit

Permalink
Merge pull request #527 from PHPCSStandards/develop
Browse files Browse the repository at this point in the history
Release 1.0.9
  • Loading branch information
jrfnl committed Dec 8, 2023
2 parents 69465ca + 8277fda commit 908247b
Show file tree
Hide file tree
Showing 99 changed files with 945 additions and 953 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
phpcs.xml.dist export-ignore
phpdoc.dist.xml export-ignore
phpdoc.xml.dist export-ignore
phpstan.neon.dist export-ignore
phpunit.xml.dist export-ignore
phpunit10.xml.dist export-ignore
/.github/ export-ignore
Expand Down
6 changes: 3 additions & 3 deletions .github/GHPages/UpdateWebsite.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ public function run(): int
*/
private function setPaths(): void
{
$realRoot = \realpath(self::PROJECT_ROOT) . '/';
$realRoot = \realpath(self::PROJECT_ROOT);
if ($realRoot === false) {
throw new RuntimeException(\sprintf('Failed to find the %s directory.', $realRoot));
throw new RuntimeException(\sprintf('Failed to find the %s directory.', self::PROJECT_ROOT));
}

$this->realRoot = $realRoot;
$this->realRoot = $realRoot . '/';

// Check if the target directory exists and if not, create it.
$targetDir = $this->realRoot . self::TARGET_DIR;
Expand Down
22 changes: 0 additions & 22 deletions .github/SECURITY.md

This file was deleted.

42 changes: 35 additions & 7 deletions .github/workflows/basics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -62,7 +62,8 @@ jobs:
# Show XML violations inline in the file diff.
# @link https://github.com/marketplace/actions/xmllint-problem-matcher
- uses: korelstar/xmllint-problem-matcher@v1
- name: Enable showing XML issues inline
uses: korelstar/xmllint-problem-matcher@v1

# Validate the XML file.
# @link http://xmlsoft.org/xmllint.html
Expand All @@ -82,18 +83,45 @@ jobs:
if: ${{ always() && steps.phpcs.outcome == 'failure' }}
run: cs2pr ./phpcs-report.xml

phpstan:
name: "PHPStan"
runs-on: "ubuntu-latest"

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 'latest'
coverage: none
tools: phpstan

# Install dependencies and handle caching in one go.
# Dependencies need to be installed to make sure the PHPCS and PHPUnit classes are recognized.
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
- name: Install Composer dependencies
uses: "ramsey/composer-install@v2"
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")

- name: Run PHPStan
run: phpstan analyse

markdownlint:
name: 'Lint Markdown'
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

# This action also handles the caching of the dependencies.
# https://github.com/actions/setup-node
- name: Set up node and enable caching of dependencies
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '16'

Expand All @@ -115,10 +143,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up node and enable caching of dependencies
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '16'

Expand Down Expand Up @@ -177,7 +205,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Run Yamllint on all yaml files in repo
run: yamllint . --format colored --strict
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/quicktest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

# 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.
Expand Down
81 changes: 23 additions & 58 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ jobs:

strategy:
matrix:
php: ['5.4', '7.0', '7.4', '8.0', '8.1', '8.2', '8.3']
php: ['5.4', '7.0', '7.4', '8.0', '8.3', '8.4']

name: "Lint: PHP ${{ matrix.php }}"

continue-on-error: ${{ matrix.php == '8.3' }}
continue-on-error: ${{ matrix.php == '8.4' }}

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand All @@ -49,15 +49,15 @@ jobs:
tools: cs2pr

- name: Install Composer dependencies - normal
if: ${{ matrix.php < 8.3 }}
if: ${{ matrix.php < 8.4 }}
uses: "ramsey/composer-install@v2"
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")

# For the PHP "nightly", we need to install with ignore platform reqs as not all dependencies allow it yet.
- name: Install Composer dependencies - with ignore platform
if: ${{ matrix.php >= 8.3 }}
if: ${{ matrix.php >= 8.4 }}
uses: "ramsey/composer-install@v2"
with:
composer-options: --ignore-platform-req=php+
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
# IMPORTANT: test runs shouldn't fail because of PHPCS being incompatible with a PHP version.
#
# The matrix is set up so as not to duplicate the builds which are run for code coverage.
php: ['5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
php: ['5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
phpcs_version: ['lowest', 'dev-master']
risky: [false]
experimental: [false]
Expand All @@ -109,7 +109,7 @@ jobs:
extensions: ':iconv' # Run with iconv disabled.

# Experimental builds. These are allowed to fail.
- php: '8.3'
- php: '8.4'
phpcs_version: 'dev-master'
risky: false
experimental: true
Expand All @@ -135,12 +135,12 @@ jobs:
risky: true
experimental: true

- php: '8.2'
- php: '8.3'
phpcs_version: 'lowest'
risky: true
experimental: true

- php: '8.2'
- php: '8.3'
phpcs_version: 'dev-master'
risky: true
experimental: true
Expand All @@ -151,7 +151,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

# 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.
Expand Down Expand Up @@ -183,15 +183,15 @@ jobs:
# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
- name: Install Composer dependencies - normal
if: ${{ matrix.php < 8.3 }}
if: ${{ matrix.php < 8.4 }}
uses: "ramsey/composer-install@v2"
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")

# For PHP "nightly", we need to install with ignore platform reqs as not all dependencies allow it yet.
- name: Install Composer dependencies - with ignore platform
if: ${{ matrix.php >= 8.3 }}
if: ${{ matrix.php >= 8.4 }}
uses: "ramsey/composer-install@v2"
with:
composer-options: --ignore-platform-req=php+
Expand Down Expand Up @@ -266,9 +266,9 @@ jobs:
strategy:
matrix:
include:
- php: '8.2'
- php: '8.3'
phpcs_version: 'dev-master'
- php: '8.2'
- php: '8.3'
phpcs_version: 'lowest'
extensions: ':iconv' # Run one build with iconv disabled.
- php: '5.4'
Expand All @@ -280,7 +280,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

# 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.
Expand Down Expand Up @@ -349,37 +349,14 @@ jobs:
PHPCS_VERSION: ${{ matrix.phpcs_version }}
PHPCSUTILS_USE_CACHE: false

# PHP Coveralls v2 (which supports GH Actions) has a PHP 5.5 minimum, so switch the PHP version.
- name: Switch to PHP latest
if: ${{ success() && matrix.php == '5.4' }}
uses: shivammathur/setup-php@v2
with:
php-version: 'latest'
coverage: none

# Global install is used to prevent a conflict with the local composer.lock.
- name: Install Coveralls
- name: Upload coverage results to Coveralls
if: ${{ success() }}
run: composer global require php-coveralls/php-coveralls:"^2.6.0" --no-interaction

- name: Upload coverage results to Coveralls (normal)
if: ${{ success() && github.actor != 'dependabot[bot]' }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: php-${{ matrix.php }}-phpcs-${{ matrix.phpcs_version }}
run: php-coveralls -v -x build/logs/clover.xml

# Dependabot does not have access to secrets, other than the GH token.
# Ref: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions
# Ref: https://github.com/lemurheavy/coveralls-public/issues/1721
- name: Upload coverage results to Coveralls (Dependabot)
if: ${{ success() && github.actor == 'dependabot[bot]' }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: php-${{ matrix.php }}-phpcs-${{ matrix.phpcs_version }}
run: php-coveralls -v -x build/logs/clover.xml
uses: coverallsapp/github-action@v2
with:
format: clover
file: build/logs/clover.xml
flag-name: php-${{ matrix.php }}-phpcs-${{ matrix.phpcs_version }}
parallel: true

coveralls-finish:
needs: coverage
Expand All @@ -388,19 +365,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Coveralls Finished (normal)
if: ${{ github.actor != 'dependabot[bot]' }}
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.COVERALLS_TOKEN }}
parallel-finished: true

# Dependabot does not have access to secrets, other than the GH token.
# Ref: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions
# Ref: https://github.com/lemurheavy/coveralls-public/issues/1721
- name: Coveralls Finished (Dependabot)
if: ${{ github.actor == 'dependabot[bot]' }}
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
6 changes: 3 additions & 3 deletions .github/workflows/update-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
fi
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ steps.base_branch.outputs.BRANCH }}
# fetch-depth is needed to allow for retrieving the last tag for a non-tag workflow run.
Expand All @@ -68,7 +68,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
# Use a version known to be safe for last phpDocumentor release.
php-version: '8.0'
php-version: '8.1'
ini-file: 'development'
coverage: none
# Install the latest phpDocumentor release as a PHAR.
Expand Down Expand Up @@ -134,7 +134,7 @@ jobs:
path: ./docs/_site

- name: Check GitHub Pages status
uses: crazy-max/ghaction-github-status@v3
uses: crazy-max/ghaction-github-status@v4
with:
pages_threshold: major_outage

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-phpcs-versionnr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: octokit/request-action@v2.x
id: get_latest_release
with:
route: GET /repos/squizlabs/PHP_CodeSniffer/releases/latest
route: GET /repos/PHPCSStandards/PHP_CodeSniffer/releases/latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -52,7 +52,7 @@ jobs:
echo "PR_BRANCH=feature/getversiontest-update-phpcs-version" >> $GITHUB_OUTPUT
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ steps.branches.outputs.BASE }}

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ vendor/
/.phpunit.result.cache
/docs/phpdoc/
!/docs/phpdoc/.nojekyll
phpstan.neon
3 changes: 3 additions & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ globs:
- "**/*.md"
- ".github/**/*.md"

# Show found files on stdout (only valid at root)
showFound: true

# Define glob expressions to ignore.
ignores:
- "docs/index.md" # This file is kept in sync with the README, so will inherit all changes.
Expand Down
1 change: 1 addition & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ yaml-files:
- '*.yaml'
- '*.yml'
- '.yamllint'
- 'phpstan.neon*'

# Rule documentation: https://yamllint.readthedocs.io/en/stable/rules.html
rules:
Expand Down

0 comments on commit 908247b

Please sign in to comment.