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

IBX-8470: Upgraded codebase to Symfony 6 #90

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 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
50 changes: 24 additions & 26 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,39 @@
},
"require": {
"php": " >=8.3",
"ibexa/content-forms": "~5.0.x-dev",
"ibexa/core": "~5.0.x-dev",
"ibexa/notifications": "~5.0.x-dev",
"jms/translation-bundle": "^1.5",
"symfony/config": "^5.0",
"symfony/dependency-injection": "^5.0",
"symfony/event-dispatcher": "^5.0",
"symfony/form": "^5.0",
"symfony/http-foundation": "^5.0",
"symfony/http-kernel": "^5.0",
"symfony/intl": "^5.0",
"symfony/options-resolver": "^5.0",
"symfony/routing": "^5.0",
"symfony/security-core": "^5.0",
"symfony/security-http": "^5.0",
"symfony/translation": "^5.0",
"symfony/validator": "^5.0",
"ibexa/content-forms": "dev-ibx-8470-symfony-6 as 5.0.x-dev",
"ibexa/core": "dev-ibx-8470-symfony-6 as 5.0.x-dev",
"ibexa/notifications": "dev-ibx-8470-symfony-6 as 5.0.x-dev",
"jms/translation-bundle": "^2.4",
"symfony/config": "^6.4",
"symfony/dependency-injection": "^6.4",
"symfony/event-dispatcher": "^6.4",
"symfony/form": "^6.4",
"symfony/http-foundation": "^6.4",
"symfony/http-kernel": "^6.4",
"symfony/intl": "^6.4",
"symfony/options-resolver": "^6.4",
"symfony/routing": "^6.4",
"symfony/security-core": "^6.4",
"symfony/security-http": "^6.4",
"symfony/translation": "^6.4",
"symfony/validator": "^6.4",
"twig/twig": "^3.0"
},
"require-dev": {
"ibexa/ci-scripts": "^0.2@dev",
"ibexa/code-style": "~2.0.0",
"ibexa/design-engine": "~5.0.x-dev",
"ibexa/doctrine-schema": "~5.0.x-dev",
"ibexa/fieldtype-richtext": "~5.0.x-dev",
"ibexa/http-cache": "~5.0.x-dev",
"ibexa/rest": "~5.0.x-dev",
"ibexa/search": "~5.0.x-dev",
"ibexa/design-engine": "dev-ibx-8470-symfony-6 as 5.0.x-dev",
"ibexa/doctrine-schema": "dev-ibx-8470-symfony-6 as 5.0.x-dev",
"ibexa/http-cache": "dev-ibx-8470-symfony-6 as 5.0.x-dev",
"ibexa/rest": "dev-ibx-8470-symfony-6 as 5.0.x-dev",
"ibexa/search": "dev-ibx-8470-symfony-6 as 5.0.x-dev",
"matthiasnoback/symfony-dependency-injection-test": "4.3",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3",
"phpstan/phpstan-symfony": "^1.3",
"phpunit/phpunit": "^9.6",
"symfony/phpunit-bridge": "^5.3",
"symfony/proxy-manager-bridge": "^5.0"
"symfony/phpunit-bridge": "^6.4",
"symfony/proxy-manager-bridge": "^6.4"
},
"scripts": {
"fix-cs": "php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots",
Expand Down
70 changes: 0 additions & 70 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,6 @@ parameters:
count: 1
path: src/bundle/Controller/UserSettingsController.php

-
message: "#^Method Ibexa\\\\Bundle\\\\User\\\\DependencyInjection\\\\Compiler\\\\UserSetting\\\\FormMapperPass\\:\\:process\\(\\) has no return type specified\\.$#"
count: 1
path: src/bundle/DependencyInjection/Compiler/UserSetting/FormMapperPass.php

-
message: "#^Method Ibexa\\\\Bundle\\\\User\\\\DependencyInjection\\\\Compiler\\\\UserSetting\\\\ValueDefinitionPass\\:\\:process\\(\\) has no return type specified\\.$#"
count: 1
path: src/bundle/DependencyInjection/Compiler/UserSetting/ValueDefinitionPass.php

-
message: "#^Method Ibexa\\\\Bundle\\\\User\\\\DependencyInjection\\\\Configuration\\\\Parser\\\\ChangePassword\\:\\:addSemanticConfig\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -195,11 +185,6 @@ parameters:
count: 1
path: src/bundle/DependencyInjection/Configuration/Parser/UserRegistration.php

-
message: "#^Method Ibexa\\\\Bundle\\\\User\\\\IbexaUserBundle\\:\\:build\\(\\) has no return type specified\\.$#"
count: 1
path: src/bundle/IbexaUserBundle.php

-
message: "#^Method Ibexa\\\\Contracts\\\\User\\\\Invitation\\\\Persistence\\\\Gateway\\:\\:getInvitation\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -280,11 +265,6 @@ parameters:
count: 1
path: src/lib/ExceptionHandler/NullActionResultHandler.php

-
message: "#^Method Ibexa\\\\User\\\\Form\\\\ChoiceList\\\\Loader\\\\AvailableLocaleChoiceLoader\\:\\:getChoiceList\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Form/ChoiceList/Loader/AvailableLocaleChoiceLoader.php

-
message: "#^Method Ibexa\\\\User\\\\Form\\\\ChoiceList\\\\Loader\\\\UserGroupsChoiceLoader\\:\\:loadChoices\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -505,11 +485,6 @@ parameters:
count: 1
path: src/lib/Form/Type/Invitation/UserInvitationType.php

-
message: "#^Method Ibexa\\\\User\\\\Form\\\\Type\\\\Invitation\\\\UserInvitationType\\:\\:configureOptions\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Form/Type/Invitation/UserInvitationType.php

-
message: "#^Method Ibexa\\\\User\\\\Form\\\\Type\\\\UserPasswordChangeType\\:\\:buildForm\\(\\) has no return type specified\\.$#"
count: 1
Expand All @@ -520,21 +495,11 @@ parameters:
count: 1
path: src/lib/Form/Type/UserPasswordForgotType.php

-
message: "#^Method Ibexa\\\\User\\\\Form\\\\Type\\\\UserPasswordForgotType\\:\\:configureOptions\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Form/Type/UserPasswordForgotType.php

-
message: "#^Method Ibexa\\\\User\\\\Form\\\\Type\\\\UserPasswordForgotWithLoginType\\:\\:buildForm\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Form/Type/UserPasswordForgotWithLoginType.php

-
message: "#^Method Ibexa\\\\User\\\\Form\\\\Type\\\\UserPasswordForgotWithLoginType\\:\\:configureOptions\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Form/Type/UserPasswordForgotWithLoginType.php

-
message: "#^Method Ibexa\\\\User\\\\Form\\\\Type\\\\UserPasswordResetType\\:\\:buildForm\\(\\) has no return type specified\\.$#"
count: 1
Expand All @@ -545,11 +510,6 @@ parameters:
count: 1
path: src/lib/Form/Type/UserRegisterType.php

-
message: "#^Method Ibexa\\\\User\\\\Form\\\\Type\\\\UserRegisterType\\:\\:configureOptions\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Form/Type/UserRegisterType.php

-
message: "#^Method Ibexa\\\\User\\\\Form\\\\Type\\\\UserRegisterType\\:\\:getName\\(\\) has no return type specified\\.$#"
count: 1
Expand All @@ -560,11 +520,6 @@ parameters:
count: 1
path: src/lib/Form/Type/UserSettingUpdateType.php

-
message: "#^Method Ibexa\\\\User\\\\Form\\\\Type\\\\UserSettingUpdateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Form/Type/UserSettingUpdateType.php

-
message: "#^Method Ibexa\\\\User\\\\Invitation\\\\DomainMapper\\:\\:mapRoleLimitation\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -675,11 +630,6 @@ parameters:
count: 1
path: src/lib/Templating/Twig/DateTimeExtension.php

-
message: "#^Method Ibexa\\\\User\\\\UserSetting\\\\DateTimeFormat\\\\Formatter\\:\\:format\\(\\) should return string but returns bool\\|string\\.$#"
count: 1
path: src/lib/UserSetting/DateTimeFormat/Formatter.php

-
message: "#^Cannot call method getDateFormat\\(\\) on Ibexa\\\\User\\\\UserSetting\\\\Setting\\\\Value\\\\DateTimeFormat\\|null\\.$#"
count: 1
Expand Down Expand Up @@ -850,26 +800,11 @@ parameters:
count: 1
path: src/lib/Validator/Constraints/EmailInvitationValidator.php

-
message: "#^Method Ibexa\\\\User\\\\Validator\\\\Constraints\\\\EmailInvitationValidator\\:\\:validate\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Validator/Constraints/EmailInvitationValidator.php

-
message: "#^Method Ibexa\\\\User\\\\Validator\\\\Constraints\\\\Password\\:\\:getTargets\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Validator/Constraints/Password.php

-
message: "#^Access to an undefined property Symfony\\\\Component\\\\Validator\\\\Constraint\\:\\:\\$contentType\\.$#"
count: 1
path: src/lib/Validator/Constraints/PasswordValidator.php

-
message: "#^Access to an undefined property Symfony\\\\Component\\\\Validator\\\\Constraint\\:\\:\\$user\\.$#"
count: 1
path: src/lib/Validator/Constraints/PasswordValidator.php

-
message: "#^Property Ibexa\\\\User\\\\Validator\\\\Constraints\\\\UserPassword\\:\\:\\$message has no type specified\\.$#"
count: 1
Expand All @@ -890,11 +825,6 @@ parameters:
count: 1
path: src/lib/Validator/Constraints/UserPasswordValidator.php

-
message: "#^Method Ibexa\\\\User\\\\Validator\\\\Constraints\\\\UserPasswordValidator\\:\\:validate\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Validator/Constraints/UserPasswordValidator.php

-
message: "#^Strict comparison using \\=\\=\\= between null and string will always evaluate to false\\.$#"
count: 1
Expand Down
35 changes: 16 additions & 19 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
<phpunit
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="tests/bootstrap.php"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
colors="true">
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="tests/bootstrap.php"
colors="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory>src</directory>
</include>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<directory>src</directory>
<directory suffix=".php">src</directory>

<exclude>
<directory>tests/bundle/</directory>
<directory>tests/lib/</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="Ibexa\Bundle\User">
<directory>tests/bundle/</directory>
Expand All @@ -18,19 +24,10 @@
</testsuite>
</testsuites>
<php>
<env name="KERNEL_CLASS" value="Ibexa\Tests\Integration\User\IbexaTestKernel" />
<env name="DATABASE_URL" value="sqlite://i@i/test.db" />
<env name="KERNEL_CLASS" value="Ibexa\Tests\Integration\User\IbexaTestKernel"/>
<env name="DATABASE_URL" value="sqlite://i@i/test.db"/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/>
</php>
<filter>
<whitelist>
<directory>src</directory>
<exclude>
<directory>tests/bundle/</directory>
<directory>tests/lib/</directory>
</exclude>
</whitelist>
</filter>
<listeners>
<listener class="\Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
</listeners>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class FormMapperPass implements CompilerPassInterface
* @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
* @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException;
*/
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
if (!$container->hasDefinition(FormMapperRegistry::class)) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ValueDefinitionPass implements CompilerPassInterface
* @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
* @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException
*/
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
if (!$container->hasDefinition(ValueDefinitionRegistry::class)) {
return;
Expand Down
5 changes: 1 addition & 4 deletions src/bundle/DependencyInjection/IbexaUserExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class IbexaUserExtension extends Extension implements PrependExtensionInterface
{
/**
* {@inheritdoc}
* @throws \Exception
*/
public function load(array $configs, ContainerBuilder $container): void
{
Expand All @@ -34,9 +34,6 @@ public function load(array $configs, ContainerBuilder $container): void
}
}

/**
* {@inheritdoc}
*/
public function prepend(ContainerBuilder $container): void
{
$this->prependJMSTranslation($container);
Expand Down
7 changes: 2 additions & 5 deletions src/bundle/IbexaUserBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@

class IbexaUserBundle extends Bundle
{
/**
* {@inheritdoc}
*/
public function build(ContainerBuilder $container)
public function build(ContainerBuilder $container): void
{
/** @var \Ibexa\Bundle\Core\DependencyInjection\IbexaCoreExtension $core */
$core = $container->getExtension('ibexa');
Expand All @@ -47,6 +44,6 @@ public function build(ContainerBuilder $container)
$container->addCompilerPass(new UserSetting\FormMapperPass());
$container->addCompilerPass(new SecurityPass());

$core->addDefaultSettings(__DIR__ . '/Resources/config', ['ezplatform_default_settings.yaml']);
$core->addDefaultSettings(__DIR__ . '/Resources/config', ['ibexa_core_default_settings.yaml']);
}
}
2 changes: 2 additions & 0 deletions src/bundle/Resources/config/services/controllers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ services:

Ibexa\Bundle\User\Controller\UserRegisterController:
autowire: true
autoconfigure: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering other controllers in the file did not receive this change, and that this tags were already applied to the service declaration, what is the difference? What in particular was missing (not autoconfigured)?

arguments:
$userActionDispatcher: '@Ibexa\ContentForms\Form\ActionDispatcher\UserDispatcher'
tags: [controller.service_arguments]
Expand All @@ -47,4 +48,5 @@ services:

Ibexa\Bundle\User\Controller\UserInvitationController:
autowire: true
autoconfigure: true
tags: [ controller.service_arguments ]
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@

use Ibexa\Contracts\Core\Repository\Exceptions\PasswordInUnsupportedFormatException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationFailureHandler as HttpDefaultAuthenticationFailureHandler;

final class DefaultAuthenticationFailureHandler extends HttpDefaultAuthenticationFailureHandler
{
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): Response
{
if ($exception instanceof PasswordInUnsupportedFormatException) {
$resetPasswordUrl = $this->httpUtils->generateUri($request, 'ibexa.user.forgot_password.migration');
Expand Down
Loading
Loading