Skip to content

Commit

Permalink
Merge pull request #15 from sspat/1.1.0
Browse files Browse the repository at this point in the history
2.0
  • Loading branch information
sspat authored Dec 26, 2020
2 parents b765703 + 62d8dff commit 9f2e22a
Show file tree
Hide file tree
Showing 21 changed files with 774 additions and 284 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/coding-standards.yml
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"
51 changes: 51 additions & 0 deletions .github/workflows/coverage.yml
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 }}
49 changes: 49 additions & 0 deletions .github/workflows/mutation-test.yml
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 }}
47 changes: 47 additions & 0 deletions .github/workflows/phpstan.yml
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"
51 changes: 51 additions & 0 deletions .github/workflows/phpunit.yml
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"
47 changes: 47 additions & 0 deletions .github/workflows/psalm.yml
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"
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

15 changes: 15 additions & 0 deletions CHANGELOG.md
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
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

[![Latest Version](https://img.shields.io/github/v/release/sspat/reserved-words)](https://github.com/sspat/reserved-words/releases)
[![Build](https://img.shields.io/travis/sspat/reserved-words/master)](https://travis-ci.org/sspat/reserved-words)
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fsspat%2Freserved-words%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/sspat/reserved-words/master)
[![Test Coverage](https://coveralls.io/repos/github/sspat/reserved-words/badge.svg?branch=master)](https://coveralls.io/github/sspat/reserved-words?branch=master)
[![Type Coverage](https://shepherd.dev/github/sspat/reserved-words/coverage.svg)](https://shepherd.dev/github/sspat/reserved-words)
[![License](https://img.shields.io/github/license/sspat/reserved-words)](https://github.com/sspat/reserved-words/blob/master/LICENSE)
[![Email](https://img.shields.io/badge/[email protected]?style=flat-square)](mailto:[email protected])

## About

Expand Down Expand Up @@ -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.
*/
Expand All @@ -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');
```
Loading

0 comments on commit 9f2e22a

Please sign in to comment.