Skip to content

Commit

Permalink
remove support for PHP 7
Browse files Browse the repository at this point in the history
  • Loading branch information
garak committed May 24, 2023
1 parent 758d1d1 commit 677e333
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 35 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
phpstan:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
name: PHPStan
steps:
- name: Checkout
Expand All @@ -18,27 +18,24 @@ jobs:
with:
args: analyse
cs-fixer:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
name: PHP-CS-Fixer
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Fix CS
uses: docker://oskarstark/php-cs-fixer-ga
tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- description: 'Lowest'
php: '7.4'
php: '8.0'
composer_option: '--prefer-lowest'
- description: 'Symfony 5.4'
php: '8.0'
symfony: 5.4.*
- description: 'Symfony 6.1'
php: '8.1'
symfony: 6.1.*
symfony: 5.4.*
- description: 'Symfony 6.2'
php: '8.2'
symfony: 6.2.*
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
],
"require": {
"php": "^7.4 || ^8.0",
"php": "^8.0",
"symfony/config": "^5.4 || ^6.0",
"symfony/dependency-injection": "^5.4 || ^6.0",
"symfony/form": "^5.4 || ^6.0",
Expand All @@ -20,7 +20,7 @@
},
"require-dev": {
"dg/bypass-finals": "^1.3",
"phpunit/phpunit": "^9.5"
"phpunit/phpunit": "^9.6"
},
"config": {
"sort-packages": true
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
level: max
level: 8
paths:
- src
- tests
Expand Down
26 changes: 9 additions & 17 deletions src/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,18 @@

final class Filter
{
private FormFactoryInterface $formFactory;

private RequestStack $requestStack;

/** @var array|FormInterface[] */
/** @var array<int, FormInterface> */
private array $forms;

public function __construct(FormFactoryInterface $formFactory, RequestStack $requestStack)
public function __construct(private FormFactoryInterface $formFactory, private RequestStack $requestStack)
{
$this->formFactory = $formFactory;
$this->requestStack = $requestStack;
$this->forms = [];
}

/**
* Perform actual filtering. You need to pass ad identifying name.
* You'll get an array with name of fields in keys and filtered values in values
* (except for "_sort" key, that holds info for sorting).
* Perform actual filtering. You need to pass an identifying name.
* You'll get an array with name of fields as keys and the filtered values
* as values (except for "_sort" key, which holds info for sorting).
*
* @return array<string, mixed>
*/
Expand All @@ -52,11 +46,9 @@ public function filter(string $name): array
}

/**
* Get value of a single form field.
*
* @return mixed
* Get the value of a single form field.
*/
public function getFormData(string $name, string $field)
public function getFormData(string $name, string $field): mixed
{
/** @var array<string, mixed> $data */
$data = $this->getForm($name)->getData();
Expand All @@ -67,15 +59,15 @@ public function getFormData(string $name, string $field)
/**
* Get the form object to pass to a template.
* You can pass an optional type, if you want to ensure that a view
* of same form type is returned.
* of the same form type is returned.
*/
public function getFormView(string $name, ?string $type = null): FormView
{
return $this->getForm($name, $type)->createView();
}

/**
* Save filtered values from form into session.
* Save the filtered values from form into session.
* Possible default values for empty fields can be passed as third argument.
*
* @param array<string, mixed> $defaults
Expand Down
8 changes: 1 addition & 7 deletions src/Twig/FilterRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,8 @@

final class FilterRuntime implements RuntimeExtensionInterface
{
private RequestStack $requestStack;

private PFilter $filter;

public function __construct(RequestStack $requestStack, PFilter $filter)
public function __construct(private RequestStack $requestStack, private PFilter $filter)
{
$this->requestStack = $requestStack;
$this->filter = $filter;
}

public function has(string $name): bool
Expand Down

0 comments on commit 677e333

Please sign in to comment.