Skip to content
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
290 changes: 13 additions & 277 deletions phpstan-baseline.neon

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions src/bundle/Command/AuditUserDatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,11 @@

final class AuditUserDatabaseCommand extends Command
{
/** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */
private $contentTypeService;
private ContentTypeService $contentTypeService;

/** @var \Ibexa\Contracts\Core\Repository\UserService */
private $userService;
private UserService $userService;

/** @var \Doctrine\DBAL\Connection */
private $connection;
private Connection $connection;

public function __construct(
ContentTypeService $contentTypeService,
Expand Down
2 changes: 1 addition & 1 deletion src/bundle/Controller/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

abstract class Controller extends AbstractController
{
public function performAccessCheck()
public function performAccessCheck(): void
{
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
}
Expand Down
18 changes: 7 additions & 11 deletions src/bundle/Controller/PasswordChangeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,21 @@
use Ibexa\User\View\ChangePassword\FormView;
use Ibexa\User\View\ChangePassword\SuccessView;
use JMS\TranslationBundle\Annotation\Desc;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;

class PasswordChangeController extends Controller
{
/** @var \Ibexa\User\ExceptionHandler\ActionResultHandler */
private $actionResultHandler;
private ActionResultHandler $actionResultHandler;

/** @var \Ibexa\Contracts\Core\Repository\UserService */
private $userService;
private UserService $userService;

/** @var \Ibexa\User\Form\Factory\FormFactory */
private $formFactory;
private FormFactory $formFactory;

/** @var \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface */
private $tokenStorage;
private TokenStorageInterface $tokenStorage;

/** @var array */
private $siteAccessGroups;
private array $siteAccessGroups;

public function __construct(
ActionResultHandler $actionResultHandler,
Expand All @@ -57,7 +53,7 @@ public function __construct(
*
* @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentType
*/
public function userPasswordChangeAction(Request $request)
public function userPasswordChangeAction(Request $request): RedirectResponse|SuccessView|FormView
{
/** @var \Ibexa\Contracts\Core\Repository\Values\User\User $user */
$user = $this->tokenStorage->getToken()->getUser()->getAPIUser();
Expand Down
14 changes: 8 additions & 6 deletions src/bundle/Controller/PasswordResetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use DateInterval;
use DateTime;
use Exception;
use Ibexa\Bundle\User\Type\UserForgotPasswordReason;
use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException;
use Ibexa\Contracts\Core\Repository\PermissionResolver;
Expand All @@ -31,6 +32,7 @@
use Ibexa\User\View\ResetPassword\FormView as UserResetPasswordFormView;
use Ibexa\User\View\ResetPassword\InvalidLinkView;
use Ibexa\User\View\ResetPassword\SuccessView as UserResetPasswordSuccessView;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Twig\Environment;
Expand Down Expand Up @@ -74,7 +76,7 @@ public function __construct(
*
* @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentType
*/
public function userForgotPasswordAction(Request $request, ?string $reason = null)
public function userForgotPasswordAction(Request $request, ?string $reason = null): RedirectResponse|SuccessView|FormView
{
$form = $this->formFactory->forgotUserPassword();
$form->handleRequest($request);
Expand All @@ -84,7 +86,7 @@ public function userForgotPasswordAction(Request $request, ?string $reason = nul
$users = $this->userService->loadUsersByEmail($data->getEmail());

/** Because it is possible to have multiple user accounts with same email address we must gain a user login. */
if (\count($users) > 1) {
if (count($users) > 1) {
return $this->redirectToRoute('ibexa.user.forgot_password.login');
}

Expand Down Expand Up @@ -112,7 +114,7 @@ public function userForgotPasswordAction(Request $request, ?string $reason = nul
*
* @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentType
*/
public function userForgotPasswordLoginAction(Request $request)
public function userForgotPasswordLoginAction(Request $request): SuccessView|LoginView
{
$form = $this->formFactory->forgotUserPasswordWithLogin();

Expand All @@ -127,7 +129,7 @@ public function userForgotPasswordLoginAction(Request $request)
$user = null;
}

if (!$user || \count($this->userService->loadUsersByEmail($user->email)) < 2) {
if (!$user || count($this->userService->loadUsersByEmail($user->email)) < 2) {
return new SuccessView(null);
}

Expand All @@ -150,7 +152,7 @@ public function userForgotPasswordLoginAction(Request $request)
*
* @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentType
*/
public function userResetPasswordAction(Request $request, string $hashKey)
public function userResetPasswordAction(Request $request, string $hashKey): InvalidLinkView|UserResetPasswordSuccessView|UserResetPasswordFormView
{
$response = new Response();
$response->headers->set('X-Robots-Tag', 'noindex');
Expand Down Expand Up @@ -194,7 +196,7 @@ public function userResetPasswordAction(Request $request, string $hashKey)
$view->setResponse($response);

return $view;
} catch (\Exception $e) {
} catch (Exception $e) {
$this->actionResultHandler->error($e->getMessage());
}
}
Expand Down
6 changes: 2 additions & 4 deletions src/bundle/Controller/UserRegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@

class UserRegisterController extends Controller
{
/** @var \Ibexa\User\Form\DataMapper\UserRegisterMapper */
private $userRegisterMapper;
private UserRegisterMapper $userRegisterMapper;

/** @var \Ibexa\ContentForms\Form\ActionDispatcher\ActionDispatcherInterface */
private $userActionDispatcher;
private ActionDispatcherInterface $userActionDispatcher;

private InvitationService $invitationService;

Expand Down
19 changes: 7 additions & 12 deletions src/bundle/Controller/UserSettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,15 @@

class UserSettingsController extends Controller
{
/** @var \Ibexa\User\Form\Factory\FormFactory */
private $formFactory;
private FormFactory $formFactory;

/** @var \Ibexa\User\Form\SubmitHandler */
private $submitHandler;
private SubmitHandler $submitHandler;

/** @var \Ibexa\User\UserSetting\UserSettingService */
private $userSettingService;
private UserSettingService $userSettingService;

/** @var \Ibexa\User\UserSetting\ValueDefinitionRegistry */
private $valueDefinitionRegistry;
private ValueDefinitionRegistry $valueDefinitionRegistry;

/** @var \Ibexa\User\ExceptionHandler\ActionResultHandler */
private $actionResultHandler;
private ActionResultHandler $actionResultHandler;

private PermissionResolver $permissionResolver;

Expand Down Expand Up @@ -78,7 +73,7 @@ public function listAction(int $page = 1): ListView
]);
}

public function updateAction(Request $request, UpdateView $view)
public function updateAction(Request $request, UpdateView $view): Response|UpdateView
{
$userSettingGroup = $view->getUserSettingGroup();

Expand All @@ -92,7 +87,7 @@ public function updateAction(Request $request, UpdateView $view)
$form->handleRequest($request);

if ($form->isSubmitted()) {
$result = $this->submitHandler->handle($form, function (UserSettingUpdateData $data) use ($form) {
$result = $this->submitHandler->handle($form, function (UserSettingUpdateData $data) use ($form): RedirectResponse {
foreach ($data->getValues() as $identifier => $value) {
$this->userSettingService->setUserSetting($identifier, (string)$value['value']);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ChangePassword extends AbstractParser
*
* @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system.<siteaccess>
*/
public function addSemanticConfig(NodeBuilder $nodeBuilder)
public function addSemanticConfig(NodeBuilder $nodeBuilder): void
{
$nodeBuilder
->arrayNode('user_change_password')
Expand All @@ -40,7 +40,7 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder)
->end();
}

public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void
{
if (empty($scopeSettings['user_change_password'])) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

final class ForgotPassword extends AbstractParser
{
public function addSemanticConfig(NodeBuilder $nodeBuilder)
public function addSemanticConfig(NodeBuilder $nodeBuilder): void
{
$nodeBuilder
->arrayNode('user_forgot_password')
Expand Down Expand Up @@ -60,7 +60,7 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder)
;
}

public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void
{
if (!empty($scopeSettings['user_forgot_password'])) {
$settings = $scopeSettings['user_forgot_password']['templates'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
class Pagination extends AbstractParser
{
public function addSemanticConfig(NodeBuilder $nodeBuilder)
public function addSemanticConfig(NodeBuilder $nodeBuilder): void
{
$nodeBuilder
->arrayNode('pagination_user')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

final class ResetPassword extends AbstractParser
{
public function addSemanticConfig(NodeBuilder $nodeBuilder)
public function addSemanticConfig(NodeBuilder $nodeBuilder): void
{
$nodeBuilder
->arrayNode('user_reset_password')
Expand All @@ -39,7 +39,7 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder)
;
}

public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void
{
if (empty($scopeSettings['user_reset_password'])) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Security extends AbstractParser
*
* @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system.<siteaccess>
*/
public function addSemanticConfig(NodeBuilder $nodeBuilder)
public function addSemanticConfig(NodeBuilder $nodeBuilder): void
{
$nodeBuilder
->arrayNode('security')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class UserInvitation extends AbstractParser
*
* @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system.<siteaccess>
*/
public function addSemanticConfig(NodeBuilder $nodeBuilder)
public function addSemanticConfig(NodeBuilder $nodeBuilder): void
{
$nodeBuilder
->arrayNode('user_invitation')
Expand All @@ -55,7 +55,7 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder)
->end();
}

public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void
{
if (empty($scopeSettings['user_invitation'])) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class UserRegistration extends AbstractParser
*
* @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system.<siteaccess>
*/
public function addSemanticConfig(NodeBuilder $nodeBuilder)
public function addSemanticConfig(NodeBuilder $nodeBuilder): void
{
$nodeBuilder
->arrayNode('user_registration')
Expand Down Expand Up @@ -62,7 +62,7 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder)
->end();
}

public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void
{
if (empty($scopeSettings['user_registration'])) {
return;
Expand Down
15 changes: 3 additions & 12 deletions src/lib/Behat/Context/UserSettingsContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,11 @@

class UserSettingsContext implements Context
{
/**
* @var \Ibexa\User\UserSetting\UserSettingService
*/
private $userSettingService;
private UserSettingService $userSettingService;

/**
* @var \Ibexa\Contracts\Core\Repository\PermissionResolver
*/
private $permissionResolver;
private PermissionResolver $permissionResolver;

/**
* @var \Ibexa\Contracts\Core\Repository\UserService
*/
private $userService;
private UserService $userService;

public function __construct(UserSettingService $userSettingService, PermissionResolver $permissionResolver, UserService $userService)
{
Expand Down
3 changes: 1 addition & 2 deletions src/lib/Behat/Context/UserSetupContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ class UserSetupContext implements Context
{
private const UNSUPPORTED_USER_HASH = 5;

/** @var \Doctrine\DBAL\Connection */
private $connection;
private Connection $connection;

public function __construct(Connection $connection)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use Ibexa\Contracts\Core\Repository\ContentTypeService;
use Ibexa\Contracts\Core\Repository\Repository;
use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType;
use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface;

/**
Expand All @@ -36,7 +37,7 @@ public function __construct(
public function loadContentType(?string $siteAccessIdentifier = null)
{
return $this->repository->sudo(
fn () => $this->contentTypeService->loadContentTypeByIdentifier(
fn (): ContentType => $this->contentTypeService->loadContentTypeByIdentifier(
$this->configResolver->getParameter(
'user_registration.user_type_identifier',
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
*/
class ConfigurableRegistrationGroupLoader implements RegistrationGroupLoader
{
/** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */
private $configResolver;
private ConfigResolverInterface $configResolver;

/** @var \Ibexa\Contracts\Core\Repository\Repository */
private $repository;
private Repository $repository;

public function __construct(ConfigResolverInterface $configResolver, Repository $repository)
{
Expand Down
3 changes: 1 addition & 2 deletions src/lib/ConfigResolver/ConfigurableSudoRepositoryLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
*/
abstract class ConfigurableSudoRepositoryLoader
{
/** @var \Ibexa\Contracts\Core\Repository\Repository */
private $repository;
private Repository $repository;

/** @var array */
private $params;
Expand Down
3 changes: 1 addition & 2 deletions src/lib/EventListener/ViewTemplatesListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@

class ViewTemplatesListener implements EventSubscriberInterface
{
/** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */
private $configResolver;
private ConfigResolverInterface $configResolver;

public function __construct(ConfigResolverInterface $configResolver)
{
Expand Down
Loading
Loading