-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from sspat/1.1.0
2.0
- Loading branch information
Showing
21 changed files
with
774 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: "Check Coding Standards" | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- "master" | ||
jobs: | ||
coding-standards: | ||
name: "Check Coding Standards" | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
dependencies: | ||
- "locked" | ||
php-version: | ||
- "8.0" | ||
operating-system: | ||
- "ubuntu-latest" | ||
steps: | ||
- name: "Checkout" | ||
uses: "actions/checkout@v2" | ||
- name: "Install PHP" | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
coverage: "pcov" | ||
php-version: "${{ matrix.php-version }}" | ||
ini-values: memory_limit=-1 | ||
tools: composer:v2, cs2pr | ||
- name: "Cache dependencies" | ||
uses: "actions/cache@v2" | ||
with: | ||
path: | | ||
~/.composer/cache | ||
vendor | ||
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" | ||
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" | ||
- name: "Install lowest dependencies" | ||
if: ${{ matrix.dependencies == 'lowest' }} | ||
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest" | ||
- name: "Install highest dependencies" | ||
if: ${{ matrix.dependencies == 'highest' }} | ||
run: "composer update --no-interaction --no-progress --no-suggest" | ||
- name: "Install locked dependencies" | ||
if: ${{ matrix.dependencies == 'locked' }} | ||
run: "composer install --no-interaction --no-progress --no-suggest" | ||
- name: "Coding Standard" | ||
run: "vendor/bin/phpcs -q --report=checkstyle | cs2pr" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: "Code coverage" | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- "master" | ||
jobs: | ||
coverage: | ||
name: "Code coverage" | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
dependencies: | ||
- "locked" | ||
php-version: | ||
- "8.0" | ||
operating-system: | ||
- "ubuntu-latest" | ||
steps: | ||
- name: "Checkout" | ||
uses: "actions/checkout@v2" | ||
- name: "Install PHP" | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
coverage: "pcov" | ||
php-version: "${{ matrix.php-version }}" | ||
ini-values: memory_limit=-1 | ||
- name: "Cache dependencies" | ||
uses: "actions/cache@v2" | ||
with: | ||
path: | | ||
~/.composer/cache | ||
vendor | ||
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" | ||
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" | ||
- name: "Install lowest dependencies" | ||
if: ${{ matrix.dependencies == 'lowest' }} | ||
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest" | ||
- name: "Install highest dependencies" | ||
if: ${{ matrix.dependencies == 'highest' }} | ||
run: "composer update --no-interaction --no-progress --no-suggest" | ||
- name: "Install locked dependencies" | ||
if: ${{ matrix.dependencies == 'locked' }} | ||
run: "composer install --no-interaction --no-progress --no-suggest" | ||
- name: "Code coverage" | ||
run: | | ||
vendor/bin/phpunit --testsuite=unit,functional --coverage-clover build/logs/clover.xml | ||
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar | ||
php php-coveralls.phar --verbose | ||
env: | ||
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: "Mutation tests" | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- "master" | ||
jobs: | ||
mutation-tests: | ||
name: "Mutation tests" | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
dependencies: | ||
- "locked" | ||
php-version: | ||
- "8.0" | ||
operating-system: | ||
- "ubuntu-latest" | ||
steps: | ||
- name: "Checkout" | ||
uses: "actions/checkout@v2" | ||
- name: "Install PHP" | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
coverage: "pcov" | ||
php-version: "${{ matrix.php-version }}" | ||
ini-values: memory_limit=-1 | ||
- name: "Cache dependencies" | ||
uses: "actions/cache@v2" | ||
with: | ||
path: | | ||
~/.composer/cache | ||
vendor | ||
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" | ||
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" | ||
- name: "Install lowest dependencies" | ||
if: ${{ matrix.dependencies == 'lowest' }} | ||
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest" | ||
- name: "Install highest dependencies" | ||
if: ${{ matrix.dependencies == 'highest' }} | ||
run: "composer update --no-interaction --no-progress --no-suggest" | ||
- name: "Install locked dependencies" | ||
if: ${{ matrix.dependencies == 'locked' }} | ||
run: "composer install --no-interaction --no-progress --no-suggest" | ||
- name: "Infection" | ||
run: "vendor/bin/infection" | ||
env: | ||
INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }} | ||
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: "Static Analysis by PHPStan" | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- "master" | ||
jobs: | ||
static-analysis-phpstan: | ||
name: "Static Analysis by PHPStan" | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
dependencies: | ||
- "locked" | ||
php-version: | ||
- "8.0" | ||
operating-system: | ||
- "ubuntu-latest" | ||
steps: | ||
- name: "Checkout" | ||
uses: "actions/checkout@v2" | ||
- name: "Install PHP" | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
coverage: "pcov" | ||
php-version: "${{ matrix.php-version }}" | ||
ini-values: memory_limit=-1 | ||
tools: composer:v2, cs2pr | ||
- name: "Cache dependencies" | ||
uses: "actions/cache@v2" | ||
with: | ||
path: | | ||
~/.composer/cache | ||
vendor | ||
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" | ||
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" | ||
- name: "Install lowest dependencies" | ||
if: ${{ matrix.dependencies == 'lowest' }} | ||
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest" | ||
- name: "Install highest dependencies" | ||
if: ${{ matrix.dependencies == 'highest' }} | ||
run: "composer update --no-interaction --no-progress --no-suggest" | ||
- name: "Install locked dependencies" | ||
if: ${{ matrix.dependencies == 'locked' }} | ||
run: "composer install --no-interaction --no-progress --no-suggest" | ||
- name: "phpstan" | ||
run: "vendor/bin/phpstan analyse --memory-limit=-1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: "PHPUnit tests" | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- "master" | ||
jobs: | ||
phpunit: | ||
name: "PHPUnit tests" | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
dependencies: | ||
- "lowest" | ||
- "highest" | ||
- "locked" | ||
php-version: | ||
- "7.3" | ||
- "7.4" | ||
- "8.0" | ||
operating-system: | ||
- "ubuntu-latest" | ||
- "windows-latest" | ||
steps: | ||
- name: "Checkout" | ||
uses: "actions/checkout@v2" | ||
- name: "Install PHP" | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
coverage: "pcov" | ||
php-version: "${{ matrix.php-version }}" | ||
ini-values: memory_limit=-1 | ||
- name: "Cache dependencies" | ||
uses: "actions/cache@v2" | ||
with: | ||
path: | | ||
~/.composer/cache | ||
vendor | ||
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" | ||
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" | ||
- name: "Install lowest dependencies" | ||
if: ${{ matrix.dependencies == 'lowest' }} | ||
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest" | ||
- name: "Install highest dependencies" | ||
if: ${{ matrix.dependencies == 'highest' }} | ||
run: "composer update --no-interaction --no-progress --no-suggest" | ||
- name: "Install locked dependencies" | ||
if: ${{ matrix.dependencies == 'locked' }} | ||
run: "composer install --no-interaction --no-progress --no-suggest" | ||
- name: "Tests" | ||
run: "vendor/bin/phpunit --fail-on-warning" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: "Static Analysis by Psalm" | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- "master" | ||
jobs: | ||
static-analysis-psalm: | ||
name: "Static Analysis by Psalm" | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
dependencies: | ||
- "locked" | ||
php-version: | ||
- "8.0" | ||
operating-system: | ||
- "ubuntu-latest" | ||
steps: | ||
- name: "Checkout" | ||
uses: "actions/checkout@v2" | ||
- name: "Install PHP" | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
coverage: "pcov" | ||
php-version: "${{ matrix.php-version }}" | ||
ini-values: memory_limit=-1 | ||
tools: composer:v2, cs2pr | ||
- name: "Cache dependencies" | ||
uses: "actions/cache@v2" | ||
with: | ||
path: | | ||
~/.composer/cache | ||
vendor | ||
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" | ||
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" | ||
- name: "Install lowest dependencies" | ||
if: ${{ matrix.dependencies == 'lowest' }} | ||
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest" | ||
- name: "Install highest dependencies" | ||
if: ${{ matrix.dependencies == 'highest' }} | ||
run: "composer update --no-interaction --no-progress --no-suggest" | ||
- name: "Install locked dependencies" | ||
if: ${{ matrix.dependencies == 'locked' }} | ||
run: "composer install --no-interaction --no-progress --no-suggest" | ||
- name: "psalm" | ||
run: "vendor/bin/psalm --output-format=github --shepherd --stats" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
### 2.0.0 (26.12.2020) | ||
|
||
* Added support for PHP 8.0 | ||
* BC Break: Dropped support of PHP 7.2 | ||
* BC Break: Added new keyword reserved in php 8 - `match` | ||
* BC Break: Updated `mixed` keyword to reflect changes in php 8 | ||
* BC Break: Updated all keywords except `namespace` and `__halt_compiler` | ||
to reflect that they can be used as namespace parts since php 8.0 | ||
* BC Break: Added new method `isReservedClassName` to check for reserved words in | ||
class/trait/interface names. The method `isReservedNamespaceName` should | ||
be now used only for checking for reserved words in namespaces. | ||
These changes are necessary because php 8 changed the reserved words behavior for namespaces. | ||
* Migrated CI to GitHub actions | ||
* Added mutation testing | ||
* Added phpstan static analysis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,10 @@ | |
|
||
[](https://github.com/sspat/reserved-words/releases) | ||
[](https://travis-ci.org/sspat/reserved-words) | ||
[](https://dashboard.stryker-mutator.io/reports/github.com/sspat/reserved-words/master) | ||
[](https://coveralls.io/github/sspat/reserved-words?branch=master) | ||
[](https://shepherd.dev/github/sspat/reserved-words) | ||
[](https://github.com/sspat/reserved-words/blob/master/LICENSE) | ||
[](mailto:[email protected]) | ||
|
||
## About | ||
|
||
|
@@ -47,9 +49,17 @@ $isReserved = $reservedWords->isReserved($word); | |
*/ | ||
$cannotUseAsConstantName = $reservedWords->isReservedConstantName($word); | ||
/** | ||
* Checks that the word cannot be used as a namespace part or class/interface/trait name in your current php version. | ||
* Checks that the word cannot be used as a namespace part in your current php version. | ||
* | ||
* This is used for checking parts of namespaces, not full namespace strings. | ||
* E.g. calling this with `Some\Namespace\String` is incorrect, you should make three separate calls | ||
* with `Some`, `Namespace` and `String`. | ||
*/ | ||
$cannotUseAsNamespaceName = $reservedWords->isReservedNamespaceName($word); | ||
/** | ||
* Checks that the word cannot be used as a class/interface/trait name in your current php version. | ||
*/ | ||
$cannotUseAsNamespaceName = $reservedWords->isReservedClassName($word); | ||
/** | ||
* Checks that the word cannot be used as a function name in your current php version. | ||
*/ | ||
|
@@ -64,6 +74,7 @@ $cannotUseAsMethodName = $reservedWords->isReservedMethodName($word); | |
*/ | ||
$cannotUseAsConstantName = $reservedWords->isReservedConstantName($word, '5.6'); | ||
$cannotUseAsNamespaceName = $reservedWords->isReservedNamespaceName($word, '5.6.1'); | ||
$cannotUseAsFunctionName = $reservedWords->isReservedFunctionName($word, '7.0'); | ||
$cannotUseAsNamespaceName = $reservedWords->isReservedClassName($word, '5.6.1'); | ||
$cannotUseAsFunctionName = $reservedWords->isReservedFunctionName($word, '8.0'); | ||
$cannotUseAsMethodName = $reservedWords->isReservedMethodName($word, '7.4.2'); | ||
``` |
Oops, something went wrong.