Skip to content

Commit

Permalink
Bump PHP to 7.4 and support 8.1 (#8)
Browse files Browse the repository at this point in the history
* chore: bump minimum PHP version to 7.4
* chore: support PHP 8.1
  • Loading branch information
jiripudil authored Oct 11, 2021
1 parent bae143b commit 57fd909
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

strategy:
matrix:
php-version: [ "7.4" ]
php-version: [ "8.0" ]
operating-system: [ "ubuntu-latest" ]
fail-fast: false

Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:

strategy:
matrix:
php-version: [ "7.4" ]
php-version: [ "8.0" ]
operating-system: [ "ubuntu-latest" ]
fail-fast: false

Expand Down Expand Up @@ -138,11 +138,11 @@ jobs:

strategy:
matrix:
php-version: [ "7.2", "7.3", "7.4", "8.0" ]
php-version: [ "7.4", "8.0", "8.1" ]
operating-system: [ "ubuntu-latest" ]
composer-args: [ "" ]
include:
- php-version: "7.2"
- php-version: "7.4"
operating-system: "ubuntu-latest"
composer-args: "--prefer-lowest"
fail-fast: false
Expand Down Expand Up @@ -206,7 +206,7 @@ jobs:

strategy:
matrix:
php-version: [ "7.4" ]
php-version: [ "8.0" ]
operating-system: [ "ubuntu-latest" ]
fail-fast: false

Expand Down Expand Up @@ -264,5 +264,5 @@ jobs:
CI: true
COVERALLS_REPO_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.2/php-coveralls.phar
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar
php php-coveralls.phar --verbose --config tests/.coveralls.yml
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
}
],
"require": {
"php": ">=7.2",
"nette/di": "^3.0",
"php": ">=7.4",
"nette/di": "^3.0.1",
"symfony/cache": "^5.0",
"symfony/config": "^5.0",
"symfony/validator": "^5.0"
Expand All @@ -27,6 +27,7 @@
"doctrine/annotations": "^1.8",
"doctrine/cache": "^1.10",
"nette/bootstrap": "^3.0",
"nette/tester": "^2.4",
"ninjify/nunjuck": "^0.3.0",
"ninjify/qa": "^0.12",
"phpstan/phpstan": "^0.12",
Expand Down
6 changes: 3 additions & 3 deletions src/ContainerConstraintValidatorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
final class ContainerConstraintValidatorFactory implements ConstraintValidatorFactoryInterface
{

/** @var Container */
private $container;
private Container $container;

/** @var ConstraintValidatorInterface[] */
private $validators;
private array $validators;

public function __construct(Container $container)
{
Expand All @@ -35,6 +34,7 @@ public function __construct(Container $container)
*/
public function getInstance(Constraint $constraint)
{
/** @var class-string<ConstraintValidatorInterface> $name */
$name = $constraint->validatedBy();

if (!isset($this->validators[$name])) {
Expand Down
6 changes: 3 additions & 3 deletions src/DI/ValidatorExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use Contributte\Validator\ContainerConstraintValidatorFactory;
use Doctrine\Common\Annotations\Reader;
use Nette\DI\CompilerExtension;
use Nette\DI\Definitions\ServiceDefinition;
use Nette\DI\Definitions\Statement;
use Nette\DI\ServiceDefinition;
use Nette\Schema\Expect;
use Nette\Schema\Schema;
use stdClass;
Expand Down Expand Up @@ -52,7 +52,7 @@ public function loadConfiguration(): void
{
$containerBuilder = $this->getContainerBuilder();

$validatorBuilder = $containerBuilder->addDefinition($this->prefix('validatorBuilder'))
$validatorBuilder = $containerBuilder->addDefinition($this->prefix('validatorBuilder'), new ServiceDefinition())
->setFactory(ValidatorBuilder::class)
->addSetup('setConstraintValidatorFactory', [new Statement(ContainerConstraintValidatorFactory::class)])
->setAutowired(false);
Expand All @@ -62,7 +62,7 @@ public function loadConfiguration(): void
$this->setupLoaders($validatorBuilder);
$this->setupObjectInitializers($validatorBuilder);

$containerBuilder->addDefinition($this->prefix('validator'))
$containerBuilder->addDefinition($this->prefix('validator'), new ServiceDefinition())
->setType(ValidatorInterface::class)
->setFactory([$validatorBuilder, 'getValidator']);
}
Expand Down

0 comments on commit 57fd909

Please sign in to comment.