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

Add support for symfony 5 #380

Merged
merged 4 commits into from
Sep 10, 2021
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
4 changes: 4 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ branches:
- "Static Code Analysis (8)"
- "Test (PHP 7.4, symfony 4.4, lowest)"
- "Test (PHP 7.4, symfony 4.4, highest)"
- "Test (PHP 7.4, symfony 5.3, lowest)"
- "Test (PHP 7.4, symfony 5.3, highest)"
- "Test (PHP 8, symfony 4.4, lowest)"
- "Test (PHP 8, symfony 4.4, highest)"
- "Test (PHP 8, symfony 5.3, lowest)"
- "Test (PHP 8, symfony 5.3, highest)"
- "Code Coverage (8)"
- "Mutation Tests (8)"
strict: true
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ jobs:

symfony:
- 4.4
- 5.3

steps:
- name: "Checkout"
Expand Down
39 changes: 19 additions & 20 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@
"php": "^7.4 || ^8.0",
"ext-json": "*",
"nucleos/user-bundle": "^1.9",
"psr/log": "^1.0",
"psr/log": "^1.0 || ^2.0 || ^3.0",
"sonata-project/admin-bundle": "^3.90 || ^4.0",
"sonata-project/doctrine-extensions": "^1.5.1",
"symfony/config": "^4.4",
"symfony/dependency-injection": "^4.4",
"symfony/event-dispatcher": "^4.4",
"symfony/config": "^4.4 || ^5.3",
"symfony/dependency-injection": "^4.4 || ^5.3",
"symfony/event-dispatcher": "^4.4 || ^5.3",
"symfony/event-dispatcher-contracts": "^1.0 || ^2.0",
"symfony/form": "^4.4",
"symfony/framework-bundle": "^4.4",
"symfony/http-foundation": "^4.4",
"symfony/http-kernel": "^4.4",
"symfony/options-resolver": "^4.4",
"symfony/routing": "^4.4",
"symfony/form": "^4.4 || ^5.3",
"symfony/framework-bundle": "^4.4 || ^5.3",
"symfony/http-foundation": "^4.4 || ^5.3",
"symfony/http-kernel": "^4.4 || ^5.3",
"symfony/options-resolver": "^4.4 || ^5.3",
"symfony/routing": "^4.4 || ^5.3",
"symfony/security-acl": "^3.0",
"symfony/security-core": "^4.4",
"symfony/security-csrf": "^4.4",
"symfony/security-http": "^4.4",
"symfony/translation": "^4.4",
"symfony/security-core": "^4.4 || ^5.3",
"symfony/security-csrf": "^4.4 || ^5.3",
"symfony/security-http": "^4.4 || ^5.3",
"symfony/translation": "^4.4 || ^5.3",
"symfony/translation-contracts": "^1.0 || ^2.0",
"symfony/twig-bridge": "^4.4",
"symfony/twig-bundle": "^4.4",
"symfony/twig-bridge": "^4.4 || ^5.3",
"symfony/twig-bundle": "^4.4 || ^5.3",
"twig/extra-bundle": "^3.0",
"twig/twig": "^2.14 || ^3.1"
},
Expand All @@ -57,10 +57,9 @@
"ergebnis/composer-normalize": "^2.0.1",
"knplabs/knp-menu": "^2.3 || ^3.0",
"sonata-project/doctrine-orm-admin-bundle": "^3.13 || ^4.0",
"symfony/asset": "^4.4",
"symfony/browser-kit": "^4.4",
"symfony/doctrine-bridge": "^4.4",
"twig/extensions": "^1.5"
"symfony/asset": "^4.4 || ^5.3",
"symfony/browser-kit": "^4.4 || ^5.3",
"symfony/doctrine-bridge": "^4.4 || ^5.3"
},
"config": {
"sort-packages": true
Expand Down
13 changes: 4 additions & 9 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.10.0@916b098b008f6de4543892b1e0651c1c3b92cbfa">
<file src="src/Action/LoginAction.php">
<TooManyArguments occurrences="1">
<code>dispatch</code>
</TooManyArguments>
</file>
<file src="src/Controller/UserCRUDController.php">
<TooManyArguments occurrences="1">
<code>dispatch</code>
</TooManyArguments>
<file src="src/Action/CheckEmailAction.php">
<InvalidArgument occurrences="1">
<code>$username</code>
</InvalidArgument>
</file>
<file src="src/DependencyInjection/Configuration.php">
<UndefinedMethod occurrences="4">
Expand Down
17 changes: 10 additions & 7 deletions src/Admin/Model/GroupAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@
*/
abstract class GroupAdmin extends AbstractAdmin
{
/**
* @var string[]
*/
protected $formOptions = [
'validation_groups' => 'Registration',
];

private GroupManagerInterface $groupManager;

/**
Expand All @@ -50,6 +43,11 @@ protected function createNewInstance(): object
return $this->groupManager->createGroup('');
}

protected function configureFormOptions(array &$formOptions): void
{
$formOptions['validation_groups'] = $this->isNewInstance() ? 'Registration' : 'Profile';
}

protected function configureListFields(ListMapper $list): void
{
$list
Expand Down Expand Up @@ -85,4 +83,9 @@ protected function configureFormFields(FormMapper $form): void
->end()
;
}

private function isNewInstance(): bool
{
return !$this->hasSubject() || null === $this->id($this->getSubject());
}
}