Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DevKit updates for 4.x branch #1658

Merged
merged 9 commits into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
coverage: none
tools: composer:v2, composer-normalize:2
env:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
coverage: none
tools: composer:v2

Expand All @@ -54,7 +54,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
coverage: none
tools: composer:v2

Expand All @@ -65,7 +65,7 @@ jobs:
composer-options: --prefer-dist --prefer-stable

- name: Psalm
run: vendor/bin/psalm --no-progress --show-info=false --stats --output-format=github --threads=$(nproc) --shepherd --php-version=8.1
run: vendor/bin/psalm --no-progress --show-info=false --stats --output-format=github --threads=$(nproc) --shepherd --php-version=8.2

rector:
name: Rector
Expand All @@ -79,7 +79,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
coverage: none
tools: composer:v2

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/symfony-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
coverage: none
tools: composer:v2

Expand All @@ -54,7 +54,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
coverage: none
tools: composer:v2

Expand All @@ -79,7 +79,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
coverage: none
tools: composer:v2

Expand All @@ -104,7 +104,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
coverage: none
tools: composer:v2

Expand Down
23 changes: 6 additions & 17 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
strategy:
matrix:
php-version:
- '7.4'
- '8.0'
- '8.1'
- '8.2'
Expand All @@ -39,31 +38,21 @@ jobs:
symfony-require: ['']
variant: [normal]
include:
- php-version: '7.4'
- php-version: '8.0'
dependencies: lowest
allowed-to-fail: false
variant: normal
- php-version: '8.1'
- php-version: '8.2'
dependencies: highest
allowed-to-fail: false
symfony-require: 4.4.*
variant: symfony/symfony:"4.4.*"
- php-version: '8.1'
- php-version: '8.2'
dependencies: highest
allowed-to-fail: false
symfony-require: 5.4.*
variant: symfony/symfony:"5.4.*"
- php-version: '8.1'
dependencies: highest
allowed-to-fail: false
symfony-require: 6.0.*
variant: symfony/symfony:"6.0.*"
- php-version: '8.1'
dependencies: highest
allowed-to-fail: false
symfony-require: 6.1.*
variant: symfony/symfony:"6.1.*"
- php-version: '8.1'
- php-version: '8.2'
dependencies: highest
allowed-to-fail: false
symfony-require: 6.2.*
Expand Down Expand Up @@ -103,6 +92,6 @@ jobs:
run: make coverage

- name: Send coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
file: build/logs/clover.xml
files: build/logs/clover.xml
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ phpstan:
.PHONY: phpstan

psalm:
vendor/bin/psalm --php-version=8.1
vendor/bin/psalm --php-version=8.2
.PHONY: psalm

rector:
Expand Down
55 changes: 28 additions & 27 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
],
"homepage": "https://docs.sonata-project.org/projects/SonataPageBundle",
"require": {
"php": "^7.4 || ^8.0",
"php": "^8.0",
"cocur/slugify": "^4.0",
"doctrine/doctrine-bundle": "^2.5",
"doctrine/persistence": "^2.1 || ^3.0",
"doctrine/doctrine-bundle": "^2.7",
"doctrine/persistence": "^3.0.2",
"sonata-project/admin-bundle": "^4.19",
"sonata-project/block-bundle": "^4.18",
"sonata-project/doctrine-extensions": "^1.18 || ^2.1",
Expand All @@ -33,27 +33,26 @@
"sonata-project/seo-bundle": "^3.4",
"sonata-project/twig-extensions": "^1.3 || ^2.0",
"symfony-cmf/routing-bundle": "^2.1 || ^3.0",
"symfony/config": "^4.4 || ^5.4 || ^6.0",
"symfony/console": "^4.4 || ^5.4 || ^6.0",
"symfony/dependency-injection": "^4.4.3 || ^5.4 || ^6.0",
"symfony/form": "^4.4 || ^5.4 || ^6.0",
"symfony/framework-bundle": "^4.4 || ^5.4 || ^6.0",
"symfony/http-foundation": "^4.4 || ^5.4 || ^6.0",
"symfony/http-kernel": "^4.4 || ^5.4 || ^6.0",
"symfony/intl": "^4.4 || ^5.4 || ^6.0",
"symfony/options-resolver": "^4.4 || ^5.4 || ^6.0",
"symfony/process": "^4.4 || ^5.4 || ^6.0",
"symfony/routing": "^4.4 || ^5.4 || ^6.0",
"symfony/security-core": "^4.4 || ^5.4 || ^6.0",
"symfony/security-http": "^4.4 || ^5.4 || ^6.0",
"symfony/serializer": "^4.4 || ^5.4 || ^6.0",
"symfony/validator": "^4.4 || ^5.4 || ^6.0",
"symfony/config": "^4.4 || ^5.4 || ^6.2",
"symfony/console": "^4.4 || ^5.4 || ^6.2",
"symfony/dependency-injection": "^4.4.3 || ^5.4 || ^6.2",
"symfony/form": "^4.4 || ^5.4 || ^6.2",
"symfony/framework-bundle": "^4.4 || ^5.4 || ^6.2",
"symfony/http-foundation": "^4.4 || ^5.4 || ^6.2",
"symfony/http-kernel": "^4.4 || ^5.4 || ^6.2",
"symfony/intl": "^4.4 || ^5.4 || ^6.2",
"symfony/options-resolver": "^4.4 || ^5.4 || ^6.2",
"symfony/process": "^4.4 || ^5.4 || ^6.2",
"symfony/routing": "^4.4 || ^5.4 || ^6.2",
"symfony/security-core": "^4.4 || ^5.4 || ^6.2",
"symfony/security-http": "^4.4 || ^5.4 || ^6.2",
"symfony/serializer": "^4.4 || ^5.4 || ^6.2",
"symfony/validator": "^4.4 || ^5.4 || ^6.2",
"twig/string-extra": "^3.0",
"twig/twig": "^2.12.1 || ^3.0"
},
"require-dev": {
"dama/doctrine-test-bundle": "^6.7",
"doctrine/annotations": "^1.13.3",
"friendsofphp/php-cs-fixer": "^3.4",
"masterminds/html5": "^2.7",
"matthiasnoback/symfony-dependency-injection-test": "^4.1.1",
Expand All @@ -63,18 +62,20 @@
"phpstan/phpstan-strict-rules": "^1.3",
"phpstan/phpstan-symfony": "^1.0",
"phpunit/phpunit": "^9.5",
"psalm/plugin-phpunit": "^0.17",
"psalm/plugin-symfony": "^3.0",
"psalm/plugin-phpunit": "^0.18",
"psalm/plugin-symfony": "^4.0 || ^5.0",
"rector/rector": "^0.15",
"symfony/browser-kit": "^4.4 || ^5.4 || ^6.0",
"symfony/css-selector": "^4.4 || ^5.4 || ^6.0",
"symfony/filesystem": "^4.4 || ^5.4 || ^6.0",
"symfony/browser-kit": "^4.4 || ^5.4 || ^6.2",
"symfony/css-selector": "^4.4 || ^5.4 || ^6.2",
"symfony/filesystem": "^4.4 || ^5.4 || ^6.2",
"symfony/panther": "^1.0 || ^2.0",
"symfony/phpunit-bridge": "^6.1",
"vimeo/psalm": "^4.7.2"
"symfony/phpunit-bridge": "^6.2",
"symfony/yaml": "^4.4 || ^5.4 || ^6.2",
"vimeo/psalm": "^4.7.2 || ^5.0"
},
"conflict": {
"doctrine/orm": "<2.10"
"doctrine/dbal": "<3.4",
"doctrine/orm": "<2.14"
jordisala1991 marked this conversation as resolved.
Show resolved Hide resolved
},
"suggest": {
"twig/extra-bundle": "Auto configures the Twig Intl extension"
Expand Down
16 changes: 16 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,19 @@ parameters:
- # https://github.com/phpstan/phpstan-strict-rules/issues/130
message: '#^Call to static method PHPUnit\\Framework\\Assert::.* will always evaluate to true\.$#'
path: tests/
- # https://github.com/phpstan/phpstan-symfony/issues/322
message: "#^Cannot call method getId\\(\\) on array\\<string, bool\\|string\\>\\|Sonata\\\\PageBundle\\\\Model\\\\PageInterface\\|Sonata\\\\PageBundle\\\\Model\\\\SiteInterface\\.$#"
count: 1
path: src/Form/Type/PageSelectorType.php
- # https://github.com/phpstan/phpstan-symfony/issues/322
message: "#^Only booleans are allowed in &&, array\\<string, bool\\|string\\>\\|Sonata\\\\PageBundle\\\\Model\\\\PageInterface\\|Sonata\\\\PageBundle\\\\Model\\\\SiteInterface\\|null given on the right side\\.$#"
count: 1
path: src/Form/Type/PageSelectorType.php
- # https://github.com/phpstan/phpstan-symfony/issues/322
message: "#^Parameter \\#2 \\$currentPage of method Sonata\\\\PageBundle\\\\Form\\\\Type\\\\PageSelectorType\\:\\:childWalker\\(\\) expects Sonata\\\\PageBundle\\\\Model\\\\PageInterface\\|null, array\\<string, bool\\|string\\>\\|Sonata\\\\PageBundle\\\\Model\\\\PageInterface\\|Sonata\\\\PageBundle\\\\Model\\\\SiteInterface\\|null given\\.$#"
count: 1
path: src/Form/Type/PageSelectorType.php
- # https://github.com/phpstan/phpstan-symfony/issues/322
message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, array\\<string, bool\\|string\\>\\|Sonata\\\\PageBundle\\\\Model\\\\PageInterface\\|Sonata\\\\PageBundle\\\\Model\\\\SiteInterface\\|null given\\.$#"
count: 1
path: src/Form/Type/PageSelectorType.php
2 changes: 1 addition & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<psalm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" errorLevel="2" findUnusedPsalmSuppress="true" resolveFromConfigFile="true" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd">
<psalm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" errorLevel="2" findUnusedPsalmSuppress="true" resolveFromConfigFile="true" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" findUnusedBaselineEntry="true" findUnusedCode="false">
<projectFiles>
<directory name="src"/>
<directory name="tests"/>
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
]);

$rectorConfig->sets([
LevelSetList::UP_TO_PHP_74,
LevelSetList::UP_TO_PHP_80,
]);

$rectorConfig->importNames();
Expand Down
8 changes: 2 additions & 6 deletions src/Admin/BaseBlockAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,16 @@
*/
abstract class BaseBlockAdmin extends AbstractAdmin
{
protected BlockServiceManagerInterface $blockManager;

protected bool $inValidate = false;

/**
* @var array<string>
*/
protected array $containerBlockTypes = [];

public function __construct(BlockServiceManagerInterface $blockManager)
public function __construct(protected BlockServiceManagerInterface $blockManager)
{
parent::__construct();

$this->blockManager = $blockManager;
}

/**
Expand Down Expand Up @@ -143,7 +139,7 @@ private function loadBlockDefaults(PageBlockInterface $block): PageBlockInterfac

try {
$block->setSettings($resolver->resolve($block->getSettings()));
} catch (InvalidOptionsException $e) {
} catch (InvalidOptionsException) {
// @TODO : add a logging error or a flash message
}

Expand Down
18 changes: 4 additions & 14 deletions src/Admin/BlockAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,6 @@ final class BlockAdmin extends BaseBlockAdmin
{
protected $classnameLabel = 'Block';

/**
* @var array<string, array{
* templates?: array<array{
* name: string,
* template: string,
* }>,
* }>
*/
private array $blocks;

/**
* @param array<string, array{
* templates?: array<array{
Expand All @@ -55,11 +45,11 @@ final class BlockAdmin extends BaseBlockAdmin
* }>,
* }> $blocks
*/
public function __construct(BlockServiceManagerInterface $blockManager, array $blocks = [])
{
public function __construct(
BlockServiceManagerInterface $blockManager,
private array $blocks = []
) {
parent::__construct($blockManager);

$this->blocks = $blocks;
}

protected function getAccessMapping(): array
Expand Down
5 changes: 1 addition & 4 deletions src/Admin/Extension/CreateSnapshotAdminExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@
*/
final class CreateSnapshotAdminExtension extends AbstractAdminExtension
{
private CreateSnapshotByPageInterface $createSnapshotByPage;

public function __construct(CreateSnapshotByPageInterface $createSnapshotByPage)
public function __construct(private CreateSnapshotByPageInterface $createSnapshotByPage)
{
$this->createSnapshotByPage = $createSnapshotByPage;
}

public function postUpdate(AdminInterface $admin, object $object): void
Expand Down
13 changes: 3 additions & 10 deletions src/Admin/PageAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,11 @@ final class PageAdmin extends AbstractAdmin
{
protected $classnameLabel = 'Page';

private PageManagerInterface $pageManager;

private SiteManagerInterface $siteManager;

public function __construct(
PageManagerInterface $pageManager,
SiteManagerInterface $siteManager
private PageManagerInterface $pageManager,
private SiteManagerInterface $siteManager
) {
parent::__construct();

$this->pageManager = $pageManager;
$this->siteManager = $siteManager;
}

protected function configureRoutes(RouteCollectionInterface $collection): void
Expand Down Expand Up @@ -380,7 +373,7 @@ protected function configureTabMenu(ItemInterface $menu, string $action, ?AdminI
'path' => $path,
]),
]);
} catch (\Exception $e) {
} catch (\Exception) {
// avoid crashing the admin if the route is not setup correctly
// throw $e;
}
Expand Down
6 changes: 1 addition & 5 deletions src/Admin/SiteAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,9 @@ final class SiteAdmin extends AbstractAdmin
{
protected $classnameLabel = 'Site';

private RoutePageGenerator $routePageGenerator;

public function __construct(RoutePageGenerator $routePageGenerator)
public function __construct(private RoutePageGenerator $routePageGenerator)
{
parent::__construct();

$this->routePageGenerator = $routePageGenerator;
}

protected function postPersist(object $object): void
Expand Down
Loading