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
272 changes: 16 additions & 256 deletions phpstan-baseline.neon

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions src/bundle/Controller/UniversalDiscoveryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@
use Ibexa\Rest\Server\Controller;
use Symfony\Component\HttpFoundation\Request;

class UniversalDiscoveryController extends Controller
final class UniversalDiscoveryController extends Controller
{
private Provider $provider;

public function __construct(
Provider $provider
private readonly Provider $provider
) {
$this->provider = $provider;
}

public function locationsAction(Request $request): LocationListData
Expand Down
4 changes: 2 additions & 2 deletions src/contracts/Controller/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ abstract class Controller extends AbstractController implements RestrictedContro
public function redirectToLocation(Location $location, string $uriFragment = ''): RedirectResponse
{
return $this->redirectToRoute('ibexa.content.view', [
'contentId' => $location->contentId,
'locationId' => $location->id,
'contentId' => $location->getContentId(),
'locationId' => $location->getId(),
'_fragment' => $uriFragment,
]);
}
Expand Down
3 changes: 1 addition & 2 deletions src/contracts/Event/AutosaveEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@

final class AutosaveEvents
{
/** @var string */
public const CONTENT_AUTOSAVE = 'content.edit.autosave';
public const string CONTENT_AUTOSAVE = 'content.edit.autosave';
}
15 changes: 3 additions & 12 deletions src/contracts/Event/ContentEditEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,11 @@ final class ContentEditEvent extends Event
{
private ?Response $response = null;

private Content $content;

private VersionInfo $versionInfo;

private string $languageCode;

public function __construct(
Content $content,
VersionInfo $versionInfo,
string $languageCode
private readonly Content $content,
private readonly VersionInfo $versionInfo,
private readonly string $languageCode
) {
$this->content = $content;
$this->versionInfo = $versionInfo;
$this->languageCode = $languageCode;
}

public function getContent(): Content
Expand Down
14 changes: 5 additions & 9 deletions src/contracts/Event/ContentOnTheFlyEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@

namespace Ibexa\Contracts\AdminUi\Event;

final class ContentOnTheFlyEvents
final readonly class ContentOnTheFlyEvents
{
/** @var string */
public const CONTENT_CREATE = 'ibexa.content_on_the_fly.create';
public const string CONTENT_CREATE = 'ibexa.content_on_the_fly.create';

/** @var string */
public const CONTENT_CREATE_PUBLISH = 'ibexa.content_on_the_fly.create.publish';
public const string CONTENT_CREATE_PUBLISH = 'ibexa.content_on_the_fly.create.publish';

/** @var string */
public const CONTENT_EDIT = 'ibexa.content_on_the_fly.edit';
public const string CONTENT_EDIT = 'ibexa.content_on_the_fly.edit';

/** @var string */
public const CONTENT_EDIT_PUBLISH = 'ibexa.content_on_the_fly.edit.publish';
public const string CONTENT_EDIT_PUBLISH = 'ibexa.content_on_the_fly.edit.publish';
}
19 changes: 5 additions & 14 deletions src/contracts/Event/ContentProxyCreateEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,19 @@
*/
class ContentProxyCreateEvent extends Event
{
public const OPTION_CONTENT_DRAFT = 'contentDraft';
public const OPTION_IS_ON_THE_FLY = 'isOnTheFly';
public const string OPTION_CONTENT_DRAFT = 'contentDraft';
public const string OPTION_IS_ON_THE_FLY = 'isOnTheFly';

private ?Response $response = null;

private ContentType $contentType;

private string $languageCode;

private int $parentLocationId;

private Options $options;

public function __construct(
ContentType $contentType,
string $languageCode,
int $parentLocationId,
private readonly ContentType $contentType,
private readonly string $languageCode,
private readonly int $parentLocationId,
?Options $options = null
) {
$this->contentType = $contentType;
$this->languageCode = $languageCode;
$this->parentLocationId = $parentLocationId;
$this->options = $options ?? new Options();
}

Expand Down
20 changes: 4 additions & 16 deletions src/contracts/Event/ContentProxyTranslateEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,16 @@ class ContentProxyTranslateEvent extends Event
{
private ?Response $response = null;

private int $contentId;

private ?string $fromLanguageCode;

private string $toLanguageCode;

private Options $options;

private ?int $locationId;

public function __construct(
int $contentId,
?string $fromLanguageCode,
string $toLanguageCode,
private readonly int $contentId,
private readonly ?string $fromLanguageCode,
private readonly string $toLanguageCode,
?Options $options = null,
?int $locationId = null
private readonly ?int $locationId = null
) {
$this->contentId = $contentId;
$this->fromLanguageCode = $fromLanguageCode;
$this->toLanguageCode = $toLanguageCode;
$this->options = $options ?? new Options();
$this->locationId = $locationId;
}

public function getContentId(): int
Expand Down
19 changes: 5 additions & 14 deletions src/contracts/Event/FieldDefinitionMappingEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,18 @@
use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition;
use Symfony\Contracts\EventDispatcher\Event;

class FieldDefinitionMappingEvent extends Event
final class FieldDefinitionMappingEvent extends Event
{
/**
* Triggered when contentTypeData is created from contentTypeDraft.
*/
public const NAME = 'field_definition.mapping';

private FieldDefinitionData $fieldDefinitionData;

private ?Language $baseLanguage;

private ?Language $targetLanguage;
public const string NAME = 'field_definition.mapping';

public function __construct(
FieldDefinitionData $fieldDefinitionData,
?Language $baseLanguage,
?Language $targetLanguage
private FieldDefinitionData $fieldDefinitionData,
private readonly ?Language $baseLanguage,
private readonly ?Language $targetLanguage
) {
$this->baseLanguage = $baseLanguage;
$this->targetLanguage = $targetLanguage;
$this->fieldDefinitionData = $fieldDefinitionData;
}

public function getFieldDefinition(): FieldDefinition
Expand Down
5 changes: 1 addition & 4 deletions src/contracts/Event/FocusModeChangedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@

final class FocusModeChangedEvent extends Event
{
private bool $enabled;

public function __construct(bool $enabled)
public function __construct(private readonly bool $enabled)
{
$this->enabled = $enabled;
}

public function isEnabled(): bool
Expand Down
35 changes: 7 additions & 28 deletions src/contracts/Event/FormActionEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,26 @@
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Response;

class FormActionEvent extends FormEvent
final class FormActionEvent extends FormEvent
{
/**
* Name of the button used to submit the form.
*/
private ?string $clickedButton;

/**
* Hash of options.
*
* @var array<string, mixed>
*/
private array $options;

/**
* Response to return after form post-processing. Typically, a RedirectResponse.
*/
private ?Response $response;

/**
* Additional payload populated for event listeners next in priority.
*
* @var array<mixed>
*/
private array $payloads;
private ?Response $response = null;

/**
* @param \Symfony\Component\Form\FormInterface<mixed> $form
* @param array<string, mixed> $options
* @param array<mixed> $payloads
* @param array<mixed> $payloads additional payloads populated for event listeners next in priority
*/
public function __construct(
FormInterface $form,
mixed $data,
?string $clickedButton,
array $options = [],
array $payloads = []
private readonly ?string $clickedButton,
private readonly array $options = [],
private array $payloads = []
) {
parent::__construct($form, $data);
$this->clickedButton = $clickedButton;
$this->options = $options;
$this->payloads = $payloads;
}

public function getClickedButton(): ?string
Expand Down
15 changes: 8 additions & 7 deletions src/contracts/Event/FormEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,39 @@
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\Contracts\AdminUi\Event;

final class FormEvents
final readonly class FormEvents
{
/**
* Base name for ContentType update processing events.
*/
public const CONTENT_TYPE_UPDATE = 'contentType.update';
public const string CONTENT_TYPE_UPDATE = 'contentType.update';

/**
* Triggered when adding a FieldDefinition to the ContentTypeDraft.
*/
public const CONTENT_TYPE_ADD_FIELD_DEFINITION = 'contentType.update.addFieldDefinition';
public const string CONTENT_TYPE_ADD_FIELD_DEFINITION = 'contentType.update.addFieldDefinition';

/**
* Triggered when removing a FieldDefinition from the ContentTypeDraft.
*/
public const CONTENT_TYPE_REMOVE_FIELD_DEFINITION = 'contentType.update.removeFieldDefinition';
public const string CONTENT_TYPE_REMOVE_FIELD_DEFINITION = 'contentType.update.removeFieldDefinition';

/**
* Triggered when saving the draft + publishing the ContentType.
*/
public const CONTENT_TYPE_PUBLISH = 'contentType.update.publishContentType';
public const string CONTENT_TYPE_PUBLISH = 'contentType.update.publishContentType';

/**
* Triggered when saving the draft + publishing the ContentType and starting edition on new draft.
*/
public const CONTENT_TYPE_PUBLISH_AND_EDIT = 'contentType.update.publishAndEditContentType';
public const string CONTENT_TYPE_PUBLISH_AND_EDIT = 'contentType.update.publishAndEditContentType';

/**
* Triggered when removing the draft (e.g. "cancel" action).
*/
public const CONTENT_TYPE_REMOVE_DRAFT = 'contentType.update.removeDraft';
public const string CONTENT_TYPE_REMOVE_DRAFT = 'contentType.update.removeDraft';
}
14 changes: 5 additions & 9 deletions src/contracts/Event/UserOnTheFlyEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@

namespace Ibexa\Contracts\AdminUi\Event;

final class UserOnTheFlyEvents
final readonly class UserOnTheFlyEvents
{
/** @var string */
public const USER_CREATE = 'ibexa.user_on_the_fly.create';
public const string USER_CREATE = 'ibexa.user_on_the_fly.create';

/** @var string */
public const USER_CREATE_PUBLISH = 'ibexa.user_on_the_fly.create.create';
public const string USER_CREATE_PUBLISH = 'ibexa.user_on_the_fly.create.create';

/** @var string */
public const USER_EDIT = 'ibexa.user_on_the_fly.edit';
public const string USER_EDIT = 'ibexa.user_on_the_fly.edit';

/** @var string */
public const USER_EDIT_PUBLISH = 'ibexa.user_on_the_fly.edit.update';
public const string USER_EDIT_PUBLISH = 'ibexa.user_on_the_fly.edit.update';
}
21 changes: 11 additions & 10 deletions src/contracts/Form/ActionDispatcher/ActionDispatcherInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use Ibexa\Contracts\Core\Repository\Values\ValueObject;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Response;

/**
* Form action dispatchers can be used to abstract actions when a complex form is submitted.
Expand All @@ -22,18 +23,18 @@ interface ActionDispatcherInterface
/**
* Dispatches the action of a given form.
*
* @param \Symfony\Component\Form\FormInterface $form the form that has been submitted
* @param \Symfony\Component\Form\FormInterface<mixed> $form the form that has been submitted
* @param \Ibexa\Contracts\Core\Repository\Values\ValueObject $data Underlying data for the form. Most likely a create or update struct.
* @param string|null $actionName The form action itself. Typically the form clicked button name,
* @param string|null $actionName The form action itself. Typically, the form clicked button name,
* or null if the default action is used (e.g. when pressing enter).
* @param array $options arbitrary hash of options
* @param array<string, mixed> $options arbitrary hash of options
*/
public function dispatchFormAction(FormInterface $form, ValueObject $data, $actionName = null, array $options = []);
public function dispatchFormAction(
FormInterface $form,
ValueObject $data,
?string $actionName = null,
array $options = []
): void;

/**
* Returns the generated response, if any. Typically a RedirectResponse.
*
* @return \Symfony\Component\HttpFoundation\Response|null
*/
public function getResponse();
public function getResponse(): ?Response;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@
interface FormDataMapperInterface
{
/**
* Maps a ValueObject from Ibexa content repository to a data usable as underlying form data (e.g. create/update struct).
* Maps a ValueObject from content repository to a data usable as underlying form data (e.g. create/update struct).
*
* @param \Ibexa\Contracts\Core\Repository\Values\ValueObject $repositoryValueObject
* @param array $params
*
* @return mixed
* @param array<string, mixed> $params
*/
public function mapToFormData(ValueObject $repositoryValueObject, array $params = []);
public function mapToFormData(ValueObject $repositoryValueObject, array $params = []): mixed;
}
Loading
Loading