Skip to content

Commit da57fd3

Browse files
committed
Merge branch 'master' into feature/support-generics
2 parents ac4b5e0 + cd5acaa commit da57fd3

File tree

201 files changed

+3481
-797
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

201 files changed

+3481
-797
lines changed

.github/workflows/phpstan.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
steps:
2222
- name: Checkout code
23-
uses: actions/checkout@v2
23+
uses: actions/checkout@v3
2424

2525
- name: Install PHP
2626
uses: shivammathur/setup-php@v2
@@ -33,7 +33,7 @@ jobs:
3333
# Dependencies need to be installed to make sure the PHPUnit classes are recognized.
3434
# @link https://github.com/marketplace/actions/install-composer-dependencies
3535
- name: Install Composer dependencies
36-
uses: "ramsey/composer-install@v1"
36+
uses: "ramsey/composer-install@v2"
3737

3838
- name: Run PHPStan
3939
run: phpstan analyse --configuration=phpstan.neon

.github/workflows/test.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
steps:
2828
- name: Checkout code
29-
uses: actions/checkout@v2
29+
uses: actions/checkout@v3
3030

3131
- name: Setup PHP
3232
uses: shivammathur/setup-php@v2
@@ -39,7 +39,7 @@ jobs:
3939
run: php scripts/build-phar.php
4040

4141
- name: Upload the PHPCS phar
42-
uses: actions/upload-artifact@v2
42+
uses: actions/upload-artifact@v3
4343
if: ${{ success() && matrix.php == '8.0' }}
4444
with:
4545
name: phpcs-phar
@@ -48,7 +48,7 @@ jobs:
4848
retention-days: 28
4949

5050
- name: Upload the PHPCBF phar
51-
uses: actions/upload-artifact@v2
51+
uses: actions/upload-artifact@v3
5252
if: ${{ success() && matrix.php == '8.0' }}
5353
with:
5454
name: phpcbf-phar
@@ -89,19 +89,19 @@ jobs:
8989

9090
steps:
9191
- name: Checkout code
92-
uses: actions/checkout@v2
92+
uses: actions/checkout@v3
9393

9494
- name: Setup ini config
9595
id: set_ini
9696
run: |
9797
# Set the "short_open_tag" ini to make sure specific conditions are tested.
9898
# Also turn on error_reporting to ensure all notices are shown.
9999
if [[ ${{ matrix.custom_ini }} == true && "${{ matrix.php }}" == '5.5' ]]; then
100-
echo '::set-output name=PHP_INI::error_reporting=-1, display_errors=On, date.timezone=Australia/Sydney, short_open_tag=On, asp_tags=On'
100+
echo 'PHP_INI=error_reporting=-1, display_errors=On, date.timezone=Australia/Sydney, short_open_tag=On, asp_tags=On' >> $GITHUB_OUTPUT
101101
elif [[ ${{ matrix.custom_ini }} == true && "${{ matrix.php }}" == '7.0' ]]; then
102-
echo '::set-output name=PHP_INI::error_reporting=-1, display_errors=On, date.timezone=Australia/Sydney, short_open_tag=On'
102+
echo 'PHP_INI=error_reporting=-1, display_errors=On, date.timezone=Australia/Sydney, short_open_tag=On' >> $GITHUB_OUTPUT
103103
else
104-
echo '::set-output name=PHP_INI::error_reporting=-1, display_errors=On'
104+
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> $GITHUB_OUTPUT
105105
fi
106106
107107
- name: Install PHP
@@ -116,12 +116,12 @@ jobs:
116116
# @link https://github.com/marketplace/actions/install-composer-dependencies
117117
- name: Install Composer dependencies - normal
118118
if: ${{ matrix.php < '8.0' }}
119-
uses: "ramsey/composer-install@v1"
119+
uses: "ramsey/composer-install@v2"
120120

121121
# For PHP 8.0+, we need to install with ignore platform reqs as PHPUnit 7 is still used.
122122
- name: Install Composer dependencies - with ignore platform
123123
if: ${{ matrix.php >= '8.0' }}
124-
uses: "ramsey/composer-install@v1"
124+
uses: "ramsey/composer-install@v2"
125125
with:
126126
composer-options: --ignore-platform-reqs
127127

@@ -159,7 +159,7 @@ jobs:
159159
run: composer validate --no-check-all --strict
160160

161161
- name: Download the PHPCS phar
162-
uses: actions/download-artifact@v2
162+
uses: actions/download-artifact@v3
163163
with:
164164
name: phpcs-phar
165165

.github/workflows/validate.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ jobs:
2222

2323
steps:
2424
- name: Checkout code
25-
uses: actions/checkout@v2
25+
uses: actions/checkout@v3
2626

2727
- name: Install xmllint
28-
run: sudo apt-get install --no-install-recommends -y libxml2-utils
28+
run: |
29+
sudo apt-get update
30+
sudo apt-get install --no-install-recommends -y libxml2-utils
2931
3032
- name: Retrieve XML Schema
3133
run: curl -O https://www.w3.org/2012/04/XMLSchema.xsd
@@ -63,7 +65,7 @@ jobs:
6365

6466
steps:
6567
- name: Checkout code
66-
uses: actions/checkout@v2
68+
uses: actions/checkout@v3
6769

6870
- name: Install PHP
6971
uses: shivammathur/setup-php@v2

README.md

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ php phpcbf.phar -h
3333

3434
### Composer
3535
If you use Composer, you can install PHP_CodeSniffer system-wide with the following command:
36-
37-
composer global require "squizlabs/php_codesniffer=*"
38-
36+
```bash
37+
composer global require "squizlabs/php_codesniffer=*"
38+
```
3939
Make sure you have the composer bin dir in your PATH. The default value is `~/.composer/vendor/bin/`, but you can check the value that you need to use by running `composer global config bin-dir --absolute`.
4040

4141
Or alternatively, include a dependency for `squizlabs/php_codesniffer` in your `composer.json` file. For example:
@@ -49,47 +49,48 @@ Or alternatively, include a dependency for `squizlabs/php_codesniffer` in your `
4949
```
5050

5151
You will then be able to run PHP_CodeSniffer from the vendor bin directory:
52-
53-
./vendor/bin/phpcs -h
54-
./vendor/bin/phpcbf -h
55-
52+
```bash
53+
./vendor/bin/phpcs -h
54+
./vendor/bin/phpcbf -h
55+
```
5656
### Phive
5757
If you use Phive, you can install PHP_CodeSniffer as a project tool using the following commands:
58-
59-
phive install phpcs
60-
phive install phpcbf
61-
58+
```bash
59+
phive install phpcs
60+
phive install phpcbf
61+
```
6262
You will then be able to run PHP_CodeSniffer from the tools directory:
63-
64-
./tools/phpcs -h
65-
./tools/phpcbf -h
66-
63+
```bash
64+
./tools/phpcs -h
65+
./tools/phpcbf -h
66+
```
6767
### PEAR
6868
If you use PEAR, you can install PHP_CodeSniffer using the PEAR installer. This will make the `phpcs` and `phpcbf` commands immediately available for use. To install PHP_CodeSniffer using the PEAR installer, first ensure you have [installed PEAR](http://pear.php.net/manual/en/installation.getting.php) and then run the following command:
69-
70-
pear install PHP_CodeSniffer
71-
69+
```bash
70+
pear install PHP_CodeSniffer
71+
```
7272
### Git Clone
7373
You can also download the PHP_CodeSniffer source and run the `phpcs` and `phpcbf` commands directly from the Git clone:
74-
75-
git clone https://github.com/squizlabs/PHP_CodeSniffer.git
76-
cd PHP_CodeSniffer
77-
php bin/phpcs -h
78-
php bin/phpcbf -h
79-
74+
```bash
75+
git clone https://github.com/squizlabs/PHP_CodeSniffer.git
76+
cd PHP_CodeSniffer
77+
php bin/phpcs -h
78+
php bin/phpcbf -h
79+
```
8080
## Getting Started
8181

8282
The default coding standard used by PHP_CodeSniffer is the PEAR coding standard. To check a file against the PEAR coding standard, simply specify the file's location:
83-
84-
$ phpcs /path/to/code/myfile.php
85-
83+
```bash
84+
phpcs /path/to/code/myfile.php
85+
```
8686
Or if you wish to check an entire directory you can specify the directory location instead of a file.
87-
88-
$ phpcs /path/to/code-directory
89-
87+
```bash
88+
phpcs /path/to/code-directory
89+
```
9090
If you wish to check your code against the PSR-12 coding standard, use the `--standard` command line argument:
91-
92-
$ phpcs --standard=PSR12 /path/to/code-directory
91+
```bash
92+
phpcs --standard=PSR12 /path/to/code-directory
93+
```
9394

9495
If PHP_CodeSniffer finds any coding standard errors, a report will be shown after running the command.
9596

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"type": "library",
55
"keywords": [
66
"phpcs",
7-
"standards"
7+
"standards",
8+
"static analysis"
89
],
910
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
1011
"license": "BSD-3-Clause",

0 commit comments

Comments
 (0)