Skip to content

Commit

Permalink
Merge pull request #186 from doctrine/PHP7.1-2
Browse files Browse the repository at this point in the history
Reintroduce PHP 7.1 to old 1.4 compatibilty branch
  • Loading branch information
beberlei committed Apr 16, 2021
2 parents 319a8e5 + fa8fc35 commit 4bd5c1c
Show file tree
Hide file tree
Showing 66 changed files with 356 additions and 254 deletions.
121 changes: 112 additions & 9 deletions .github/workflows/continuous-integration.yml
Expand Up @@ -5,12 +5,115 @@ on:
pull_request:

jobs:
roave_bc_check:
name: "Roave BC Check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Roave BC Check
uses: docker://nyholm/roave-bc-check-ga
roave_bc_check:
name: "Roave BC Check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Roave BC Check
uses: docker://nyholm/roave-bc-check-ga

phpunit:
name: "PHPUnit"
runs-on: "ubuntu-20.04"

strategy:
matrix:
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
dependencies:
- "highest"
include:
- dependencies: "lowest"
php-version: "7.2"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "pcov"
ini-values: "zend.assertions=1"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
dependency-versions: "${{ matrix.dependencies }}"
composer-options: "--prefer-dist"

- name: "Run PHPUnit"
run: "vendor/bin/phpunit --coverage-clover=coverage.xml"

- name: "Upload coverage file"
uses: "actions/upload-artifact@v2"
with:
name: "phpunit-${{ matrix.dependencies }}-${{ matrix.php-version }}.coverage"
path: "coverage.xml"

phpunit-lower-php-versions:
name: "PHPUnit"
runs-on: "ubuntu-20.04"

strategy:
matrix:
php-version:
- "7.1"
dependencies:
- "highest"
include:
- dependencies: "lowest"
php-version: "7.1"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
ini-values: "zend.assertions=1"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
dependency-versions: "${{ matrix.dependencies }}"
composer-options: "--prefer-dist"

- name: "Run PHPUnit"
run: "vendor/bin/phpunit"

upload_coverage:
name: "Upload coverage to Codecov"
runs-on: "ubuntu-20.04"
needs:
- "phpunit"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2

- name: "Download coverage files"
uses: "actions/download-artifact@v2"
with:
path: "reports"

- name: "Upload to Codecov"
uses: "codecov/codecov-action@v1"
with:
directory: reports

38 changes: 38 additions & 0 deletions .github/workflows/static-analysis.yml
@@ -0,0 +1,38 @@
name: "Static Analysis"

on:
pull_request:
branches:
- "*.x"
push:
branches:
- "*.x"

jobs:
static-analysis-phpstan:
name: "Static Analysis with PHPStan"
runs-on: "ubuntu-20.04"

strategy:
matrix:
php-version:
- "7.4"

steps:
- name: "Checkout code"
uses: "actions/checkout@v2"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
dependency-versions: "highest"

- name: "Run a static analysis with phpstan/phpstan"
run: "vendor/bin/phpstan analyse"

58 changes: 0 additions & 58 deletions .travis.yml

This file was deleted.

10 changes: 5 additions & 5 deletions composer.json
Expand Up @@ -13,13 +13,13 @@
{"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"}
],
"require": {
"php": "^7.2 || ^8.0"
"php": "^7.1 || ^8.0"
},
"require-dev": {
"doctrine/coding-standard": "^7.0",
"phpstan/phpstan": "^0.11",
"phpstan/phpstan-phpunit": "^0.11",
"phpstan/phpstan-strict-rules": "^0.11",
"doctrine/coding-standard": "^8.0",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpstan/phpstan-strict-rules": "^0.12",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0"
},
"autoload": {
Expand Down
5 changes: 4 additions & 1 deletion lib/Doctrine/Common/Inflector/Inflector.php
Expand Up @@ -167,7 +167,7 @@ public static function reset() : void
* }}}
*
* @param string $type The type of inflection, either 'plural' or 'singular'
* @param array|iterable $rules An array of rules to be added.
* @param array<string,mixed>|iterable<string,mixed> $rules An array of rules to be added.
* @param boolean $reset If true, will unset default inflections for all
* new rules that are being defined in $rules.
*
Expand Down Expand Up @@ -197,6 +197,9 @@ public static function rules(string $type, iterable $rules, bool $reset = false)
}
}

/**
* @param array<string,mixed>|iterable<string,mixed> $rules An array of rules to be added.
*/
private static function buildRuleset(iterable $rules) : Ruleset
{
$regular = [];
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/Inflector/CachedWordInflector.php
Expand Up @@ -17,7 +17,7 @@ public function __construct(WordInflector $wordInflector)
$this->wordInflector = $wordInflector;
}

public function inflect(string $word) : string
public function inflect(string $word): string
{
return $this->cache[$word] ?? $this->cache[$word] = $this->wordInflector->inflect($word);
}
Expand Down
11 changes: 6 additions & 5 deletions lib/Doctrine/Inflector/GenericLanguageInflectorFactory.php
Expand Up @@ -5,6 +5,7 @@
namespace Doctrine\Inflector;

use Doctrine\Inflector\Rules\Ruleset;

use function array_unshift;

abstract class GenericLanguageInflectorFactory implements LanguageInflectorFactory
Expand All @@ -21,7 +22,7 @@ final public function __construct()
$this->pluralRulesets[] = $this->getPluralRuleset();
}

final public function build() : Inflector
final public function build(): Inflector
{
return new Inflector(
new CachedWordInflector(new RulesetInflector(
Expand All @@ -33,7 +34,7 @@ final public function build() : Inflector
);
}

final public function withSingularRules(?Ruleset $singularRules, bool $reset = false) : LanguageInflectorFactory
final public function withSingularRules(?Ruleset $singularRules, bool $reset = false): LanguageInflectorFactory
{
if ($reset) {
$this->singularRulesets = [];
Expand All @@ -46,7 +47,7 @@ final public function withSingularRules(?Ruleset $singularRules, bool $reset = f
return $this;
}

final public function withPluralRules(?Ruleset $pluralRules, bool $reset = false) : LanguageInflectorFactory
final public function withPluralRules(?Ruleset $pluralRules, bool $reset = false): LanguageInflectorFactory
{
if ($reset) {
$this->pluralRulesets = [];
Expand All @@ -59,7 +60,7 @@ final public function withPluralRules(?Ruleset $pluralRules, bool $reset = false
return $this;
}

abstract protected function getSingularRuleset() : Ruleset;
abstract protected function getSingularRuleset(): Ruleset;

abstract protected function getPluralRuleset() : Ruleset;
abstract protected function getPluralRuleset(): Ruleset;
}

0 comments on commit 4bd5c1c

Please sign in to comment.