-
Notifications
You must be signed in to change notification settings - Fork 76
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 #1 from answear/allow-php8-add-github-workflows
Allow php8, add github workflows, phpstan, drop support for sf4, drop support for php < 7.4
- Loading branch information
Showing
12 changed files
with
155 additions
and
28 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,50 @@ | ||
name: "Continuous Integration" | ||
|
||
on: | ||
pull_request: null | ||
|
||
jobs: | ||
phpunit: | ||
name: "PHPUnit" | ||
runs-on: "ubuntu-20.04" | ||
|
||
strategy: | ||
matrix: | ||
php-version: | ||
- "7.4" | ||
- "8.0" | ||
- "8.1" | ||
deps: | ||
- "normal" | ||
include: | ||
- deps: "low" | ||
php-version: "7.4" | ||
|
||
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 }}" | ||
|
||
- name: "Cache dependencies installed with composer" | ||
uses: "actions/cache@v2" | ||
with: | ||
path: "~/.composer/cache" | ||
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" | ||
restore-keys: "php-${{ matrix.php-version }}-composer-locked-" | ||
|
||
- name: "Update dependencies with composer" | ||
run: "composer update --no-interaction --no-progress --no-suggest" | ||
if: "${{ matrix.deps == 'normal' }}" | ||
|
||
- name: "Install lowest possible dependencies with composer" | ||
run: "composer update --no-interaction --no-progress --no-suggest --prefer-dist --prefer-lowest" | ||
if: "${{ matrix.deps == 'low' }}" | ||
|
||
- name: "Run PHPUnit" | ||
run: "vendor/bin/phpunit" |
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,39 @@ | ||
name: "Static Analysis" | ||
|
||
on: | ||
pull_request: null | ||
|
||
jobs: | ||
phpstan: | ||
name: "PHPStan" | ||
runs-on: "ubuntu-20.04" | ||
|
||
strategy: | ||
matrix: | ||
php-version: | ||
- "7.4" | ||
- "8.0" | ||
- "8.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 }}" | ||
|
||
- name: "Cache dependencies installed with composer" | ||
uses: "actions/cache@v2" | ||
with: | ||
path: "~/.composer/cache" | ||
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" | ||
restore-keys: "php-${{ matrix.php-version }}-composer-locked-" | ||
|
||
- name: "Install dependencies with composer" | ||
run: "composer install --no-interaction --no-progress" | ||
|
||
- name: "Run a static analysis with phpstan/phpstan" | ||
run: "vendor/bin/phpstan analyse --error-format=github" |
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
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
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,6 @@ | ||
parameters: | ||
ignoreErrors: | ||
- | ||
message: "#^Method Limenius\\\\Liform\\\\Resolver\\:\\:resolve\\(\\) should return array but returns Limenius\\\\Liform\\\\Transformer\\\\TransformerInterface\\.$#" | ||
count: 1 | ||
path: src/Limenius/Liform/Resolver.php |
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,7 @@ | ||
includes: | ||
- phpstan-baseline.neon | ||
|
||
parameters: | ||
level: 5 | ||
paths: | ||
- %rootDir%/../../../src |
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
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 |
---|---|---|
|
@@ -15,6 +15,9 @@ | |
use Symfony\Component\Validator\Constraint; | ||
use Symfony\Component\Form\Guess\ValueGuess; | ||
use Symfony\Component\Form\Guess\Guess; | ||
use Symfony\Component\Validator\Constraints\Range; | ||
use Symfony\Component\Validator\Constraints\Type; | ||
use Symfony\Component\Validator\Constraints\Length; | ||
|
||
/** | ||
* @author Nacho Martín <[email protected]> | ||
|
@@ -41,21 +44,23 @@ public function guessMinLength(string $class, string $property) | |
public function guessMinLengthForConstraint(Constraint $constraint) | ||
{ | ||
switch (get_class($constraint)) { | ||
case 'Symfony\Component\Validator\Constraints\Length': | ||
case Length::class: | ||
if (is_numeric($constraint->min)) { | ||
return new ValueGuess($constraint->min, Guess::HIGH_CONFIDENCE); | ||
} | ||
break; | ||
case 'Symfony\Component\Validator\Constraints\Type': | ||
case Type::class: | ||
if (in_array($constraint->type, array('double', 'float', 'numeric', 'real'))) { | ||
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE); | ||
} | ||
break; | ||
case 'Symfony\Component\Validator\Constraints\Range': | ||
case Range::class: | ||
if (is_numeric($constraint->min)) { | ||
return new ValueGuess(strlen((string) $constraint->min), Guess::LOW_CONFIDENCE); | ||
} | ||
break; | ||
} | ||
|
||
return null; | ||
} | ||
} |
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
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
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
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