diff --git a/.github/workflows/code_samples.yaml b/.github/workflows/code_samples.yaml index bf51b167769..0a4f2aaa140 100644 --- a/.github/workflows/code_samples.yaml +++ b/.github/workflows/code_samples.yaml @@ -34,8 +34,6 @@ jobs: - name: Run code sample quality tests id: phpstan run: composer test --ansi - env: - PHP_CS_FIXER_IGNORE_ENV: ${{ matrix.php == '8.4' && '1' || '' }} code-samples-inclusion-check: diff --git a/.php-cs-fixer-inline.php b/.php-cs-fixer-inline.php index b30b9978a58..bc7228c4dd4 100644 --- a/.php-cs-fixer-inline.php +++ b/.php-cs-fixer-inline.php @@ -17,11 +17,11 @@ $configFactory->withRules(array_merge($commonRules, [ 'psr_autoloading' => false, - 'AdamWojs/phpdoc_force_fqcn_fixer' => false, ])); return $configFactory ->buildConfig() + ->setUnsupportedPhpVersionAllowed(true) ->setFinder( PhpCsFixer\Finder::create() ->in(__DIR__ . '/code_samples/_inline_php') diff --git a/code_samples/ai_actions/config/packages/ibexa_connector_gemini.yaml b/code_samples/ai_actions/config/packages/ibexa_connector_gemini.yaml index 5d20dac63a3..ddbac0529a0 100644 --- a/code_samples/ai_actions/config/packages/ibexa_connector_gemini.yaml +++ b/code_samples/ai_actions/config/packages/ibexa_connector_gemini.yaml @@ -3,10 +3,14 @@ ibexa_connector_gemini: models: gemini-pro-latest: label: 'Gemini Pro Latest' - max_tokens: 4096 + options: + max_tokens: + max: 4096 gemini-flash-latest: label: 'Gemini Flash Latest' - max_tokens: 4096 + options: + max_tokens: + max: 4096 default_model: gemini-pro-latest default_max_tokens: 4096 # Must be <= the model’s max_tokens default_temperature: 0.8 @@ -14,7 +18,9 @@ ibexa_connector_gemini: models: gemini-flash-latest: label: 'Gemini Flash Latest' - max_tokens: 4096 + options: + max_tokens: + max: 4096 default_model: gemini-flash-latest default_max_tokens: 4096 default_temperature: 1.0 diff --git a/code_samples/ai_actions/src/AI/Action/TranscribeAudioAction.php b/code_samples/ai_actions/src/AI/Action/TranscribeAudioAction.php index 6ab3027e0f7..3e27de2c4b3 100644 --- a/code_samples/ai_actions/src/AI/Action/TranscribeAudioAction.php +++ b/code_samples/ai_actions/src/AI/Action/TranscribeAudioAction.php @@ -9,9 +9,7 @@ final class TranscribeAudioAction extends Action { - public function __construct(private readonly Audio $audio) - { - } + public function __construct(private readonly Audio $audio) {} public function getParameters(): array { diff --git a/code_samples/ai_actions/src/AI/ActionType/TranscribeAudioActionType.php b/code_samples/ai_actions/src/AI/ActionType/TranscribeAudioActionType.php index d6b4b87f481..4c132398ce1 100644 --- a/code_samples/ai_actions/src/AI/ActionType/TranscribeAudioActionType.php +++ b/code_samples/ai_actions/src/AI/ActionType/TranscribeAudioActionType.php @@ -6,6 +6,7 @@ use App\AI\Action\TranscribeAudioAction; use App\AI\DataType\Audio; +use Ibexa\Contracts\ConnectorAi\Action\ActionHandlerInterface; use Ibexa\Contracts\ConnectorAi\Action\DataType\Text; use Ibexa\Contracts\ConnectorAi\ActionInterface; use Ibexa\Contracts\ConnectorAi\ActionType\ActionTypeInterface; @@ -16,10 +17,8 @@ { public const string IDENTIFIER = 'transcribe_audio'; - /** @param iterable<\Ibexa\Contracts\ConnectorAi\Action\ActionHandlerInterface> $actionHandlers*/ - public function __construct(private iterable $actionHandlers) - { - } + /** @param iterable $actionHandlers*/ + public function __construct(private iterable $actionHandlers) {} public function getIdentifier(): string { @@ -46,8 +45,10 @@ public function getOptions(): array return []; } - public function createAction(DataType $input, array $parameters = []): ActionInterface - { + public function createAction( + DataType $input, + array $parameters = [] + ): ActionInterface { if (!$input instanceof Audio) { throw new InvalidArgumentException( 'audio', diff --git a/code_samples/ai_actions/src/AI/DataType/Audio.php b/code_samples/ai_actions/src/AI/DataType/Audio.php index bea562a1c97..5ec4ba854bf 100644 --- a/code_samples/ai_actions/src/AI/DataType/Audio.php +++ b/code_samples/ai_actions/src/AI/DataType/Audio.php @@ -14,9 +14,7 @@ final class Audio implements DataType /** * @param non-empty-array $base64 */ - public function __construct(private array $base64) - { - } + public function __construct(private array $base64) {} public function getBase64(): string { diff --git a/code_samples/ai_actions/src/AI/Handler/LLaVaTextToTextActionHandler.php b/code_samples/ai_actions/src/AI/Handler/LLaVaTextToTextActionHandler.php index 547a00aa724..05d8bb3532d 100644 --- a/code_samples/ai_actions/src/AI/Handler/LLaVaTextToTextActionHandler.php +++ b/code_samples/ai_actions/src/AI/Handler/LLaVaTextToTextActionHandler.php @@ -19,17 +19,18 @@ public function __construct( private HttpClientInterface $client, private string $host = 'http://localhost:8080' - ) { - } + ) {} public function supports(ActionInterface $action): bool { return $action instanceof TextToTextAction; } - public function handle(ActionInterface $action, array $context = []): ActionResponseInterface - { - /** @var \Ibexa\Contracts\ConnectorAi\Action\DataType\Text */ + public function handle( + ActionInterface $action, + array $context = [] + ): ActionResponseInterface { + /** @var Text */ $input = $action->getInput(); $text = $this->sanitizeInput($input->getText()); diff --git a/code_samples/ai_actions/src/AI/Handler/WhisperAudioToTextActionHandler.php b/code_samples/ai_actions/src/AI/Handler/WhisperAudioToTextActionHandler.php index 0e6781204ef..1d73bcdbaec 100644 --- a/code_samples/ai_actions/src/AI/Handler/WhisperAudioToTextActionHandler.php +++ b/code_samples/ai_actions/src/AI/Handler/WhisperAudioToTextActionHandler.php @@ -5,6 +5,7 @@ namespace App\AI\Handler; use App\AI\ActionType\TranscribeAudioActionType; +use App\AI\DataType\Audio; use Ibexa\Contracts\ConnectorAi\Action\ActionHandlerInterface; use Ibexa\Contracts\ConnectorAi\Action\DataType\Text; use Ibexa\Contracts\ConnectorAi\Action\Response\TextResponse; @@ -22,9 +23,11 @@ public function supports(ActionInterface $action): bool return $action->getActionTypeIdentifier() === TranscribeAudioActionType::IDENTIFIER; } - public function handle(ActionInterface $action, array $context = []): ActionResponseInterface - { - /** @var \App\AI\DataType\Audio $input */ + public function handle( + ActionInterface $action, + array $context = [] + ): ActionResponseInterface { + /** @var Audio $input */ $input = $action->getInput(); $path = $this->saveInputToFile($input->getBase64()); diff --git a/code_samples/ai_actions/src/AI/REST/Input/Parser/TranscribeAudio.php b/code_samples/ai_actions/src/AI/REST/Input/Parser/TranscribeAudio.php index 78520a1e4ec..be675e804d3 100644 --- a/code_samples/ai_actions/src/AI/REST/Input/Parser/TranscribeAudio.php +++ b/code_samples/ai_actions/src/AI/REST/Input/Parser/TranscribeAudio.php @@ -17,8 +17,10 @@ final class TranscribeAudio extends BaseParser public const string BASE64_KEY = 'base64'; /** @param array $data */ - public function parse(array $data, ParsingDispatcher $parsingDispatcher): TranscribeAudioAction - { + public function parse( + array $data, + ParsingDispatcher $parsingDispatcher + ): TranscribeAudioAction { $this->assertInputIsValid($data); $runtimeContext = $this->getRuntimeContext($data); diff --git a/code_samples/ai_actions/src/AI/REST/Output/ValueObjectVisitor/AudioText.php b/code_samples/ai_actions/src/AI/REST/Output/ValueObjectVisitor/AudioText.php index 1c8277f5851..696bb8a292a 100644 --- a/code_samples/ai_actions/src/AI/REST/Output/ValueObjectVisitor/AudioText.php +++ b/code_samples/ai_actions/src/AI/REST/Output/ValueObjectVisitor/AudioText.php @@ -15,8 +15,11 @@ final class AudioText extends ValueObjectVisitor /** * @param \App\AI\REST\Value\AudioText $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void - { + public function visit( + Visitor $visitor, + Generator $generator, + $data + ): void { $mediaType = 'ai.' . self::OBJECT_IDENTIFIER; $text = $data->getOutput(); diff --git a/code_samples/ai_actions/src/AI/REST/Value/AudioText.php b/code_samples/ai_actions/src/AI/REST/Value/AudioText.php index d9f2cbc4175..99c01975b4e 100644 --- a/code_samples/ai_actions/src/AI/REST/Value/AudioText.php +++ b/code_samples/ai_actions/src/AI/REST/Value/AudioText.php @@ -6,6 +6,4 @@ use Ibexa\ConnectorAi\REST\Value\RestActionResponse; -final class AudioText extends RestActionResponse -{ -} +final class AudioText extends RestActionResponse {} diff --git a/code_samples/ai_actions/src/AI/REST/Value/TranscribeAudioAction.php b/code_samples/ai_actions/src/AI/REST/Value/TranscribeAudioAction.php index 6e33f288a04..ef19ccbb0d0 100644 --- a/code_samples/ai_actions/src/AI/REST/Value/TranscribeAudioAction.php +++ b/code_samples/ai_actions/src/AI/REST/Value/TranscribeAudioAction.php @@ -12,8 +12,7 @@ public function __construct( private Audio $input, private RuntimeContext $runtimeContext - ) { - } + ) {} public function getInput(): Audio { diff --git a/code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php b/code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php index 0c6ef19854e..e62467a6c0f 100644 --- a/code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php +++ b/code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php @@ -39,8 +39,10 @@ protected function configure(): void $this->addArgument('user', InputArgument::OPTIONAL, 'Login of the user executing the actions', 'admin'); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $input->getArgument('user'); $this->permissionResolver->setCurrentUserReference($this->userService->loadUserByLogin($user)); @@ -63,7 +65,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->actionConfigurationService->createActionConfiguration($actionConfigurationCreateStruct); $action = new RefineTextAction(new Text([ -<<addArgument('user', InputArgument::OPTIONAL, 'Login of the user executing the actions', 'admin'); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $this->setUser($input->getArgument('user')); $modifiedImages = $this->getModifiedImages(); $output->writeln(sprintf('Found %d modified image in the last 24h', $modifiedImages->getTotalCount())); - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ foreach ($modifiedImages as $content) { - /** @var \Ibexa\Core\FieldType\Image\Value $value */ + /** @var Value $value */ $value = $content->getFieldValue(self::IMAGE_FIELD_IDENTIFIER); if ($value === null || !$this->shouldGenerateAltText($value)) { @@ -82,8 +85,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int return Command::SUCCESS; } - private function getSuggestedAltText(string $imageEncodedInBase64, string $languageCode): string - { + private function getSuggestedAltText( + string $imageEncodedInBase64, + string $languageCode + ): string { $action = new GenerateAltTextAction(new Image([$imageEncodedInBase64])); $action->setRuntimeContext(new RuntimeContext(['languageCode' => $languageCode])); @@ -119,7 +124,7 @@ private function convertImageToBase64(string $uri): string private function getModifiedImages(): ContentList { - $filter = (new Filter()) + $filter = new Filter() ->withCriterion( new DateMetadata(DateMetadata::MODIFIED, Operator::GTE, strtotime('-1 day')) ) diff --git a/code_samples/ai_actions/src/Form/Type/TextToTextOptionsType.php b/code_samples/ai_actions/src/Form/Type/TextToTextOptionsType.php index bc2d4306d32..89297ddde63 100644 --- a/code_samples/ai_actions/src/Form/Type/TextToTextOptionsType.php +++ b/code_samples/ai_actions/src/Form/Type/TextToTextOptionsType.php @@ -11,8 +11,10 @@ final class TextToTextOptionsType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder->add('system_prompt', TextareaType::class, [ 'required' => true, 'disabled' => $options['translation_mode'], diff --git a/code_samples/ai_actions/src/Form/Type/TranscribeAudioOptionsType.php b/code_samples/ai_actions/src/Form/Type/TranscribeAudioOptionsType.php index c387716b261..df14a9147f8 100644 --- a/code_samples/ai_actions/src/Form/Type/TranscribeAudioOptionsType.php +++ b/code_samples/ai_actions/src/Form/Type/TranscribeAudioOptionsType.php @@ -11,8 +11,10 @@ final class TranscribeAudioOptionsType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder->add('include_timestamps', CheckboxType::class, [ 'required' => false, 'disabled' => $options['translation_mode'], diff --git a/code_samples/ai_actions/src/Query/Search.php b/code_samples/ai_actions/src/Query/Search.php index 2069f838994..108968d3b7f 100644 --- a/code_samples/ai_actions/src/Query/Search.php +++ b/code_samples/ai_actions/src/Query/Search.php @@ -5,6 +5,7 @@ use Ibexa\Contracts\ConnectorAi\ActionConfiguration\ActionConfigurationQuery; use Ibexa\Contracts\ConnectorAi\ActionConfiguration\Query\Criterion; use Ibexa\Contracts\ConnectorAi\ActionConfiguration\Query\SortClause; +use Ibexa\Contracts\ConnectorAi\ActionConfigurationServiceInterface; use Ibexa\Contracts\CoreSearch\Values\Query\AbstractSortClause; use Ibexa\Contracts\CoreSearch\Values\Query\Criterion\FieldValueCriterion; @@ -21,5 +22,5 @@ new SortClause\Identifier(AbstractSortClause::SORT_ASC), ] ); -/** @var \Ibexa\Contracts\ConnectorAi\ActionConfigurationServiceInterface $actionConfigurationService */ +/** @var ActionConfigurationServiceInterface $actionConfigurationService */ $results = $actionConfigurationService->findActionConfigurations($query); diff --git a/code_samples/api/commerce/src/Command/CartCommand.php b/code_samples/api/commerce/src/Command/CartCommand.php index 7d4bc1a02e8..015a1e3829e 100644 --- a/code_samples/api/commerce/src/Command/CartCommand.php +++ b/code_samples/api/commerce/src/Command/CartCommand.php @@ -40,8 +40,10 @@ public function __construct( parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $this->permissionResolver->setCurrentUserReference( $this->userService->loadUserByLogin('admin') ); diff --git a/code_samples/api/commerce/src/Command/OrderCommand.php b/code_samples/api/commerce/src/Command/OrderCommand.php index 15eb8206f56..833b8cfe03d 100644 --- a/code_samples/api/commerce/src/Command/OrderCommand.php +++ b/code_samples/api/commerce/src/Command/OrderCommand.php @@ -39,8 +39,10 @@ public function __construct( parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $currentUser = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($currentUser); @@ -73,7 +75,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int 'Desk 1' ) ), - ]; + ]; $value = new OrderValue( new Money\Money(20, new Money\Currency('EUR')), diff --git a/code_samples/api/commerce/src/Command/PaymentCommand.php b/code_samples/api/commerce/src/Command/PaymentCommand.php index 0e6ff5ba646..939170a2d86 100644 --- a/code_samples/api/commerce/src/Command/PaymentCommand.php +++ b/code_samples/api/commerce/src/Command/PaymentCommand.php @@ -36,8 +36,10 @@ public function __construct( parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $currentUser = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($currentUser); diff --git a/code_samples/api/commerce/src/Command/PaymentMethodCommand.php b/code_samples/api/commerce/src/Command/PaymentMethodCommand.php index 4f4d6054e7d..c2f479bf2d4 100644 --- a/code_samples/api/commerce/src/Command/PaymentMethodCommand.php +++ b/code_samples/api/commerce/src/Command/PaymentMethodCommand.php @@ -32,8 +32,10 @@ public function __construct( parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $currentUser = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($currentUser); diff --git a/code_samples/api/commerce/src/Command/ShipmentCommand.php b/code_samples/api/commerce/src/Command/ShipmentCommand.php index 6dc246ee3e4..e828ad73f00 100644 --- a/code_samples/api/commerce/src/Command/ShipmentCommand.php +++ b/code_samples/api/commerce/src/Command/ShipmentCommand.php @@ -37,8 +37,10 @@ public function __construct( parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $currentUser = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($currentUser); diff --git a/code_samples/api/commerce/src/Command/ShippingMethodCommand.php b/code_samples/api/commerce/src/Command/ShippingMethodCommand.php index 85368142f84..6787a4d4438 100644 --- a/code_samples/api/commerce/src/Command/ShippingMethodCommand.php +++ b/code_samples/api/commerce/src/Command/ShippingMethodCommand.php @@ -32,8 +32,10 @@ public function __construct( parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $currentUser = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($currentUser); diff --git a/code_samples/api/commerce/src/Controller/CustomCheckoutController.php b/code_samples/api/commerce/src/Controller/CustomCheckoutController.php index 6dead11eb5d..4101afa7c60 100644 --- a/code_samples/api/commerce/src/Controller/CustomCheckoutController.php +++ b/code_samples/api/commerce/src/Controller/CustomCheckoutController.php @@ -14,8 +14,7 @@ class CustomCheckoutController extends Controller public function __construct( private readonly CartServiceInterface $cartService, private readonly CheckoutServiceInterface $checkoutService - ) { - } + ) {} public function showContentAction(): Response { diff --git a/code_samples/api/graphql/src/GraphQL/Schema/MyFieldDefinitionMapper.php b/code_samples/api/graphql/src/GraphQL/Schema/MyFieldDefinitionMapper.php index b2a4432f869..e5daebeee0c 100644 --- a/code_samples/api/graphql/src/GraphQL/Schema/MyFieldDefinitionMapper.php +++ b/code_samples/api/graphql/src/GraphQL/Schema/MyFieldDefinitionMapper.php @@ -16,8 +16,10 @@ protected function getFieldTypeIdentifier(): string } #[\Override] - public function mapToFieldValueInputType(ContentType $contentType, FieldDefinition $fieldDefinition): ?string - { + public function mapToFieldValueInputType( + ContentType $contentType, + FieldDefinition $fieldDefinition + ): ?string { if (!$this->canMap($fieldDefinition)) { return parent::mapToFieldValueInputType($contentType, $fieldDefinition); } @@ -25,8 +27,10 @@ public function mapToFieldValueInputType(ContentType $contentType, FieldDefiniti return $this->nameMyFieldInputType($contentType, $fieldDefinition); } - private function nameMyFieldInputType(ContentType $contentType, FieldDefinition $fieldDefinition): string - { + private function nameMyFieldInputType( + ContentType $contentType, + FieldDefinition $fieldDefinition + ): string { $converter = new CamelCaseToSnakeCaseNameConverter(null, false); return sprintf( diff --git a/code_samples/api/migration/src/Command/MigrationCommand.php b/code_samples/api/migration/src/Command/MigrationCommand.php index 7f4938bbeaa..142c59c1024 100644 --- a/code_samples/api/migration/src/Command/MigrationCommand.php +++ b/code_samples/api/migration/src/Command/MigrationCommand.php @@ -19,8 +19,10 @@ public function __construct(private readonly MigrationService $migrationService) parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $string_with_migration_content = ''; $this->migrationService->add( new Migration( diff --git a/code_samples/api/notifications/notification_send.php b/code_samples/api/notifications/notification_send.php index ce542c33a30..3a584bebbd1 100644 --- a/code_samples/api/notifications/notification_send.php +++ b/code_samples/api/notifications/notification_send.php @@ -1,6 +1,9 @@ send( new SymfonyNotificationAdapter(new MyNotification($subject)), diff --git a/code_samples/api/notifications/src/Command/NotificationSenderCommand.php b/code_samples/api/notifications/src/Command/NotificationSenderCommand.php index ddd75f2e24e..f11e10b828b 100644 --- a/code_samples/api/notifications/src/Command/NotificationSenderCommand.php +++ b/code_samples/api/notifications/src/Command/NotificationSenderCommand.php @@ -28,8 +28,10 @@ public function __construct( parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { /** @var array $exceptions */ $exceptions = []; diff --git a/code_samples/api/notifications/src/Controller/NotificationSenderController.php b/code_samples/api/notifications/src/Controller/NotificationSenderController.php index 2f8ee320377..66dac00562e 100644 --- a/code_samples/api/notifications/src/Controller/NotificationSenderController.php +++ b/code_samples/api/notifications/src/Controller/NotificationSenderController.php @@ -13,14 +13,13 @@ class NotificationSenderController extends AbstractController { public function __construct( private readonly NotificationServiceInterface $notificationService, - ) { - } + ) {} #[Route('/notification-sender')] public function index(): Response { $this->notificationService->send( - new SymfonyNotificationAdapter((new ControllerFeedback('Message sent from controller'))->emoji('👍')), + new SymfonyNotificationAdapter(new ControllerFeedback('Message sent from controller')->emoji('👍')), ); return $this->render('@ibexadesign/notification-sender-controller.html.twig'); diff --git a/code_samples/api/notifications/src/Notifications/CommandExecuted.php b/code_samples/api/notifications/src/Notifications/CommandExecuted.php index 6f01028477d..1f260692656 100644 --- a/code_samples/api/notifications/src/Notifications/CommandExecuted.php +++ b/code_samples/api/notifications/src/Notifications/CommandExecuted.php @@ -25,8 +25,10 @@ public function __construct( $this->importance(Command::SUCCESS === $this->exitCode ? Notification::IMPORTANCE_LOW : Notification::IMPORTANCE_HIGH); } - public function asEmailMessage(EmailRecipientInterface $recipient, ?string $transport = null): ?EmailMessage - { + public function asEmailMessage( + EmailRecipientInterface $recipient, + ?string $transport = null + ): ?EmailMessage { $body = ''; foreach ($this->exceptions as $exception) { $body .= $exception->getMessage() . '
'; @@ -40,8 +42,10 @@ public function asEmailMessage(EmailRecipientInterface $recipient, ?string $tran return new EmailMessage($email); } - public function asSystemNotification(UserRecipientInterface $recipient, ?string $transport = null): ?SystemMessage - { + public function asSystemNotification( + UserRecipientInterface $recipient, + ?string $transport = null + ): ?SystemMessage { $message = new SystemMessage($recipient->getUser()); $message->setContext([ 'icon' => Command::SUCCESS === $this->exitCode ? 'check-circle' : 'discard-circle', diff --git a/code_samples/api/notifications/src/Notifications/ControllerFeedback.php b/code_samples/api/notifications/src/Notifications/ControllerFeedback.php index 0c82a0be117..7effa665754 100644 --- a/code_samples/api/notifications/src/Notifications/ControllerFeedback.php +++ b/code_samples/api/notifications/src/Notifications/ControllerFeedback.php @@ -4,6 +4,4 @@ use Symfony\Component\Notifier\Notification\Notification; -class ControllerFeedback extends Notification -{ -} +class ControllerFeedback extends Notification {} diff --git a/code_samples/api/notifications/src/Notifier/Channel/LogChannel.php b/code_samples/api/notifications/src/Notifier/Channel/LogChannel.php index 39abce608e1..9a6d533fa95 100644 --- a/code_samples/api/notifications/src/Notifier/Channel/LogChannel.php +++ b/code_samples/api/notifications/src/Notifier/Channel/LogChannel.php @@ -12,8 +12,11 @@ class LogChannel implements ChannelInterface, LoggerAwareInterface { use LoggerAwareTrait; - public function notify(Notification $notification, RecipientInterface $recipient, ?string $transportName = null): void - { + public function notify( + Notification $notification, + RecipientInterface $recipient, + ?string $transportName = null + ): void { if (isset($this->logger)) { $this->logger->info($notification->getSubject(), [ 'class' => $notification::class, @@ -23,8 +26,10 @@ public function notify(Notification $notification, RecipientInterface $recipient } } - public function supports(Notification $notification, RecipientInterface $recipient): bool - { + public function supports( + Notification $notification, + RecipientInterface $recipient + ): bool { return true; } } diff --git a/code_samples/api/product_catalog/src/Command/AttributeCommand.php b/code_samples/api/product_catalog/src/Command/AttributeCommand.php index 397feb4ee1b..5bc9916a17c 100644 --- a/code_samples/api/product_catalog/src/Command/AttributeCommand.php +++ b/code_samples/api/product_catalog/src/Command/AttributeCommand.php @@ -31,8 +31,10 @@ public function __construct( parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/product_catalog/src/Command/CatalogCommand.php b/code_samples/api/product_catalog/src/Command/CatalogCommand.php index eef9eb1d629..093120c6489 100644 --- a/code_samples/api/product_catalog/src/Command/CatalogCommand.php +++ b/code_samples/api/product_catalog/src/Command/CatalogCommand.php @@ -41,8 +41,10 @@ public function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/product_catalog/src/Command/CurrencyCommand.php b/code_samples/api/product_catalog/src/Command/CurrencyCommand.php index 8162fadedea..1a7b573b626 100644 --- a/code_samples/api/product_catalog/src/Command/CurrencyCommand.php +++ b/code_samples/api/product_catalog/src/Command/CurrencyCommand.php @@ -35,8 +35,10 @@ public function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/product_catalog/src/Command/ProductAssetCommand.php b/code_samples/api/product_catalog/src/Command/ProductAssetCommand.php index aa9ed43d9e9..8a791413074 100644 --- a/code_samples/api/product_catalog/src/Command/ProductAssetCommand.php +++ b/code_samples/api/product_catalog/src/Command/ProductAssetCommand.php @@ -36,8 +36,10 @@ public function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/product_catalog/src/Command/ProductCommand.php b/code_samples/api/product_catalog/src/Command/ProductCommand.php index b94753257bc..2317389d592 100644 --- a/code_samples/api/product_catalog/src/Command/ProductCommand.php +++ b/code_samples/api/product_catalog/src/Command/ProductCommand.php @@ -45,8 +45,10 @@ public function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/product_catalog/src/Command/ProductPriceCommand.php b/code_samples/api/product_catalog/src/Command/ProductPriceCommand.php index 0a3c40ecbbb..ba6bde79ccb 100644 --- a/code_samples/api/product_catalog/src/Command/ProductPriceCommand.php +++ b/code_samples/api/product_catalog/src/Command/ProductPriceCommand.php @@ -48,8 +48,10 @@ public function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/product_catalog/src/Command/ProductTypeCommand.php b/code_samples/api/product_catalog/src/Command/ProductTypeCommand.php index a544245d40a..214198ef5ff 100644 --- a/code_samples/api/product_catalog/src/Command/ProductTypeCommand.php +++ b/code_samples/api/product_catalog/src/Command/ProductTypeCommand.php @@ -39,8 +39,10 @@ public function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/product_catalog/src/Command/ProductVariantCommand.php b/code_samples/api/product_catalog/src/Command/ProductVariantCommand.php index 92c7dab42d0..349fb3c14e1 100644 --- a/code_samples/api/product_catalog/src/Command/ProductVariantCommand.php +++ b/code_samples/api/product_catalog/src/Command/ProductVariantCommand.php @@ -40,8 +40,10 @@ public function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/product_catalog/src/Command/VatCommand.php b/code_samples/api/product_catalog/src/Command/VatCommand.php index fc5ee046c60..43037e68c62 100644 --- a/code_samples/api/product_catalog/src/Command/VatCommand.php +++ b/code_samples/api/product_catalog/src/Command/VatCommand.php @@ -34,8 +34,10 @@ public function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/AddLanguageCommand.php b/code_samples/api/public_php_api/src/Command/AddLanguageCommand.php index 94f045dbb81..53dccb61422 100644 --- a/code_samples/api/public_php_api/src/Command/AddLanguageCommand.php +++ b/code_samples/api/public_php_api/src/Command/AddLanguageCommand.php @@ -24,8 +24,10 @@ public function __construct( parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/AddLocationToContentCommand.php b/code_samples/api/public_php_api/src/Command/AddLocationToContentCommand.php index 4b5d4728f54..78a4580eb3c 100644 --- a/code_samples/api/public_php_api/src/Command/AddLocationToContentCommand.php +++ b/code_samples/api/public_php_api/src/Command/AddLocationToContentCommand.php @@ -36,8 +36,10 @@ protected function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/BookmarkCommand.php b/code_samples/api/public_php_api/src/Command/BookmarkCommand.php index aaff6fb0340..bdf109e7374 100644 --- a/code_samples/api/public_php_api/src/Command/BookmarkCommand.php +++ b/code_samples/api/public_php_api/src/Command/BookmarkCommand.php @@ -32,8 +32,10 @@ protected function configure(): void ->addOption('delete', 'd', InputOption::VALUE_NONE, 'Delete the created Favourites entry?', null); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $locationId = (int) $input->getArgument('locationId'); $location = $this->locationService->loadLocation($locationId); diff --git a/code_samples/api/public_php_api/src/Command/BrowseLocationsCommand.php b/code_samples/api/public_php_api/src/Command/BrowseLocationsCommand.php index 9f88f6ee9eb..bbe0e56de72 100644 --- a/code_samples/api/public_php_api/src/Command/BrowseLocationsCommand.php +++ b/code_samples/api/public_php_api/src/Command/BrowseLocationsCommand.php @@ -29,8 +29,11 @@ protected function configure(): void ]); } - private function browseLocation(Location $location, OutputInterface $output, int $depth = 0): void - { + private function browseLocation( + Location $location, + OutputInterface $output, + int $depth = 0 + ): void { $output->writeln($location->contentInfo->name); $children = $this->locationService->loadLocationChildren($location); @@ -39,8 +42,10 @@ private function browseLocation(Location $location, OutputInterface $output, int } } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $locationId = (int) $input->getArgument('locationId'); $location = $this->locationService->loadLocation($locationId); diff --git a/code_samples/api/public_php_api/src/Command/CalendarCommand.php b/code_samples/api/public_php_api/src/Command/CalendarCommand.php index 4a48eedfaf9..4e7f739ecd4 100644 --- a/code_samples/api/public_php_api/src/Command/CalendarCommand.php +++ b/code_samples/api/public_php_api/src/Command/CalendarCommand.php @@ -26,8 +26,10 @@ public function __construct( parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/CreateContentCommand.php b/code_samples/api/public_php_api/src/Command/CreateContentCommand.php index 620c0932c6d..8467de0271e 100644 --- a/code_samples/api/public_php_api/src/Command/CreateContentCommand.php +++ b/code_samples/api/public_php_api/src/Command/CreateContentCommand.php @@ -40,8 +40,10 @@ protected function configure(): void ->addOption('publish', 'p', InputOption::VALUE_NONE, 'Do you want to publish the content item?'); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php b/code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php index 2f9a9b694a1..9db5048cd58 100644 --- a/code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php +++ b/code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php @@ -36,8 +36,10 @@ protected function configure(): void ->addOption('copy', 'c', InputOption::VALUE_NONE, 'Do you want to make a copy of the content type?'); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/CreateImageCommand.php b/code_samples/api/public_php_api/src/Command/CreateImageCommand.php index 201b1d980b7..ab4b10a2faf 100644 --- a/code_samples/api/public_php_api/src/Command/CreateImageCommand.php +++ b/code_samples/api/public_php_api/src/Command/CreateImageCommand.php @@ -40,8 +40,10 @@ protected function configure(): void ->addOption('publish', 'p', InputOption::VALUE_NONE, 'Do you want to publish the content item?'); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/DeleteContentCommand.php b/code_samples/api/public_php_api/src/Command/DeleteContentCommand.php index 6c58ceeea63..e06d51413f1 100644 --- a/code_samples/api/public_php_api/src/Command/DeleteContentCommand.php +++ b/code_samples/api/public_php_api/src/Command/DeleteContentCommand.php @@ -31,8 +31,10 @@ protected function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/FilterCommand.php b/code_samples/api/public_php_api/src/Command/FilterCommand.php index 09f1afdd357..749e79118db 100644 --- a/code_samples/api/public_php_api/src/Command/FilterCommand.php +++ b/code_samples/api/public_php_api/src/Command/FilterCommand.php @@ -31,8 +31,10 @@ public function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $parentLocationId = (int)$input->getArgument('parentLocationId'); $filter = new Filter(); diff --git a/code_samples/api/public_php_api/src/Command/FilterLocationCommand.php b/code_samples/api/public_php_api/src/Command/FilterLocationCommand.php index f1f05b5b237..b0682c6af85 100644 --- a/code_samples/api/public_php_api/src/Command/FilterLocationCommand.php +++ b/code_samples/api/public_php_api/src/Command/FilterLocationCommand.php @@ -31,8 +31,10 @@ public function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $parentLocationId = (int)$input->getArgument('parentLocationId'); $filter = new Filter(); diff --git a/code_samples/api/public_php_api/src/Command/FindByTaxonomyEmbeddingCommand.php b/code_samples/api/public_php_api/src/Command/FindByTaxonomyEmbeddingCommand.php index 4d0af395359..34a93889eca 100644 --- a/code_samples/api/public_php_api/src/Command/FindByTaxonomyEmbeddingCommand.php +++ b/code_samples/api/public_php_api/src/Command/FindByTaxonomyEmbeddingCommand.php @@ -5,6 +5,7 @@ namespace App\Command; use Ibexa\Contracts\Core\Repository\SearchService; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\EmbeddingQueryBuilder; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ContentTypeIdentifier; use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchHit; @@ -53,7 +54,7 @@ protected function execute( foreach ($result->searchHits as $searchHit) { assert($searchHit instanceof SearchHit); - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ $content = $searchHit->valueObject; $contentInfo = $content->versionInfo->contentInfo; diff --git a/code_samples/api/public_php_api/src/Command/FindComplexCommand.php b/code_samples/api/public_php_api/src/Command/FindComplexCommand.php index a60e28a59c4..6babeef1662 100644 --- a/code_samples/api/public_php_api/src/Command/FindComplexCommand.php +++ b/code_samples/api/public_php_api/src/Command/FindComplexCommand.php @@ -36,8 +36,10 @@ protected function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $locationId = (int) $input->getArgument('locationId'); $contentTypeIdentifier = $input->getArgument('contentTypeIdentifier'); $text = $input->getArgument('text'); diff --git a/code_samples/api/public_php_api/src/Command/FindContentCommand.php b/code_samples/api/public_php_api/src/Command/FindContentCommand.php index ff72d55a46a..6debd0e364d 100644 --- a/code_samples/api/public_php_api/src/Command/FindContentCommand.php +++ b/code_samples/api/public_php_api/src/Command/FindContentCommand.php @@ -30,8 +30,10 @@ protected function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $contentTypeIdentifier = $input->getArgument('contentTypeIdentifier'); $query = new LocationQuery(); diff --git a/code_samples/api/public_php_api/src/Command/FindContentTypeCommand.php b/code_samples/api/public_php_api/src/Command/FindContentTypeCommand.php index d8287a0229d..79ad1e00e38 100644 --- a/code_samples/api/public_php_api/src/Command/FindContentTypeCommand.php +++ b/code_samples/api/public_php_api/src/Command/FindContentTypeCommand.php @@ -22,8 +22,10 @@ public function __construct(private readonly ContentTypeService $contentTypeServ parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { // Find content types from the "Content" group that contains a specific field definition (in this case, a "Body" field). $query = new ContentTypeQuery( new Criterion\LogicalAnd([ diff --git a/code_samples/api/public_php_api/src/Command/FindInTrashCommand.php b/code_samples/api/public_php_api/src/Command/FindInTrashCommand.php index c663e929175..e8a6a17af99 100644 --- a/code_samples/api/public_php_api/src/Command/FindInTrashCommand.php +++ b/code_samples/api/public_php_api/src/Command/FindInTrashCommand.php @@ -29,8 +29,10 @@ protected function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $contentTypeId = (int) $input->getArgument('contentTypeId'); $query = new Query(); diff --git a/code_samples/api/public_php_api/src/Command/FindUrlCommand.php b/code_samples/api/public_php_api/src/Command/FindUrlCommand.php index d9535189b3e..9c4ac11e5e8 100644 --- a/code_samples/api/public_php_api/src/Command/FindUrlCommand.php +++ b/code_samples/api/public_php_api/src/Command/FindUrlCommand.php @@ -27,8 +27,10 @@ public function __construct( parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php b/code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php index 664d0a85fbd..c225cd66504 100644 --- a/code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php +++ b/code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php @@ -23,8 +23,10 @@ public function __construct(private readonly SearchService $searchService) parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $query = new LocationQuery(); $query->query = new Criterion\ParentLocationId(2); diff --git a/code_samples/api/public_php_api/src/Command/FormSubmissionCommand.php b/code_samples/api/public_php_api/src/Command/FormSubmissionCommand.php index 54589ca95dc..fc6e5c1d2b7 100644 --- a/code_samples/api/public_php_api/src/Command/FormSubmissionCommand.php +++ b/code_samples/api/public_php_api/src/Command/FormSubmissionCommand.php @@ -25,8 +25,10 @@ public function __construct( parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/HideLocationCommand.php b/code_samples/api/public_php_api/src/Command/HideLocationCommand.php index 2ad1d224ad5..48188f78235 100644 --- a/code_samples/api/public_php_api/src/Command/HideLocationCommand.php +++ b/code_samples/api/public_php_api/src/Command/HideLocationCommand.php @@ -33,8 +33,10 @@ protected function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/MoveContentCommand.php b/code_samples/api/public_php_api/src/Command/MoveContentCommand.php index 50b760fa962..51799751ba5 100644 --- a/code_samples/api/public_php_api/src/Command/MoveContentCommand.php +++ b/code_samples/api/public_php_api/src/Command/MoveContentCommand.php @@ -29,13 +29,15 @@ protected function configure(): void { $this ->setDefinition([ - new InputArgument('locationId', InputArgument::REQUIRED, 'Location to copy'), - new InputArgument('targetLocationId', InputArgument::REQUIRED, 'Target to copy or move to'), + new InputArgument('locationId', InputArgument::REQUIRED, 'Location to copy'), + new InputArgument('targetLocationId', InputArgument::REQUIRED, 'Target to copy or move to'), ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/ObjectStateCommand.php b/code_samples/api/public_php_api/src/Command/ObjectStateCommand.php index 5c133c6743c..69c1aca8a81 100644 --- a/code_samples/api/public_php_api/src/Command/ObjectStateCommand.php +++ b/code_samples/api/public_php_api/src/Command/ObjectStateCommand.php @@ -37,8 +37,10 @@ protected function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/SectionCommand.php b/code_samples/api/public_php_api/src/Command/SectionCommand.php index 2ee4e31d2a9..c2417a379fb 100644 --- a/code_samples/api/public_php_api/src/Command/SectionCommand.php +++ b/code_samples/api/public_php_api/src/Command/SectionCommand.php @@ -41,8 +41,10 @@ protected function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/SegmentCommand.php b/code_samples/api/public_php_api/src/Command/SegmentCommand.php index 5dc67fc6bf9..fd97302f876 100644 --- a/code_samples/api/public_php_api/src/Command/SegmentCommand.php +++ b/code_samples/api/public_php_api/src/Command/SegmentCommand.php @@ -25,8 +25,10 @@ public function __construct( parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/SetMainLocationCommand.php b/code_samples/api/public_php_api/src/Command/SetMainLocationCommand.php index 081cbabcc50..be5f4e1ed7b 100644 --- a/code_samples/api/public_php_api/src/Command/SetMainLocationCommand.php +++ b/code_samples/api/public_php_api/src/Command/SetMainLocationCommand.php @@ -34,8 +34,10 @@ protected function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/TaxonomyCommand.php b/code_samples/api/public_php_api/src/Command/TaxonomyCommand.php index 2b98a23b6eb..7ee1820a83b 100644 --- a/code_samples/api/public_php_api/src/Command/TaxonomyCommand.php +++ b/code_samples/api/public_php_api/src/Command/TaxonomyCommand.php @@ -25,8 +25,10 @@ public function __construct( parent::__construct(); } - public function execute(InputInterface $input, OutputInterface $output): int - { + public function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/TranslateContentCommand.php b/code_samples/api/public_php_api/src/Command/TranslateContentCommand.php index c599ca0bbee..dc28a90e11e 100644 --- a/code_samples/api/public_php_api/src/Command/TranslateContentCommand.php +++ b/code_samples/api/public_php_api/src/Command/TranslateContentCommand.php @@ -36,8 +36,10 @@ protected function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/TrashContentCommand.php b/code_samples/api/public_php_api/src/Command/TrashContentCommand.php index 23bcdf7ad4a..10da136a116 100644 --- a/code_samples/api/public_php_api/src/Command/TrashContentCommand.php +++ b/code_samples/api/public_php_api/src/Command/TrashContentCommand.php @@ -36,8 +36,10 @@ protected function configure(): void ->addOption('restore', 'r', InputOption::VALUE_NONE, 'Do you want to restore the content item?'); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/UpdateContentCommand.php b/code_samples/api/public_php_api/src/Command/UpdateContentCommand.php index 5783097e29e..093f14ca67c 100644 --- a/code_samples/api/public_php_api/src/Command/UpdateContentCommand.php +++ b/code_samples/api/public_php_api/src/Command/UpdateContentCommand.php @@ -34,8 +34,10 @@ protected function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/ViewContentCommand.php b/code_samples/api/public_php_api/src/Command/ViewContentCommand.php index 0af99757e71..c926a65b2c2 100644 --- a/code_samples/api/public_php_api/src/Command/ViewContentCommand.php +++ b/code_samples/api/public_php_api/src/Command/ViewContentCommand.php @@ -33,8 +33,10 @@ protected function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $contentId = (int) $input->getArgument('contentId'); $content = $this->contentService->loadContent($contentId); diff --git a/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php b/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php index 69f197bd3a1..a2dea9eefcb 100644 --- a/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php +++ b/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php @@ -42,8 +42,10 @@ protected function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $user = $this->userService->loadUserByLogin('admin'); $this->permissionResolver->setCurrentUserReference($user); diff --git a/code_samples/api/public_php_api/src/Command/WorkflowCommand.php b/code_samples/api/public_php_api/src/Command/WorkflowCommand.php index 7ed4d01efc8..a4bf33b6b88 100644 --- a/code_samples/api/public_php_api/src/Command/WorkflowCommand.php +++ b/code_samples/api/public_php_api/src/Command/WorkflowCommand.php @@ -35,8 +35,10 @@ protected function configure(): void ]); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $contentId = (int) $input->getArgument('contentId'); $workflowName = $input->getArgument('workflowName'); $transitionName = $input->getArgument('transitionName'); diff --git a/code_samples/api/public_php_api/src/Controller/CustomController.php b/code_samples/api/public_php_api/src/Controller/CustomController.php index 1f00f315719..0b539852b07 100644 --- a/code_samples/api/public_php_api/src/Controller/CustomController.php +++ b/code_samples/api/public_php_api/src/Controller/CustomController.php @@ -10,9 +10,7 @@ class CustomController extends Controller { - public function __construct(private readonly SearchService $searchService) - { - } + public function __construct(private readonly SearchService $searchService) {} public function showContentAction(int $locationId): Response { diff --git a/code_samples/api/public_php_api/src/Controller/CustomFilterController.php b/code_samples/api/public_php_api/src/Controller/CustomFilterController.php index 07c057262d9..cbbc14c6be1 100644 --- a/code_samples/api/public_php_api/src/Controller/CustomFilterController.php +++ b/code_samples/api/public_php_api/src/Controller/CustomFilterController.php @@ -10,9 +10,7 @@ class CustomFilterController extends Controller { - public function __construct(private readonly ContentService $contentService) - { - } + public function __construct(private readonly ContentService $contentService) {} public function showChildrenAction(ContentView $view): ContentView { diff --git a/code_samples/api/public_php_api/src/Controller/PaginationController.php b/code_samples/api/public_php_api/src/Controller/PaginationController.php index 0a84d954d6f..339adc98a05 100644 --- a/code_samples/api/public_php_api/src/Controller/PaginationController.php +++ b/code_samples/api/public_php_api/src/Controller/PaginationController.php @@ -13,12 +13,12 @@ class PaginationController extends Controller { - public function __construct(private readonly SearchService $searchService) - { - } + public function __construct(private readonly SearchService $searchService) {} - public function showContentAction(Request $request, int $locationId): Response - { + public function showContentAction( + Request $request, + int $locationId + ): Response { $query = new LocationQuery(); $query->filter = new Criterion\ParentLocationId($locationId); diff --git a/code_samples/api/public_php_api/src/embedding_fields.php b/code_samples/api/public_php_api/src/embedding_fields.php index 6276bab30eb..61570a881ef 100644 --- a/code_samples/api/public_php_api/src/embedding_fields.php +++ b/code_samples/api/public_php_api/src/embedding_fields.php @@ -1,8 +1,9 @@ create(); echo $embeddingField->getType(); // for example, "ibexa_dense_vector_model_123" diff --git a/code_samples/api/public_php_api/src/perform_count.php b/code_samples/api/public_php_api/src/perform_count.php index db61e36d736..0db9aae9ec2 100644 --- a/code_samples/api/public_php_api/src/perform_count.php +++ b/code_samples/api/public_php_api/src/perform_count.php @@ -1,9 +1,10 @@ []\n"; diff --git a/code_samples/api/rest_api/create_image.xml.php b/code_samples/api/rest_api/create_image.xml.php index 4522d9fd9ec..ae18dab1965 100644 --- a/code_samples/api/rest_api/create_image.xml.php +++ b/code_samples/api/rest_api/create_image.xml.php @@ -5,6 +5,11 @@ use Symfony\Component\HttpClient\HttpClient; use Symfony\Contracts\HttpClient\Exception as HttpException; +if (!isset($argv) || !isset($argc) || PHP_SAPI !== 'cli') { + echo "This script must be run from the command line.\n"; + exit(9); +} + if ($argc < 2) { // Print script usage echo "Usage: php {$argv[0]} []\n"; diff --git a/code_samples/api/rest_api/load_content.php b/code_samples/api/rest_api/load_content.php index 3e7cd7063a9..dc3c5d2054c 100644 --- a/code_samples/api/rest_api/load_content.php +++ b/code_samples/api/rest_api/load_content.php @@ -1,8 +1,9 @@ request('GET', $resource, [ 'headers' => ['Accept: application/vnd.ibexa.api.ContentInfo+json'], ]); diff --git a/code_samples/api/rest_api/src/Rest/InputParser/GreetingInput.php b/code_samples/api/rest_api/src/Rest/InputParser/GreetingInput.php index da1bb5a3467..9d79d2e902a 100644 --- a/code_samples/api/rest_api/src/Rest/InputParser/GreetingInput.php +++ b/code_samples/api/rest_api/src/Rest/InputParser/GreetingInput.php @@ -9,8 +9,10 @@ class GreetingInput extends BaseParser { - public function parse(array $data, ParsingDispatcher $parsingDispatcher): Greeting - { + public function parse( + array $data, + ParsingDispatcher $parsingDispatcher + ): Greeting { if (!isset($data['Salutation'])) { throw new Exceptions\Parser("Missing or invalid 'Salutation' element for Greeting."); } diff --git a/code_samples/api/rest_api/src/Rest/ValueObjectVisitor/Greeting.php b/code_samples/api/rest_api/src/Rest/ValueObjectVisitor/Greeting.php index dc2562caf71..6276ebcda6f 100644 --- a/code_samples/api/rest_api/src/Rest/ValueObjectVisitor/Greeting.php +++ b/code_samples/api/rest_api/src/Rest/ValueObjectVisitor/Greeting.php @@ -11,8 +11,11 @@ class Greeting extends ValueObjectVisitor /** * @param \App\Rest\Values\Greeting $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void - { + public function visit( + Visitor $visitor, + Generator $generator, + $data + ): void { $visitor->setHeader('Content-Type', $generator->getMediaType('Greeting')); $generator->startObjectElement('Greeting'); $generator->attribute('href', $this->router->generate('app.rest.greeting')); diff --git a/code_samples/api/rest_api/src/Rest/ValueObjectVisitor/RestLocation.php b/code_samples/api/rest_api/src/Rest/ValueObjectVisitor/RestLocation.php index fcc739e4ffd..feec76a957c 100644 --- a/code_samples/api/rest_api/src/Rest/ValueObjectVisitor/RestLocation.php +++ b/code_samples/api/rest_api/src/Rest/ValueObjectVisitor/RestLocation.php @@ -10,18 +10,19 @@ class RestLocation extends BaseRestLocation { - public function __construct(private readonly URLAliasService $urlAliasService) - { - } + public function __construct(private readonly URLAliasService $urlAliasService) {} #[\Override] - public function visit(Visitor $visitor, Generator $generator, $data): void - { + public function visit( + Visitor $visitor, + Generator $generator, + $data + ): void { // Not using $generator->startObjectElement to not have the XML Generator adding its own media-type attribute with the default vendor $generator->startHashElement('Location'); $generator->attribute( 'media-type', - 'application/app.api.Location+' . strtolower((new \ReflectionClass($generator))->getShortName()) + 'application/app.api.Location+' . strtolower(new \ReflectionClass($generator)->getShortName()) ); $generator->attribute( 'href', diff --git a/code_samples/api/rest_api/src/Rest/Values/Greeting.php b/code_samples/api/rest_api/src/Rest/Values/Greeting.php index 696289feab7..8968db12fda 100644 --- a/code_samples/api/rest_api/src/Rest/Values/Greeting.php +++ b/code_samples/api/rest_api/src/Rest/Values/Greeting.php @@ -7,6 +7,5 @@ class Greeting public function __construct( public string $salutation = 'Hello', public string $recipient = 'World' - ) { - } + ) {} } diff --git a/code_samples/back_office/calendar/src/Calendar/Holidays/Event.php b/code_samples/back_office/calendar/src/Calendar/Holidays/Event.php index 099a8ae95c2..8718d55f6d3 100644 --- a/code_samples/back_office/calendar/src/Calendar/Holidays/Event.php +++ b/code_samples/back_office/calendar/src/Calendar/Holidays/Event.php @@ -7,8 +7,11 @@ class Event extends CalendarEvent { - public function __construct(string $id, DateTimeInterface $dateTime, EventType $type) - { + public function __construct( + string $id, + DateTimeInterface $dateTime, + EventType $type + ) { parent::__construct($type, $id, $dateTime); } } diff --git a/code_samples/back_office/calendar/src/Calendar/Holidays/EventSourceFactory.php b/code_samples/back_office/calendar/src/Calendar/Holidays/EventSourceFactory.php index 67478c33fda..a322f36d61f 100644 --- a/code_samples/back_office/calendar/src/Calendar/Holidays/EventSourceFactory.php +++ b/code_samples/back_office/calendar/src/Calendar/Holidays/EventSourceFactory.php @@ -10,9 +10,7 @@ class EventSourceFactory { - public function __construct(private readonly EventType $eventType) - { - } + public function __construct(private readonly EventType $eventType) {} public function createEventSource(): EventSourceInterface { @@ -29,8 +27,10 @@ public function createEventSource(): EventSourceInterface return new InMemoryEventSource($collection); } - private function createEvent(string $id, DateTimeInterface $dateTime): Event - { + private function createEvent( + string $id, + DateTimeInterface $dateTime + ): Event { return new Event($id, $dateTime, $this->eventType); } } diff --git a/code_samples/back_office/dashboard/src/Command/DashboardCommand.php b/code_samples/back_office/dashboard/src/Command/DashboardCommand.php index 6e4616b788e..4d63849b900 100644 --- a/code_samples/back_office/dashboard/src/Command/DashboardCommand.php +++ b/code_samples/back_office/dashboard/src/Command/DashboardCommand.php @@ -20,7 +20,7 @@ )] class DashboardCommand extends Command { - private readonly Locationservice $locationService; + private readonly LocationService $locationService; private readonly ContentService $contentService; @@ -47,8 +47,10 @@ public function configure(): void ->addArgument('group', InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'User Group Content ID(s)'); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $dashboardModelLocationId = (int)$input->getArgument('dashboard'); $userGroupLocationIdList = array_map(intval(...), $input->getArgument('group')); diff --git a/code_samples/back_office/images/src/Connector/Dam/Handler/WikimediaCommonsHandler.php b/code_samples/back_office/images/src/Connector/Dam/Handler/WikimediaCommonsHandler.php index a6ecdac15c2..d00e111a531 100644 --- a/code_samples/back_office/images/src/Connector/Dam/Handler/WikimediaCommonsHandler.php +++ b/code_samples/back_office/images/src/Connector/Dam/Handler/WikimediaCommonsHandler.php @@ -16,8 +16,11 @@ class WikimediaCommonsHandler implements HandlerInterface { private const string USER_AGENT = 'Ibexa DXP Commons Dam Connector'; - public function search(Query $query, int $offset = 0, int $limit = 20): AssetSearchResult - { + public function search( + Query $query, + int $offset = 0, + int $limit = 20 + ): AssetSearchResult { $searchUrl = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srnamespace=6' . '&srsearch=' . urlencode($query->getPhrase()) . '&sroffset=' . $offset @@ -80,7 +83,7 @@ public function fetchAsset(string $id): Asset throw new \RuntimeException('Couldn\'t parse asset metadata'); } - $pageData = array_values($response['query']['pages'])[0] ?? null; + $pageData = array_first($response['query']['pages']) ?? null; if (!isset($pageData['imageinfo'][0]['extmetadata'])) { throw new \RuntimeException('Couldn\'t parse image asset metadata'); } diff --git a/code_samples/back_office/images/src/Connector/Dam/Transformation/WikimediaCommonsTransformationFactory.php b/code_samples/back_office/images/src/Connector/Dam/Transformation/WikimediaCommonsTransformationFactory.php index f900da52c3f..26260c305f0 100644 --- a/code_samples/back_office/images/src/Connector/Dam/Transformation/WikimediaCommonsTransformationFactory.php +++ b/code_samples/back_office/images/src/Connector/Dam/Transformation/WikimediaCommonsTransformationFactory.php @@ -8,8 +8,10 @@ class WikimediaCommonsTransformationFactory implements TransformationFactoryInterface { /** @param array $transformationParameters */ - public function build(?string $transformationName = null, array $transformationParameters = []): Transformation - { + public function build( + ?string $transformationName = null, + array $transformationParameters = [] + ): Transformation { if (null === $transformationName) { return new Transformation(null, array_map(strval(...), $transformationParameters)); } diff --git a/code_samples/back_office/images/src/SvgController.php b/code_samples/back_office/images/src/SvgController.php index 3d44e5b33b4..38b8076447b 100644 --- a/code_samples/back_office/images/src/SvgController.php +++ b/code_samples/back_office/images/src/SvgController.php @@ -5,6 +5,8 @@ namespace App\Controller; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\Values\Content\Field; use Ibexa\Core\Helper\TranslationHelper; use Ibexa\Core\IO\IOServiceInterface; @@ -22,12 +24,11 @@ public function __construct( private readonly ContentService $contentService, private readonly IOServiceInterface $ioService, private readonly TranslationHelper $translationHelper - ) { - } + ) {} /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws NotFoundException + * @throws UnauthorizedException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ public function downloadSvgAction( diff --git a/code_samples/back_office/images/src/SvgExtension.php b/code_samples/back_office/images/src/SvgExtension.php index 351661e476c..b89140786b9 100644 --- a/code_samples/back_office/images/src/SvgExtension.php +++ b/code_samples/back_office/images/src/SvgExtension.php @@ -12,13 +12,14 @@ class SvgExtension /** * SvgExtension constructor. */ - public function __construct(protected RouterInterface $router) - { - } + public function __construct(protected RouterInterface $router) {} #[AsTwigFunction(name: 'ibexa_svg_link')] - public function generateLink(int $contentId, string $fieldIdentifier, string $filename): string - { + public function generateLink( + int $contentId, + string $fieldIdentifier, + string $filename + ): string { return $this->router->generate('app.svg_download', [ 'contentId' => $contentId, 'fieldIdentifier' => $fieldIdentifier, diff --git a/code_samples/back_office/limitation/src/Controller/CustomLimitationController.php b/code_samples/back_office/limitation/src/Controller/CustomLimitationController.php index 1e4895d1179..c3f97fd67b2 100644 --- a/code_samples/back_office/limitation/src/Controller/CustomLimitationController.php +++ b/code_samples/back_office/limitation/src/Controller/CustomLimitationController.php @@ -17,8 +17,7 @@ public function __construct( // ..., private readonly PermissionResolver $permissionResolver, private readonly PermissionCheckerInterface $permissionChecker - ) { - } + ) {} // Controller actions... #[Route( diff --git a/code_samples/back_office/limitation/src/Kernel.php b/code_samples/back_office/limitation/src/Kernel.php index 954b6c2b9c5..43dc3f56325 100644 --- a/code_samples/back_office/limitation/src/Kernel.php +++ b/code_samples/back_office/limitation/src/Kernel.php @@ -6,6 +6,7 @@ use App\Security\FormPolicyProvider; use App\Security\MyPolicyProvider; +use Ibexa\Bundle\Core\DependencyInjection\IbexaCoreExtension; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Kernel as BaseKernel; @@ -17,7 +18,7 @@ class Kernel extends BaseKernel protected function build(ContainerBuilder $container): void { // Retrieve "ibexa" container extension - /** @var \Ibexa\Bundle\Core\DependencyInjection\IbexaCoreExtension $ibexaExtension */ + /** @var IbexaCoreExtension $ibexaExtension */ $ibexaExtension = $container->getExtension('ibexa'); // Add the policy provider, you can register multiple providers by calling the method repeatedly diff --git a/code_samples/back_office/limitation/src/Security/Form/FormSubmissionServiceDecorator.php b/code_samples/back_office/limitation/src/Security/Form/FormSubmissionServiceDecorator.php index cbdc39f4eb5..1b9efd5c75d 100644 --- a/code_samples/back_office/limitation/src/Security/Form/FormSubmissionServiceDecorator.php +++ b/code_samples/back_office/limitation/src/Security/Form/FormSubmissionServiceDecorator.php @@ -20,11 +20,14 @@ public function __construct( private readonly PermissionResolver $permissionResolver, private readonly ContentService $contentService, private readonly FormSubmissionGateway $gateway, - ) { - } - - public function create(ContentInfo $content, string $languageCode, Form $form, array $data): FormSubmission - { + ) {} + + public function create( + ContentInfo $content, + string $languageCode, + Form $form, + array $data + ): FormSubmission { return $this->innerService->create($content, $languageCode, $form, $data); } @@ -63,8 +66,12 @@ public function delete(FormSubmission $submission): void $this->innerService->delete($submission); } - public function loadByContent(ContentInfo $content, ?string $languageCode = null, int $offset = 0, int $limit = 25): FormSubmissionList - { + public function loadByContent( + ContentInfo $content, + ?string $languageCode = null, + int $offset = 0, + int $limit = 25 + ): FormSubmissionList { if (!$this->permissionResolver->canUser('form', 'read_submissions', $content)) { throw new UnauthorizedException('form', 'read_submissions', ['contentId' => $content->getId()]); } @@ -72,8 +79,10 @@ public function loadByContent(ContentInfo $content, ?string $languageCode = null return $this->innerService->loadByContent($content, $languageCode, $offset, $limit); } - public function loadAllByContentForExport(ContentInfo $content, ?string $languageCode = null): array - { + public function loadAllByContentForExport( + ContentInfo $content, + ?string $languageCode = null + ): array { if (!$this->permissionResolver->canUser('form', 'read_submissions', $content)) { throw new UnauthorizedException('form', 'read_submissions', ['contentId' => $content->getId()]); } @@ -81,8 +90,10 @@ public function loadAllByContentForExport(ContentInfo $content, ?string $languag return $this->innerService->loadAllByContentForExport($content, $languageCode); } - public function loadHeaders(ContentInfo $content, ?string $languageCode = null): array - { + public function loadHeaders( + ContentInfo $content, + ?string $languageCode = null + ): array { if (!$this->permissionResolver->canUser('form', 'read_submissions', $content)) { throw new UnauthorizedException('form', 'read_submissions', ['contentId' => $content->getId()]); } @@ -90,8 +101,10 @@ public function loadHeaders(ContentInfo $content, ?string $languageCode = null): return $this->innerService->loadHeaders($content, $languageCode); } - public function getCount(ContentInfo $content, ?string $languageCode = null): int - { + public function getCount( + ContentInfo $content, + ?string $languageCode = null + ): int { if (!$this->permissionResolver->canUser('form', 'read_submissions', $content)) { throw new UnauthorizedException('form', 'read_submissions', ['contentId' => $content->getId()]); } diff --git a/code_samples/back_office/limitation/src/Security/Form/FormSubmissionsTabDecorator.php b/code_samples/back_office/limitation/src/Security/Form/FormSubmissionsTabDecorator.php index ea0f249f8fb..9ec4fc389cd 100644 --- a/code_samples/back_office/limitation/src/Security/Form/FormSubmissionsTabDecorator.php +++ b/code_samples/back_office/limitation/src/Security/Form/FormSubmissionsTabDecorator.php @@ -8,6 +8,7 @@ use Ibexa\Contracts\Core\Repository\ContentTypeService; use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\Repository\PermissionResolver; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Contracts\FormBuilder\FormSubmission\FormSubmissionServiceInterface; use Ibexa\FormBuilder\FieldType\FormFactory; @@ -30,7 +31,17 @@ public function __construct( private readonly SubmissionsTab $innerTab, private readonly PermissionResolver $permissionResolver ) { - parent::__construct($twig, $translator, $formSubmissionService, $formFactory, $contentTypeService, $languageService, $formBuilderType, $configResolver); + parent::__construct( + $twig, + $translator, + $formSubmissionService, + $formFactory, + $contentTypeService, + $languageService, + $formBuilderType, + $configResolver, + $permissionResolver + ); } #[\Override] @@ -54,7 +65,7 @@ public function renderView(array $parameters): string #[\Override] public function evaluate(array $parameters): bool { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ $content = $parameters['content']; return $this->innerTab->evaluate($parameters) && @@ -64,6 +75,6 @@ public function evaluate(array $parameters): bool #[\Override] public function getOrder(): int { - return $this->innerTab->getOrder(); + return $this->innerTab->getOrder(); } } diff --git a/code_samples/back_office/limitation/src/Security/FormPolicyProvider.php b/code_samples/back_office/limitation/src/Security/FormPolicyProvider.php index 4396cfe02c8..a8221ec71e0 100644 --- a/code_samples/back_office/limitation/src/Security/FormPolicyProvider.php +++ b/code_samples/back_office/limitation/src/Security/FormPolicyProvider.php @@ -21,9 +21,9 @@ public function addPolicies(ConfigBuilderInterface $configBuilder): void public static function getTranslationMessages(): array { return [ - (new Message('role.policy.form', 'forms'))->setDesc('Forms'), - (new Message('role.policy.form.all_functions', 'forms'))->setDesc('Forms / All functions'), - (new Message('role.policy.form.read_submissions', 'forms'))->setDesc('Forms / Read submissions'), + new Message('role.policy.form', 'forms')->setDesc('Forms'), + new Message('role.policy.form.all_functions', 'forms')->setDesc('Forms / All functions'), + new Message('role.policy.form.read_submissions', 'forms')->setDesc('Forms / Read submissions'), ]; } } diff --git a/code_samples/back_office/limitation/src/Security/Limitation/CustomLimitationType.php b/code_samples/back_office/limitation/src/Security/Limitation/CustomLimitationType.php index cb31e875009..c2b013d1de7 100644 --- a/code_samples/back_office/limitation/src/Security/Limitation/CustomLimitationType.php +++ b/code_samples/back_office/limitation/src/Security/Limitation/CustomLimitationType.php @@ -9,6 +9,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Contracts\Core\Repository\Values\User\Limitation; use Ibexa\Contracts\Core\Repository\Values\User\UserReference; +use Ibexa\Contracts\Core\Repository\Values\ValueObject; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; use Ibexa\Core\Base\Exceptions\InvalidArgumentType; use Ibexa\Core\FieldType\ValidationError; @@ -52,12 +53,16 @@ public function buildValue(array $limitationValues): CustomLimitationValue } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ValueObject[]|null $targets + * @param ValueObject[]|null $targets * * @return bool|null */ - public function evaluate(Limitation $value, UserReference $currentUser, object $object, ?array $targets = null): ?bool - { + public function evaluate( + Limitation $value, + UserReference $currentUser, + object $object, + ?array $targets = null + ): ?bool { if (!$value instanceof CustomLimitationValue) { throw new InvalidArgumentException('$value', 'Must be of type: CustomLimitationValue'); } @@ -70,8 +75,10 @@ public function evaluate(Limitation $value, UserReference $currentUser, object $ return Type::ACCESS_DENIED; } - public function getCriterion(Limitation $value, UserReference $currentUser): CriterionInterface - { + public function getCriterion( + Limitation $value, + UserReference $currentUser + ): CriterionInterface { throw new NotImplementedException(__METHOD__); } diff --git a/code_samples/back_office/limitation/src/Security/Limitation/Mapper/CustomLimitationFormMapper.php b/code_samples/back_office/limitation/src/Security/Limitation/Mapper/CustomLimitationFormMapper.php index 49e03c0c1e2..30e01f63178 100644 --- a/code_samples/back_office/limitation/src/Security/Limitation/Mapper/CustomLimitationFormMapper.php +++ b/code_samples/back_office/limitation/src/Security/Limitation/Mapper/CustomLimitationFormMapper.php @@ -12,8 +12,10 @@ class CustomLimitationFormMapper implements LimitationFormMapperInterface { - public function mapLimitationForm(FormInterface $form, Limitation $data): void - { + public function mapLimitationForm( + FormInterface $form, + Limitation $data + ): void { $form->add('limitationValues', CheckboxType::class, [ 'label' => LimitationIdentifierToLabelConverter::convert($data->getIdentifier()), 'required' => false, @@ -27,7 +29,5 @@ public function getFormTemplate(): string return '@ibexadesign/limitation/custom_limitation_form.html.twig'; } - public function filterLimitationValues(Limitation $limitation): void - { - } + public function filterLimitationValues(Limitation $limitation): void {} } diff --git a/code_samples/back_office/menu/menu_item/src/Controller/AllContentListController.php b/code_samples/back_office/menu/menu_item/src/Controller/AllContentListController.php index dd07d01498a..0fc3d7ca496 100644 --- a/code_samples/back_office/menu/menu_item/src/Controller/AllContentListController.php +++ b/code_samples/back_office/menu/menu_item/src/Controller/AllContentListController.php @@ -16,8 +16,7 @@ class AllContentListController extends Controller public function __construct( private readonly SearchService $searchService, private readonly FormFactory $formFactory - ) { - } + ) {} public function listAction(int $page = 1): Response { diff --git a/code_samples/back_office/menu/menu_item/src/EventSubscriber/HelpMenuSubscriber.php b/code_samples/back_office/menu/menu_item/src/EventSubscriber/HelpMenuSubscriber.php index 7a97326ba6c..01e374efefe 100644 --- a/code_samples/back_office/menu/menu_item/src/EventSubscriber/HelpMenuSubscriber.php +++ b/code_samples/back_office/menu/menu_item/src/EventSubscriber/HelpMenuSubscriber.php @@ -11,8 +11,7 @@ { public function __construct( private bool $kernelDebug - ) { - } + ) {} public static function getSubscribedEvents(): array { diff --git a/code_samples/back_office/notifications/src/EventListener/ContentPublishEventListener.php b/code_samples/back_office/notifications/src/EventListener/ContentPublishEventListener.php index c1447f80ba0..8a153f58f51 100644 --- a/code_samples/back_office/notifications/src/EventListener/ContentPublishEventListener.php +++ b/code_samples/back_office/notifications/src/EventListener/ContentPublishEventListener.php @@ -9,9 +9,7 @@ final readonly class ContentPublishEventListener implements EventSubscriberInterface { - public function __construct(private NotificationService $notificationService) - { - } + public function __construct(private NotificationService $notificationService) {} public static function getSubscribedEvents(): array { diff --git a/code_samples/back_office/notifications/src/Notification/ListRenderer.php b/code_samples/back_office/notifications/src/Notification/ListRenderer.php index 4c7153a5820..dfd097be618 100644 --- a/code_samples/back_office/notifications/src/Notification/ListRenderer.php +++ b/code_samples/back_office/notifications/src/Notification/ListRenderer.php @@ -13,9 +13,11 @@ class ListRenderer implements NotificationRenderer, TypedNotificationRendererInterface { - public function __construct(protected Environment $twig, protected RouterInterface $router, protected RequestStack $requestStack) - { - } + public function __construct( + protected Environment $twig, + protected RouterInterface $router, + protected RequestStack $requestStack + ) {} public function render(Notification $notification): string { diff --git a/code_samples/back_office/notifications/src/Notification/MyRenderer.php b/code_samples/back_office/notifications/src/Notification/MyRenderer.php index 0c2d38ccd45..5abe1a38e87 100644 --- a/code_samples/back_office/notifications/src/Notification/MyRenderer.php +++ b/code_samples/back_office/notifications/src/Notification/MyRenderer.php @@ -15,8 +15,7 @@ class MyRenderer implements NotificationRenderer, TypedNotificationRendererInter public function __construct( protected Environment $twig, protected RouterInterface $router - ) { - } + ) {} public function render(Notification $notification): string { diff --git a/code_samples/back_office/online_editor/src/event/subscriber/RichTextBlockSubscriber.php b/code_samples/back_office/online_editor/src/event/subscriber/RichTextBlockSubscriber.php index 924e92ea452..6f052c3a607 100644 --- a/code_samples/back_office/online_editor/src/event/subscriber/RichTextBlockSubscriber.php +++ b/code_samples/back_office/online_editor/src/event/subscriber/RichTextBlockSubscriber.php @@ -13,11 +13,9 @@ class RichTextBlockSubscriber implements EventSubscriberInterface { /** - * @param \Ibexa\FieldTypeRichText\RichText\DOMDocumentFactory $domDocumentFactory + * @param DOMDocumentFactory $domDocumentFactory */ - public function __construct(private readonly DOMDocumentFactory $domDocumentFactory) - { - } + public function __construct(private readonly DOMDocumentFactory $domDocumentFactory) {} /** * {@inheritdoc} @@ -30,7 +28,7 @@ public static function getSubscribedEvents(): array } /** - * @param \Ibexa\FieldTypePage\FieldType\Page\Block\Renderer\Event\PreRenderEvent $event + * @param PreRenderEvent $event */ public function onBlockPreRender(PreRenderEvent $event): void { diff --git a/code_samples/back_office/product_tour/src/EventSubscriber/NotificationScenarioSubscriber.php b/code_samples/back_office/product_tour/src/EventSubscriber/NotificationScenarioSubscriber.php index 78ae51c261b..edeb298b811 100644 --- a/code_samples/back_office/product_tour/src/EventSubscriber/NotificationScenarioSubscriber.php +++ b/code_samples/back_office/product_tour/src/EventSubscriber/NotificationScenarioSubscriber.php @@ -13,9 +13,7 @@ final readonly class NotificationScenarioSubscriber implements EventSubscriberInterface { - public function __construct(private NotificationService $notificationService) - { - } + public function __construct(private NotificationService $notificationService) {} public static function getSubscribedEvents(): array { diff --git a/code_samples/back_office/search/src/EventSubscriber/MySuggestionEventSubscriber.php b/code_samples/back_office/search/src/EventSubscriber/MySuggestionEventSubscriber.php index 05fe585da86..22c68d56cce 100644 --- a/code_samples/back_office/search/src/EventSubscriber/MySuggestionEventSubscriber.php +++ b/code_samples/back_office/search/src/EventSubscriber/MySuggestionEventSubscriber.php @@ -7,6 +7,8 @@ use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; use Ibexa\Contracts\Search\Event\BuildSuggestionCollectionEvent; +use Ibexa\Contracts\Search\Model\Suggestion\ContentSuggestion; +use Ibexa\ProductCatalog\Local\Repository\Values\Product; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -15,9 +17,7 @@ class MySuggestionEventSubscriber implements EventSubscriberInterface, LoggerAwa { use LoggerAwareTrait; - public function __construct(private ProductServiceInterface $productService) - { - } + public function __construct(private ProductServiceInterface $productService) {} public static function getSubscribedEvents(): array { @@ -46,13 +46,13 @@ public function onBuildSuggestionCollectionEvent(BuildSuggestionCollectionEvent if ($searchResult->getTotalCount()) { $maxScore = 0.0; $suggestionsByContentIds = []; - /** @var \Ibexa\Contracts\Search\Model\Suggestion\ContentSuggestion $suggestion */ + /** @var ContentSuggestion $suggestion */ foreach ($suggestionCollection as $suggestion) { $maxScore = max($suggestion->getScore(), $maxScore); $suggestionsByContentIds[$suggestion->getContent()->id] = $suggestion; } - /** @var \Ibexa\ProductCatalog\Local\Repository\Values\Product $product */ + /** @var Product $product */ foreach ($searchResult as $product) { $contentId = $product->getContent()->id; if (array_key_exists($contentId, $suggestionsByContentIds)) { diff --git a/code_samples/back_office/search/src/Query/DateTimeAttributeQuery.php b/code_samples/back_office/search/src/Query/DateTimeAttributeQuery.php index adde49a43ea..89ffb7d420a 100644 --- a/code_samples/back_office/search/src/Query/DateTimeAttributeQuery.php +++ b/code_samples/back_office/search/src/Query/DateTimeAttributeQuery.php @@ -2,6 +2,7 @@ use DateTimeImmutable; use Ibexa\Contracts\CoreSearch\Values\Query\Criterion\FieldValueCriterion; +use Ibexa\Contracts\ProductCatalog\ProductServiceInterface; use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; use Ibexa\Contracts\ProductCatalogDateTimeAttribute\Search\Criterion\DateTimeAttribute; @@ -9,5 +10,5 @@ $filter = new DateTimeAttribute('event_date', new DateTimeImmutable('2025-07-06')); $filter->setOperator(FieldValueCriterion::COMPARISON_EQ); $query->setFilter($filter); -/** @var \Ibexa\Contracts\ProductCatalog\ProductServiceInterface $productService */ +/** @var ProductServiceInterface $productService */ $results = $productService->findProducts($query); diff --git a/code_samples/back_office/search/src/Query/DateTimeAttributeRangeQuery.php b/code_samples/back_office/search/src/Query/DateTimeAttributeRangeQuery.php index f8016aa3773..c91b9863b67 100644 --- a/code_samples/back_office/search/src/Query/DateTimeAttributeRangeQuery.php +++ b/code_samples/back_office/search/src/Query/DateTimeAttributeRangeQuery.php @@ -1,10 +1,11 @@ setFilter(new DateTimeAttributeRange('event_date', new DateTimeImmutable('2025-01-01'))); -/** @var \Ibexa\Contracts\ProductCatalog\ProductServiceInterface $productService */ +/** @var ProductServiceInterface $productService */ $results = $productService->findProducts($query); diff --git a/code_samples/back_office/search/src/Query/ProductCategorySubtreeQuery.php b/code_samples/back_office/search/src/Query/ProductCategorySubtreeQuery.php index d050f96bed3..a4dad8ae90b 100644 --- a/code_samples/back_office/search/src/Query/ProductCategorySubtreeQuery.php +++ b/code_samples/back_office/search/src/Query/ProductCategorySubtreeQuery.php @@ -1,12 +1,13 @@ setQuery($criteria); $results = $productService->findProducts($productQuery); diff --git a/code_samples/back_office/search/src/Query/SymbolAttributeTypeQuery.php b/code_samples/back_office/search/src/Query/SymbolAttributeTypeQuery.php index 2c449d97b85..046d20f5681 100644 --- a/code_samples/back_office/search/src/Query/SymbolAttributeTypeQuery.php +++ b/code_samples/back_office/search/src/Query/SymbolAttributeTypeQuery.php @@ -1,9 +1,10 @@ setFilter(new SymbolAttribute('ean', ['5023920187205'])); -/** @var \Ibexa\Contracts\ProductCatalog\ProductServiceInterface $productService */ +/** @var ProductServiceInterface $productService */ $results = $productService->findProducts($query); diff --git a/code_samples/back_office/search/src/Query/UpdatedAtQuery.php b/code_samples/back_office/search/src/Query/UpdatedAtQuery.php index e30aeecc407..fdf241ebf18 100644 --- a/code_samples/back_office/search/src/Query/UpdatedAtQuery.php +++ b/code_samples/back_office/search/src/Query/UpdatedAtQuery.php @@ -1,6 +1,7 @@ setQuery($criteria); $results = $productService->findProducts($productQuery); diff --git a/code_samples/back_office/search/src/Query/UpdatedAtRangeQuery.php b/code_samples/back_office/search/src/Query/UpdatedAtRangeQuery.php index 49c5461ecb7..dc8435f80b7 100644 --- a/code_samples/back_office/search/src/Query/UpdatedAtRangeQuery.php +++ b/code_samples/back_office/search/src/Query/UpdatedAtRangeQuery.php @@ -1,6 +1,7 @@ setQuery($criteria); $results = $productService->findProducts($productQuery); diff --git a/code_samples/back_office/search/src/Search/Serializer/Normalizer/Suggestion/ProductSuggestionNormalizer.php b/code_samples/back_office/search/src/Search/Serializer/Normalizer/Suggestion/ProductSuggestionNormalizer.php index 8291280647c..7dd644361e0 100644 --- a/code_samples/back_office/search/src/Search/Serializer/Normalizer/Suggestion/ProductSuggestionNormalizer.php +++ b/code_samples/back_office/search/src/Search/Serializer/Normalizer/Suggestion/ProductSuggestionNormalizer.php @@ -16,9 +16,12 @@ class ProductSuggestionNormalizer implements /** * @return array */ - public function normalize($object, ?string $format = null, array $context = []): array - { - /** @var \App\Search\Model\Suggestion\ProductSuggestion $object */ + public function normalize( + $object, + ?string $format = null, + array $context = [] + ): array { + /** @var ProductSuggestion $object */ return [ 'type' => 'product', 'name' => $object->getName(), @@ -28,8 +31,11 @@ public function normalize($object, ?string $format = null, array $context = []): ]; } - public function supportsNormalization($data, ?string $format = null, array $context = []): bool - { + public function supportsNormalization( + $data, + ?string $format = null, + array $context = [] + ): bool { return $data instanceof ProductSuggestion; } diff --git a/code_samples/back_office/search/src/Search/SortingDefinition/Provider/SectionNameSortingDefinitionProvider.php b/code_samples/back_office/search/src/Search/SortingDefinition/Provider/SectionNameSortingDefinitionProvider.php index 82db0c90ef5..47c410be8b2 100644 --- a/code_samples/back_office/search/src/Search/SortingDefinition/Provider/SectionNameSortingDefinitionProvider.php +++ b/code_samples/back_office/search/src/Search/SortingDefinition/Provider/SectionNameSortingDefinitionProvider.php @@ -12,9 +12,7 @@ final readonly class SectionNameSortingDefinitionProvider implements SortingDefinitionProviderInterface, TranslationContainerInterface { - public function __construct(private TranslatorInterface $translator) - { - } + public function __construct(private TranslatorInterface $translator) {} public function getSortingDefinitions(): array { @@ -41,8 +39,8 @@ public function getSortingDefinitions(): array public static function getTranslationMessages(): array { return [ - (new Message('sort_definition.section_name_asc.label'))->setDesc('Sort by section A-Z'), - (new Message('sort_definition.section_name_desc.label'))->setDesc('Sort by section Z-A'), + new Message('sort_definition.section_name_asc.label')->setDesc('Sort by section A-Z'), + new Message('sort_definition.section_name_desc.label')->setDesc('Sort by section Z-A'), ]; } } diff --git a/code_samples/back_office/settings/src/Setting/Unit.php b/code_samples/back_office/settings/src/Setting/Unit.php index dd524ccf857..8dd82ea7add 100644 --- a/code_samples/back_office/settings/src/Setting/Unit.php +++ b/code_samples/back_office/settings/src/Setting/Unit.php @@ -40,8 +40,10 @@ public function getDefaultValue(): string return 'metric'; } - public function mapFieldForm(FormBuilderInterface $formBuilder, ValueDefinitionInterface $value): FormBuilderInterface - { + public function mapFieldForm( + FormBuilderInterface $formBuilder, + ValueDefinitionInterface $value + ): FormBuilderInterface { $choices = [ 'Metric' => self::METRIC_OPTION, 'Imperial' => self::IMPERIAL_OPTION, diff --git a/code_samples/back_office/thumbnails/src/Strategy/StaticThumbnailStrategy.php b/code_samples/back_office/thumbnails/src/Strategy/StaticThumbnailStrategy.php index a9e7b350b76..70beaca6236 100644 --- a/code_samples/back_office/thumbnails/src/Strategy/StaticThumbnailStrategy.php +++ b/code_samples/back_office/thumbnails/src/Strategy/StaticThumbnailStrategy.php @@ -11,12 +11,13 @@ final readonly class StaticThumbnailStrategy implements ThumbnailStrategy { - public function __construct(private string $staticThumbnail) - { - } + public function __construct(private string $staticThumbnail) {} - public function getThumbnail(ContentType $contentType, array $fields, ?VersionInfo $versionInfo = null): Thumbnail - { + public function getThumbnail( + ContentType $contentType, + array $fields, + ?VersionInfo $versionInfo = null + ): Thumbnail { return new Thumbnail([ 'resource' => $this->staticThumbnail, ]); diff --git a/code_samples/cache/http_cache/src/response_tagging.php b/code_samples/cache/http_cache/src/response_tagging.php index c8c8fe2e64d..b4c8ae877cc 100644 --- a/code_samples/cache/http_cache/src/response_tagging.php +++ b/code_samples/cache/http_cache/src/response_tagging.php @@ -1,11 +1,16 @@ tag($view); // When working with a view -/** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ +/** @var Content $content */ $responseTagger->tag($content->getContentInfo()); // When working with a content item -/** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ +/** @var Location $location */ $responseTagger->tag($location); // When working with a location diff --git a/code_samples/catalog/custom_attribute_type/src/Attribute/Percent/PercentAttributeOptionsType.php b/code_samples/catalog/custom_attribute_type/src/Attribute/Percent/PercentAttributeOptionsType.php index 558f3d67434..68deb4c2494 100644 --- a/code_samples/catalog/custom_attribute_type/src/Attribute/Percent/PercentAttributeOptionsType.php +++ b/code_samples/catalog/custom_attribute_type/src/Attribute/Percent/PercentAttributeOptionsType.php @@ -11,8 +11,10 @@ final class PercentAttributeOptionsType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder->add('min', PercentType::class, [ 'disabled' => $options['translation_mode'], 'label' => 'Minimum Value', diff --git a/code_samples/catalog/custom_attribute_type/src/Attribute/Percent/PercentOptionsFormMapper.php b/code_samples/catalog/custom_attribute_type/src/Attribute/Percent/PercentOptionsFormMapper.php index 0f55a2580c2..210cfbec351 100644 --- a/code_samples/catalog/custom_attribute_type/src/Attribute/Percent/PercentOptionsFormMapper.php +++ b/code_samples/catalog/custom_attribute_type/src/Attribute/Percent/PercentOptionsFormMapper.php @@ -10,8 +10,11 @@ final class PercentOptionsFormMapper implements OptionsFormMapperInterface { - public function createOptionsForm(string $name, FormBuilderInterface $builder, array $context = []): void - { + public function createOptionsForm( + string $name, + FormBuilderInterface $builder, + array $context = [] + ): void { $builder->add($name, PercentAttributeOptionsType::class, [ 'constraints' => [ new AttributeDefinitionOptions($context['type']), diff --git a/code_samples/catalog/custom_attribute_type/src/Attribute/Percent/PercentValueFormatter.php b/code_samples/catalog/custom_attribute_type/src/Attribute/Percent/PercentValueFormatter.php index b15ffd5f5a2..19d245dbd19 100644 --- a/code_samples/catalog/custom_attribute_type/src/Attribute/Percent/PercentValueFormatter.php +++ b/code_samples/catalog/custom_attribute_type/src/Attribute/Percent/PercentValueFormatter.php @@ -10,8 +10,10 @@ final class PercentValueFormatter implements ValueFormatterInterface { - public function formatValue(AttributeInterface $attribute, array $parameters = []): ?string - { + public function formatValue( + AttributeInterface $attribute, + array $parameters = [] + ): ?string { $value = $attribute->getValue(); if ($value === null) { return null; diff --git a/code_samples/catalog/custom_attribute_type/src/Attribute/Percent/PercentValueValidator.php b/code_samples/catalog/custom_attribute_type/src/Attribute/Percent/PercentValueValidator.php index ad784b00331..835da433667 100644 --- a/code_samples/catalog/custom_attribute_type/src/Attribute/Percent/PercentValueValidator.php +++ b/code_samples/catalog/custom_attribute_type/src/Attribute/Percent/PercentValueValidator.php @@ -10,8 +10,10 @@ final class PercentValueValidator implements ValueValidatorInterface { - public function validateValue(AttributeDefinitionInterface $attributeDefinition, $value): iterable - { + public function validateValue( + AttributeDefinitionInterface $attributeDefinition, + $value + ): iterable { if ($value === null) { return []; } diff --git a/code_samples/catalog/custom_catalog_filter/src/CatalogFilter/ProductNameFilterFormMapper.php b/code_samples/catalog/custom_catalog_filter/src/CatalogFilter/ProductNameFilterFormMapper.php index 21c36d85b08..51d10d4b0e5 100644 --- a/code_samples/catalog/custom_catalog_filter/src/CatalogFilter/ProductNameFilterFormMapper.php +++ b/code_samples/catalog/custom_catalog_filter/src/CatalogFilter/ProductNameFilterFormMapper.php @@ -11,9 +11,7 @@ final class ProductNameFilterFormMapper implements FilterFormMapperInterface { - public function __construct() - { - } + public function __construct() {} public function createFilterForm( FilterDefinitionInterface $filterDefinition, diff --git a/code_samples/catalog/percent_name_schema_strategy/NameSchema/PercentNameSchemaStrategy.php b/code_samples/catalog/percent_name_schema_strategy/NameSchema/PercentNameSchemaStrategy.php index d567d474d3b..958c0426d0f 100644 --- a/code_samples/catalog/percent_name_schema_strategy/NameSchema/PercentNameSchemaStrategy.php +++ b/code_samples/catalog/percent_name_schema_strategy/NameSchema/PercentNameSchemaStrategy.php @@ -7,13 +7,18 @@ final class PercentNameSchemaStrategy implements NameSchemaStrategyInterface { - public function resolve(AttributeDefinitionInterface $attributeDefinition, $value, string $languageCode): string - { + public function resolve( + AttributeDefinitionInterface $attributeDefinition, + $value, + string $languageCode + ): string { return ($value * 100) . '%'; } - public function supports(AttributeDefinitionInterface $attributeDefinition, $value): bool - { + public function supports( + AttributeDefinitionInterface $attributeDefinition, + $value + ): bool { return $attributeDefinition->getType()->getIdentifier() === 'percent'; } } diff --git a/code_samples/collaboration/src/Collaboration/Cart/CartResolverDecorator.php b/code_samples/collaboration/src/Collaboration/Cart/CartResolverDecorator.php index e4b3f1d664c..e5edf08092f 100644 --- a/code_samples/collaboration/src/Collaboration/Cart/CartResolverDecorator.php +++ b/code_samples/collaboration/src/Collaboration/Cart/CartResolverDecorator.php @@ -16,8 +16,7 @@ public function __construct( private CartResolverInterface $innerCartResolver, private SessionServiceInterface $sessionService, private RequestStack $requestStack - ) { - } + ) {} public function resolveCart(?User $user = null): CartInterface { @@ -40,7 +39,7 @@ private function getSharedCart(): ?CartInterface } return $session->getCart(); - } catch (NotFoundException|UnauthorizedException) { + } catch (NotFoundException | UnauthorizedException) { return null; } } diff --git a/code_samples/collaboration/src/Collaboration/Cart/Mapper/CartProxyMapper.php b/code_samples/collaboration/src/Collaboration/Cart/Mapper/CartProxyMapper.php index 8e719eba26f..dd8e7000c80 100644 --- a/code_samples/collaboration/src/Collaboration/Cart/Mapper/CartProxyMapper.php +++ b/code_samples/collaboration/src/Collaboration/Cart/Mapper/CartProxyMapper.php @@ -14,8 +14,7 @@ public function __construct( private Repository $repository, private CartServiceInterface $cartService, private ProxyGeneratorInterface $proxyGenerator - ) { - } + ) {} public function createCartProxy(string $identifier): CartInterface { diff --git a/code_samples/collaboration/src/Collaboration/Cart/Mapper/CartSessionDomainMapper.php b/code_samples/collaboration/src/Collaboration/Cart/Mapper/CartSessionDomainMapper.php index 8f8a51ddb15..ab1dea1603d 100644 --- a/code_samples/collaboration/src/Collaboration/Cart/Mapper/CartSessionDomainMapper.php +++ b/code_samples/collaboration/src/Collaboration/Cart/Mapper/CartSessionDomainMapper.php @@ -20,8 +20,7 @@ public function __construct( private CartProxyMapperInterface $cartProxyMapper, private UserProxyDomainMapperInterface $userDomainMapper, private ParticipantCollectionDomainMapperInterface $participantCollectionDomainMapper - ) { - } + ) {} /** * @param \App\Collaboration\Cart\Persistence\Values\CartSession $data diff --git a/code_samples/collaboration/src/Collaboration/Cart/PermissionResolverDecorator.php b/code_samples/collaboration/src/Collaboration/Cart/PermissionResolverDecorator.php index 8aba2621ecb..37528daa7f7 100644 --- a/code_samples/collaboration/src/Collaboration/Cart/PermissionResolverDecorator.php +++ b/code_samples/collaboration/src/Collaboration/Cart/PermissionResolverDecorator.php @@ -22,8 +22,7 @@ public function __construct( private readonly PermissionResolverInterface $innerPermissionResolver, private readonly SessionServiceInterface $sessionService, private readonly RequestStack $requestStack, - ) { - } + ) {} public function canUser(PolicyInterface $policy): bool { @@ -59,7 +58,7 @@ private function isSharedCart(?CartInterface $cart): bool try { $this->nested = true; - /** @var \App\Collaboration\Cart\CartSession $session */ + /** @var CartSession $session */ $session = $this->getCurrentCartCollaborationSession(); if ($session !== null) { try { @@ -86,7 +85,7 @@ private function getCurrentCartCollaborationSession(): ?CartSession if ($session instanceof CartSession) { return $session; } - } catch (NotFoundException|UnauthorizedException) { + } catch (NotFoundException | UnauthorizedException) { } return null; diff --git a/code_samples/collaboration/src/Collaboration/Cart/Persistence/Gateway/DatabaseGateway.php b/code_samples/collaboration/src/Collaboration/Cart/Persistence/Gateway/DatabaseGateway.php index 8ecca9a74b4..e9019391d82 100644 --- a/code_samples/collaboration/src/Collaboration/Cart/Persistence/Gateway/DatabaseGateway.php +++ b/code_samples/collaboration/src/Collaboration/Cart/Persistence/Gateway/DatabaseGateway.php @@ -2,6 +2,7 @@ namespace App\Collaboration\Cart\Persistence\Gateway; +use App\Collaboration\Cart\Persistence\Values\CartSessionCreateStruct; use App\Collaboration\Cart\Persistence\Values\CartSessionCreateStruct as CreateStruct; use App\Collaboration\Cart\Persistence\Values\CartSessionUpdateStruct as UpdateStruct; use Doctrine\DBAL\Types\Types; @@ -51,10 +52,12 @@ public function getDiscriminator(): string } /** - * @param \App\Collaboration\Cart\Persistence\Values\CartSessionCreateStruct $createStruct + * @param CartSessionCreateStruct $createStruct */ - public function create(int $sessionId, AbstractSessionCreateStruct $createStruct): void - { + public function create( + int $sessionId, + AbstractSessionCreateStruct $createStruct + ): void { $this->doInsert([ DatabaseSchema::COLUMN_ID => $sessionId, DatabaseSchema::COLUMN_CART_IDENTIFIER => $createStruct->getCartIdentifier(), @@ -62,7 +65,7 @@ public function create(int $sessionId, AbstractSessionCreateStruct $createStruct } /** - * @param \Ibexa\Collaboration\Persistence\Values\AbstractSessionUpdateStruct $updateStruct + * @param AbstractSessionUpdateStruct $updateStruct */ public function update(AbstractSessionUpdateStruct $updateStruct): void { diff --git a/code_samples/collaboration/src/Command/ManageSessionsCommand.php b/code_samples/collaboration/src/Command/ManageSessionsCommand.php index e50ac513330..ae2590dfdba 100644 --- a/code_samples/collaboration/src/Command/ManageSessionsCommand.php +++ b/code_samples/collaboration/src/Command/ManageSessionsCommand.php @@ -38,8 +38,10 @@ public function __construct( parent::__construct(); } - public function execute(InputInterface $input, OutputInterface $output): int - { + public function execute( + InputInterface $input, + OutputInterface $output + ): int { $this->permissionResolver->setCurrentUserReference( $this->userService->loadUserByLogin('admin') ); diff --git a/code_samples/collaboration/src/Controller/ShareCartCreateController.php b/code_samples/collaboration/src/Controller/ShareCartCreateController.php index b0b612eba4a..85f4939e49f 100644 --- a/code_samples/collaboration/src/Controller/ShareCartCreateController.php +++ b/code_samples/collaboration/src/Controller/ShareCartCreateController.php @@ -4,6 +4,7 @@ use App\Collaboration\Cart\CartSessionCreateStruct; use App\Collaboration\Cart\CartSessionType; +use App\Form\Data\ShareCartData; use App\Form\Type\ShareCartType; use Ibexa\Contracts\Cart\CartResolverInterface; use Ibexa\Contracts\Collaboration\Participant\ExternalParticipantCreateStruct; @@ -22,8 +23,7 @@ final class ShareCartCreateController extends AbstractController public function __construct( private readonly SessionServiceInterface $sessionService, private readonly CartResolverInterface $cartResolver - ) { - } + ) {} public function __invoke(Request $request): Response { @@ -37,7 +37,7 @@ public function __invoke(Request $request): Response $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - /** @var \App\Form\Data\ShareCartData $data */ + /** @var ShareCartData $data */ $data = $form->getData(); // Handle the form submission diff --git a/code_samples/collaboration/src/Controller/ShareCartJoinController.php b/code_samples/collaboration/src/Controller/ShareCartJoinController.php index 4c9ecc209b9..1580b27deb9 100644 --- a/code_samples/collaboration/src/Controller/ShareCartJoinController.php +++ b/code_samples/collaboration/src/Controller/ShareCartJoinController.php @@ -18,11 +18,12 @@ final class ShareCartJoinController extends AbstractController public function __construct( private readonly SessionServiceInterface $sessionService, - ) { - } + ) {} - public function __invoke(Request $request, string $token): RedirectResponse - { + public function __invoke( + Request $request, + string $token + ): RedirectResponse { $session = $this->sessionService->getSessionByToken($token); if ($session instanceof CartSession) { $request->getSession()->set(self::CURRENT_COLLABORATION_SESSION, $session->getToken()); diff --git a/code_samples/collaboration/src/Form/Data/ShareCartData.php b/code_samples/collaboration/src/Form/Data/ShareCartData.php index 37c2e0cc2c0..38391c76e4f 100644 --- a/code_samples/collaboration/src/Form/Data/ShareCartData.php +++ b/code_samples/collaboration/src/Form/Data/ShareCartData.php @@ -6,8 +6,7 @@ final class ShareCartData { public function __construct( private ?string $email = null - ) { - } + ) {} public function getEmail(): ?string { diff --git a/code_samples/collaboration/src/Form/Type/ShareCartType.php b/code_samples/collaboration/src/Form/Type/ShareCartType.php index 86f2369bcbb..2fe7844af55 100644 --- a/code_samples/collaboration/src/Form/Type/ShareCartType.php +++ b/code_samples/collaboration/src/Form/Type/ShareCartType.php @@ -14,8 +14,10 @@ */ final class ShareCartType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder->add('email', EmailType::class, [ 'label' => 'E-mail', ])->add('submit', SubmitType::class, [ diff --git a/code_samples/collaboration/src/Query/Search.php b/code_samples/collaboration/src/Query/Search.php index b4f7dfbabca..8592b7430b2 100644 --- a/code_samples/collaboration/src/Query/Search.php +++ b/code_samples/collaboration/src/Query/Search.php @@ -3,6 +3,7 @@ use Ibexa\Contracts\Collaboration\Session\Query\Criterion; use Ibexa\Contracts\Collaboration\Session\Query\SortClause; use Ibexa\Contracts\Collaboration\Session\SessionQuery; +use Ibexa\Contracts\Collaboration\SessionServiceInterface; use Ibexa\Contracts\CoreSearch\Values\Query\Criterion\FieldValueCriterion; use Ibexa\Contracts\CoreSearch\Values\Query\SortClause\FieldValueSortClause; @@ -17,5 +18,5 @@ new SortClause\CreatedAt(FieldValueSortClause::SORT_DESC), ] ); -/** @var \Ibexa\Contracts\Collaboration\SessionServiceInterface $sessionService */ +/** @var SessionServiceInterface $sessionService */ $sessionList = $sessionService->findSessions($query); diff --git a/code_samples/customer_portal/src/Corporate/EventSubscriber/ApplicationDetailsViewSubscriber.php b/code_samples/customer_portal/src/Corporate/EventSubscriber/ApplicationDetailsViewSubscriber.php index a3aa6250197..9412f88b68f 100644 --- a/code_samples/customer_portal/src/Corporate/EventSubscriber/ApplicationDetailsViewSubscriber.php +++ b/code_samples/customer_portal/src/Corporate/EventSubscriber/ApplicationDetailsViewSubscriber.php @@ -21,7 +21,7 @@ public function __construct( } /** - * @param \Ibexa\CorporateAccount\View\ApplicationDetailsView $view + * @param ApplicationDetailsView $view */ protected function configureView(View $view): void { diff --git a/code_samples/customer_portal/src/Corporate/EventSubscriber/VerifyStateEventSubscriber.php b/code_samples/customer_portal/src/Corporate/EventSubscriber/VerifyStateEventSubscriber.php index 54a85470e12..ff4a2d72431 100644 --- a/code_samples/customer_portal/src/Corporate/EventSubscriber/VerifyStateEventSubscriber.php +++ b/code_samples/customer_portal/src/Corporate/EventSubscriber/VerifyStateEventSubscriber.php @@ -23,8 +23,7 @@ public function __construct( private FormFactoryInterface $formFactory, private HandlerInterface $applicationStateHandler, private TranslatableNotificationHandlerInterface $notificationHandler - ) { - } + ) {} public static function getSubscribedEvents(): array { diff --git a/code_samples/data_migration/src/Migrations/Action/AssignSection.php b/code_samples/data_migration/src/Migrations/Action/AssignSection.php index 876c51491ad..d809fced4e7 100644 --- a/code_samples/data_migration/src/Migrations/Action/AssignSection.php +++ b/code_samples/data_migration/src/Migrations/Action/AssignSection.php @@ -10,9 +10,7 @@ { public const string TYPE = 'assign_section'; - public function __construct(private string $sectionIdentifier) - { - } + public function __construct(private string $sectionIdentifier) {} /** * @return string diff --git a/code_samples/data_migration/src/Migrations/Action/AssignSectionDenormalizer.php b/code_samples/data_migration/src/Migrations/Action/AssignSectionDenormalizer.php index 96f067a99e8..d82b718a4f2 100644 --- a/code_samples/data_migration/src/Migrations/Action/AssignSectionDenormalizer.php +++ b/code_samples/data_migration/src/Migrations/Action/AssignSectionDenormalizer.php @@ -9,8 +9,10 @@ final class AssignSectionDenormalizer extends AbstractActionDenormalizer { - protected function supportsActionName(string $actionName, ?string $format = null): bool - { + protected function supportsActionName( + string $actionName, + ?string $format = null + ): bool { return $actionName === AssignSection::TYPE; } @@ -20,10 +22,14 @@ protected function supportsActionName(string $actionName, ?string $format = null * @param string|null $format * @param array $context * - * @return \App\Migrations\Action\AssignSection + * @return AssignSection */ - public function denormalize($data, string $type, ?string $format = null, array $context = []): AssignSection - { + public function denormalize( + $data, + string $type, + ?string $format = null, + array $context = [] + ): AssignSection { Assert::keyExists($data, 'value'); return new AssignSection($data['value']); diff --git a/code_samples/data_migration/src/Migrations/Action/AssignSectionExecutor.php b/code_samples/data_migration/src/Migrations/Action/AssignSectionExecutor.php index 258f3f0d5dc..1dcb4e7a1ea 100644 --- a/code_samples/data_migration/src/Migrations/Action/AssignSectionExecutor.php +++ b/code_samples/data_migration/src/Migrations/Action/AssignSectionExecutor.php @@ -4,6 +4,7 @@ use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\SectionService; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\ValueObject as APIValueObject; use Ibexa\Migration\StepExecutor\ActionExecutor\ExecutorInterface; use Ibexa\Migration\ValueObject; @@ -13,15 +14,16 @@ public function __construct( private ContentService $contentService, private SectionService $sectionService - ) { - } + ) {} /** - * @param \App\Migrations\Action\AssignSection $action - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content + * @param AssignSection $action + * @param Content $content */ - public function handle(ValueObject\Step\Action $action, APIValueObject $content): void - { + public function handle( + ValueObject\Step\Action $action, + APIValueObject $content + ): void { $contentInfo = $this->contentService->loadContentInfo($content->id); $section = $this->sectionService->loadSectionByIdentifier($action->getValue()); $this->sectionService->assignSection($contentInfo, $section); diff --git a/code_samples/data_migration/src/Migrations/Matcher/SectionIdentifierNormalizer.php b/code_samples/data_migration/src/Migrations/Matcher/SectionIdentifierNormalizer.php index a184db52d9d..0bbe990d232 100644 --- a/code_samples/data_migration/src/Migrations/Matcher/SectionIdentifierNormalizer.php +++ b/code_samples/data_migration/src/Migrations/Matcher/SectionIdentifierNormalizer.php @@ -18,15 +18,22 @@ public function __construct() * @param array $data * @param array $context */ - protected function createCriterion(array $data, string $type, ?string $format, array $context): FilteringCriterion - { + protected function createCriterion( + array $data, + string $type, + ?string $format, + array $context + ): FilteringCriterion { Assert::keyExists($data, 'value'); return new Criterion\SectionIdentifier($data['value']); } - public function supportsNormalization($data, ?string $format = null, array $context = []): bool - { + public function supportsNormalization( + $data, + ?string $format = null, + array $context = [] + ): bool { return $data instanceof Criterion\SectionIdentifier; } } diff --git a/code_samples/data_migration/src/Migrations/Step/ReplaceNameStepExecutor.php b/code_samples/data_migration/src/Migrations/Step/ReplaceNameStepExecutor.php index 394e3dfd018..6d42605ca49 100644 --- a/code_samples/data_migration/src/Migrations/Step/ReplaceNameStepExecutor.php +++ b/code_samples/data_migration/src/Migrations/Step/ReplaceNameStepExecutor.php @@ -12,9 +12,7 @@ final class ReplaceNameStepExecutor extends AbstractStepExecutor { - public function __construct(private readonly ContentService $contentService) - { - } + public function __construct(private readonly ContentService $contentService) {} protected function doHandle(StepInterface $step) { diff --git a/code_samples/discounts/src/Command/ManageDiscountsCommand.php b/code_samples/discounts/src/Command/ManageDiscountsCommand.php index 88755ae611a..b3ba31eeb8f 100644 --- a/code_samples/discounts/src/Command/ManageDiscountsCommand.php +++ b/code_samples/discounts/src/Command/ManageDiscountsCommand.php @@ -19,11 +19,12 @@ use Ibexa\Discounts\Value\DiscountCondition\IsProductInArray; use Ibexa\Discounts\Value\DiscountRule\FixedAmount; use Ibexa\DiscountsCodes\Value\DiscountCondition\IsValidDiscountCode; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -#[\Symfony\Component\Console\Attribute\AsCommand(name: 'discounts:manage')] +#[AsCommand(name: 'discounts:manage')] final class ManageDiscountsCommand extends Command { public function __construct( @@ -35,8 +36,10 @@ public function __construct( parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $this->permissionResolver->setCurrentUserReference( $this->userService->loadUserByLogin('admin') ); diff --git a/code_samples/discounts/src/Command/OrderPriceCommand.php b/code_samples/discounts/src/Command/OrderPriceCommand.php index 748a886c46d..56c96a64df4 100644 --- a/code_samples/discounts/src/Command/OrderPriceCommand.php +++ b/code_samples/discounts/src/Command/OrderPriceCommand.php @@ -16,11 +16,12 @@ use Ibexa\OrderManagement\Discounts\Value\DiscountsData; use Ibexa\ProductCatalog\Money\IntlMoneyFactory; use Money\Money; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -#[\Symfony\Component\Console\Attribute\AsCommand(name: 'app:discounts:prices')] +#[AsCommand(name: 'app:discounts:prices')] final class OrderPriceCommand extends Command { public function __construct( @@ -36,8 +37,10 @@ public function __construct( parent::__construct(); } - public function execute(InputInterface $input, OutputInterface $output): int - { + public function execute( + InputInterface $input, + OutputInterface $output + ): int { $this->permissionResolver->setCurrentUserReference($this->userService->loadUserByLogin('admin')); $productCode = 'product_code_control_unit_0'; @@ -59,7 +62,7 @@ public function execute(InputInterface $input, OutputInterface $output): int $output->writeln(sprintf('Discounted price: %s', $this->formatPrice($resolvedPrice->getMoney()))); if ($resolvedPrice instanceof PriceEnvelopeInterface) { - /** @var \Ibexa\Discounts\Value\Price\Stamp\DiscountStamp $discountStamp */ + /** @var DiscountStamp $discountStamp */ foreach ($resolvedPrice->all(DiscountStamp::class) as $discountStamp) { $output->writeln( sprintf( diff --git a/code_samples/discounts/src/Discounts/ExpressionProvider/CurrentUserRegistrationDateResolver.php b/code_samples/discounts/src/Discounts/ExpressionProvider/CurrentUserRegistrationDateResolver.php index 50f494b1381..cddfb2767e9 100644 --- a/code_samples/discounts/src/Discounts/ExpressionProvider/CurrentUserRegistrationDateResolver.php +++ b/code_samples/discounts/src/Discounts/ExpressionProvider/CurrentUserRegistrationDateResolver.php @@ -9,9 +9,10 @@ final readonly class CurrentUserRegistrationDateResolver implements DiscountVariablesResolverInterface { - public function __construct(private PermissionResolver $permissionResolver, private UserService $userService) - { - } + public function __construct( + private PermissionResolver $permissionResolver, + private UserService $userService + ) {} /** * @return array{current_user_registration_date: \DateTimeInterface} diff --git a/code_samples/discounts/src/Discounts/ExpressionProvider/IsAnniversaryResolver.php b/code_samples/discounts/src/Discounts/ExpressionProvider/IsAnniversaryResolver.php index 1b7449da302..c4d88c6fb2c 100644 --- a/code_samples/discounts/src/Discounts/ExpressionProvider/IsAnniversaryResolver.php +++ b/code_samples/discounts/src/Discounts/ExpressionProvider/IsAnniversaryResolver.php @@ -13,8 +13,10 @@ final class IsAnniversaryResolver private const int REFERENCE_YEAR = 2000; - public function __invoke(DateTimeInterface $date, int $tolerance = 0): bool - { + public function __invoke( + DateTimeInterface $date, + int $tolerance = 0 + ): bool { $d1 = $this->unifyYear(new DateTimeImmutable()); $d2 = $this->unifyYear($date); diff --git a/code_samples/discounts/src/Discounts/RecentDiscountPrioritizationStrategy.php b/code_samples/discounts/src/Discounts/RecentDiscountPrioritizationStrategy.php index 7805cfab002..392f75d6f69 100644 --- a/code_samples/discounts/src/Discounts/RecentDiscountPrioritizationStrategy.php +++ b/code_samples/discounts/src/Discounts/RecentDiscountPrioritizationStrategy.php @@ -7,9 +7,7 @@ final readonly class RecentDiscountPrioritizationStrategy implements DiscountPrioritizationStrategyInterface { - public function __construct(private DiscountPrioritizationStrategyInterface $inner) - { - } + public function __construct(private DiscountPrioritizationStrategyInterface $inner) {} public function getOrder(): array { diff --git a/code_samples/discounts/src/Discounts/Rule/PurchaseParityValueFormatter.php b/code_samples/discounts/src/Discounts/Rule/PurchaseParityValueFormatter.php index b569b187cb9..395b87085cd 100644 --- a/code_samples/discounts/src/Discounts/Rule/PurchaseParityValueFormatter.php +++ b/code_samples/discounts/src/Discounts/Rule/PurchaseParityValueFormatter.php @@ -10,8 +10,10 @@ final class PurchaseParityValueFormatter implements DiscountValueFormatterInterface { - public function format(DiscountRuleInterface $discountRule, ?Money $money = null): string - { + public function format( + DiscountRuleInterface $discountRule, + ?Money $money = null + ): string { return 'Regional discount'; } } diff --git a/code_samples/discounts/src/Discounts/Step/AnniversaryConditionStep.php b/code_samples/discounts/src/Discounts/Step/AnniversaryConditionStep.php index edc687fef9a..558f14bf90b 100644 --- a/code_samples/discounts/src/Discounts/Step/AnniversaryConditionStep.php +++ b/code_samples/discounts/src/Discounts/Step/AnniversaryConditionStep.php @@ -8,7 +8,8 @@ final class AnniversaryConditionStep extends AbstractDiscountStep { public const string IDENTIFIER = 'anniversary_condition_step'; - public function __construct(public bool $enabled = false, public int $tolerance = 0) - { - } + public function __construct( + public bool $enabled = false, + public int $tolerance = 0 + ) {} } diff --git a/code_samples/discounts/src/Discounts/Step/AnniversaryConditionStepFormListener.php b/code_samples/discounts/src/Discounts/Step/AnniversaryConditionStepFormListener.php index 0d23b7f7e98..11990b43f6b 100644 --- a/code_samples/discounts/src/Discounts/Step/AnniversaryConditionStepFormListener.php +++ b/code_samples/discounts/src/Discounts/Step/AnniversaryConditionStepFormListener.php @@ -17,8 +17,11 @@ public function isDataSupported(DiscountStepData $data): bool return $data->getStepData() instanceof AnniversaryConditionStep; } - public function addFields(FormInterface $form, DiscountStepData $data, PreSetDataEvent $event): void - { + public function addFields( + FormInterface $form, + DiscountStepData $data, + PreSetDataEvent $event + ): void { $form->add( 'stepData', AnniversaryConditionStepType::class, @@ -31,7 +34,7 @@ public function addFields(FormInterface $form, DiscountStepData $data, PreSetDat public static function getTranslationMessages(): array { return [ - (new Message('discount.step.custom.label', 'discount'))->setDesc('Custom'), + new Message('discount.step.custom.label', 'discount')->setDesc('Custom'), ]; } } diff --git a/code_samples/discounts/src/Discounts/Step/Step1/AnniversaryConditionStepEventSubscriber.php b/code_samples/discounts/src/Discounts/Step/Step1/AnniversaryConditionStepEventSubscriber.php index 8765383d454..9a4913093f6 100644 --- a/code_samples/discounts/src/Discounts/Step/Step1/AnniversaryConditionStepEventSubscriber.php +++ b/code_samples/discounts/src/Discounts/Step/Step1/AnniversaryConditionStepEventSubscriber.php @@ -21,7 +21,7 @@ public static function getSubscribedEvents(): array } /** - * @param \Ibexa\Contracts\Discounts\Event\CreateFormDataEvent|\Ibexa\Contracts\Discounts\Event\MapDiscountToFormDataEvent $event + * @param CreateFormDataEvent|MapDiscountToFormDataEvent $event */ public function addAnniversaryConditionStep(Event $event): void { @@ -30,7 +30,7 @@ public function addAnniversaryConditionStep(Event $event): void return; } - /** @var \App\Discounts\Condition\IsAccountAnniversary $discount */ + /** @var IsAccountAnniversary $discount */ $discount = $event instanceof MapDiscountToFormDataEvent ? $event->getDiscount()->getConditionByIdentifier(IsAccountAnniversary::IDENTIFIER) : null; diff --git a/code_samples/discounts/src/Discounts/Step/Step2/AnniversaryConditionStepEventSubscriber.php b/code_samples/discounts/src/Discounts/Step/Step2/AnniversaryConditionStepEventSubscriber.php index 8f60118ad1d..0b719770791 100644 --- a/code_samples/discounts/src/Discounts/Step/Step2/AnniversaryConditionStepEventSubscriber.php +++ b/code_samples/discounts/src/Discounts/Step/Step2/AnniversaryConditionStepEventSubscriber.php @@ -26,7 +26,7 @@ public static function getSubscribedEvents(): array } /** - * @param \Ibexa\Contracts\Discounts\Event\CreateFormDataEvent|\Ibexa\Contracts\Discounts\Event\MapDiscountToFormDataEvent $event + * @param CreateFormDataEvent|MapDiscountToFormDataEvent $event */ public function addAnniversaryConditionStep(Event $event): void { @@ -35,7 +35,7 @@ public function addAnniversaryConditionStep(Event $event): void return; } - /** @var \App\Discounts\Condition\IsAccountAnniversary $discount */ + /** @var IsAccountAnniversary $discount */ $discount = $event instanceof MapDiscountToFormDataEvent ? $event->getDiscount()->getConditionByIdentifier(IsAccountAnniversary::IDENTIFIER) : null; diff --git a/code_samples/discounts/src/Form/FormMapper/PurchasingPowerParityFormMapper.php b/code_samples/discounts/src/Form/FormMapper/PurchasingPowerParityFormMapper.php index d10db76375e..bf876c54d00 100644 --- a/code_samples/discounts/src/Form/FormMapper/PurchasingPowerParityFormMapper.php +++ b/code_samples/discounts/src/Form/FormMapper/PurchasingPowerParityFormMapper.php @@ -14,8 +14,10 @@ public function getDiscountRuleTypes(?string $type): array return [PurchasingPowerParityRule::TYPE]; } - public function supports(string $type, string $ruleType): bool - { + public function supports( + string $type, + string $ruleType + ): bool { return $ruleType === PurchasingPowerParityRule::TYPE; } diff --git a/code_samples/discounts/src/Form/FormMapper/PurchasingPowerParityValueMapper.php b/code_samples/discounts/src/Form/FormMapper/PurchasingPowerParityValueMapper.php index 50a51c63e71..d2c460bc1bd 100644 --- a/code_samples/discounts/src/Form/FormMapper/PurchasingPowerParityValueMapper.php +++ b/code_samples/discounts/src/Form/FormMapper/PurchasingPowerParityValueMapper.php @@ -13,8 +13,10 @@ final class PurchasingPowerParityValueMapper implements DiscountValueMapperInterface { - public function createFormData(string $type, string $ruleType): DiscountValueInterface - { + public function createFormData( + string $type, + string $ruleType + ): DiscountValueInterface { if ($ruleType !== PurchasingPowerParityRule::TYPE) { throw new LogicException('Not implemented'); } @@ -48,10 +50,12 @@ public function mapUpdateDataToStruct( } /** - * @param \Ibexa\Contracts\Discounts\Value\Struct\DiscountCreateStruct|\Ibexa\Contracts\Discounts\Value\Struct\DiscountUpdateStruct $struct + * @param DiscountCreateStruct|DiscountUpdateStruct $struct */ - private function addRuleToStruct(DiscountValueInterface $data, $struct): void - { + private function addRuleToStruct( + DiscountValueInterface $data, + $struct + ): void { if (!$data instanceof PurchasingPowerParityValue) { throw new LogicException('Not implemented'); } diff --git a/code_samples/discounts/src/Form/Type/AnniversaryConditionStepType.php b/code_samples/discounts/src/Form/Type/AnniversaryConditionStepType.php index 004d1d1a7f3..e140e0a151c 100644 --- a/code_samples/discounts/src/Form/Type/AnniversaryConditionStepType.php +++ b/code_samples/discounts/src/Form/Type/AnniversaryConditionStepType.php @@ -16,8 +16,10 @@ */ final class AnniversaryConditionStepType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder->add( 'enabled', CheckboxType::class, diff --git a/code_samples/discounts/src/Form/Type/DiscountValue/PurchasingPowerParityValueType.php b/code_samples/discounts/src/Form/Type/DiscountValue/PurchasingPowerParityValueType.php index d957d5037f1..c2a03105505 100644 --- a/code_samples/discounts/src/Form/Type/DiscountValue/PurchasingPowerParityValueType.php +++ b/code_samples/discounts/src/Form/Type/DiscountValue/PurchasingPowerParityValueType.php @@ -21,9 +21,14 @@ */ final class PurchasingPowerParityValueType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options): void - { - $availableRegionHandler = static function (FormInterface $form, PurchasingPowerParityValue $data): void { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { + $availableRegionHandler = static function ( + FormInterface $form, + PurchasingPowerParityValue $data + ): void { $regions = $data->getDiscountData()->getGeneralProperties()->getRegions(); $regionNames = implode(', ', array_map(static fn (RegionInterface $region): string => $region->getIdentifier(), $regions)); diff --git a/code_samples/discounts/src/Query/Search.php b/code_samples/discounts/src/Query/Search.php index 9a6af404152..2f0a0f4d492 100644 --- a/code_samples/discounts/src/Query/Search.php +++ b/code_samples/discounts/src/Query/Search.php @@ -3,6 +3,7 @@ declare(strict_types=1); use Ibexa\Contracts\CoreSearch\Values\Query\Criterion\FieldValueCriterion; +use Ibexa\Contracts\Discounts\DiscountServiceInterface; use Ibexa\Contracts\Discounts\Value\Query\Criterion; use Ibexa\Contracts\Discounts\Value\Query\DiscountQuery; use Ibexa\Contracts\Discounts\Value\Query\SortClause; @@ -25,5 +26,5 @@ ] ); -/** @var \Ibexa\Contracts\Discounts\DiscountServiceInterface $discountService */ +/** @var DiscountServiceInterface $discountService */ $results = $discountService->findDiscounts($query); diff --git a/code_samples/field_types/2dpoint_ft/src/FieldType/Point2D/Type.php b/code_samples/field_types/2dpoint_ft/src/FieldType/Point2D/Type.php index 2219c9ae36d..7ea20877dd7 100644 --- a/code_samples/field_types/2dpoint_ft/src/FieldType/Point2D/Type.php +++ b/code_samples/field_types/2dpoint_ft/src/FieldType/Point2D/Type.php @@ -30,8 +30,10 @@ public function getSettingsSchema(): array ]; } - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void - { + public function mapFieldValueForm( + FormInterface $fieldForm, + FieldData $data + ): void { $definition = $data->getFieldDefinition(); $fieldForm->add('value', Point2DType::class, [ 'required' => $definition->isRequired, @@ -39,8 +41,10 @@ public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): vo ]); } - public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void - { + public function mapFieldDefinitionForm( + FormInterface $fieldDefinitionForm, + FieldDefinitionData $data + ): void { $fieldDefinitionForm->add('fieldSettings', Point2DSettingsType::class, [ 'label' => false, ]); diff --git a/code_samples/field_types/2dpoint_ft/src/FieldType/Point2D/Value.php b/code_samples/field_types/2dpoint_ft/src/FieldType/Point2D/Value.php index 894181613db..985549c9d25 100644 --- a/code_samples/field_types/2dpoint_ft/src/FieldType/Point2D/Value.php +++ b/code_samples/field_types/2dpoint_ft/src/FieldType/Point2D/Value.php @@ -13,8 +13,7 @@ public function __construct( private ?float $x = null, #[Assert\NotBlank] private ?float $y = null - ) { - } + ) {} public function getX(): ?float { diff --git a/code_samples/field_types/2dpoint_ft/src/Form/Type/Point2DSettingsType.php b/code_samples/field_types/2dpoint_ft/src/Form/Type/Point2DSettingsType.php index 75432dcc1e4..d39a9084dcd 100644 --- a/code_samples/field_types/2dpoint_ft/src/Form/Type/Point2DSettingsType.php +++ b/code_samples/field_types/2dpoint_ft/src/Form/Type/Point2DSettingsType.php @@ -9,8 +9,10 @@ final class Point2DSettingsType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder->add('format', TextType::class); } } diff --git a/code_samples/field_types/2dpoint_ft/src/Form/Type/Point2DType.php b/code_samples/field_types/2dpoint_ft/src/Form/Type/Point2DType.php index 1f4227ae7a9..e0996ae908a 100644 --- a/code_samples/field_types/2dpoint_ft/src/Form/Type/Point2DType.php +++ b/code_samples/field_types/2dpoint_ft/src/Form/Type/Point2DType.php @@ -11,8 +11,10 @@ final class Point2DType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder->add('x', NumberType::class); $builder->add('y', NumberType::class); } diff --git a/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueDenormalizer.php b/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueDenormalizer.php index f4037480158..f449048fce6 100644 --- a/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueDenormalizer.php +++ b/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueDenormalizer.php @@ -8,8 +8,12 @@ final class ValueDenormalizer implements DenormalizerInterface { - public function denormalize($data, string $class, ?string $format = null, array $context = []): mixed - { + public function denormalize( + $data, + string $class, + ?string $format = null, + array $context = [] + ): mixed { if (isset($data['x']) && isset($data['y'])) { // Support for old format $data = [$data['x'], $data['y']]; @@ -18,8 +22,12 @@ public function denormalize($data, string $class, ?string $format = null, array return new $class($data); } - public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool - { + public function supportsDenormalization( + mixed $data, + string $type, + ?string $format = null, + array $context = [] + ): bool { return $type === Value::class; } diff --git a/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueNormalizer.php b/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueNormalizer.php index bc7fea2b9c6..05b4c997df3 100644 --- a/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueNormalizer.php +++ b/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueNormalizer.php @@ -11,16 +11,22 @@ final class ValueNormalizer implements NormalizerInterface /** * @return array */ - public function normalize($object, ?string $format = null, array $context = []): array - { + public function normalize( + $object, + ?string $format = null, + array $context = [] + ): array { return [ $object->getX(), $object->getY(), ]; } - public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool - { + public function supportsNormalization( + mixed $data, + ?string $format = null, + array $context = [] + ): bool { return $data instanceof Value; } diff --git a/code_samples/field_types/2dpoint_ft/steps/step_1/Value.php b/code_samples/field_types/2dpoint_ft/steps/step_1/Value.php index 7b5b1936962..cbe2011bd9c 100644 --- a/code_samples/field_types/2dpoint_ft/steps/step_1/Value.php +++ b/code_samples/field_types/2dpoint_ft/steps/step_1/Value.php @@ -10,8 +10,7 @@ final class Value implements ValueInterface public function __construct( private ?float $x = null, private ?float $y = null - ) { - } + ) {} public function getX(): ?float { diff --git a/code_samples/field_types/2dpoint_ft/steps/step_3/Point2DType.php b/code_samples/field_types/2dpoint_ft/steps/step_3/Point2DType.php index 1f4227ae7a9..e0996ae908a 100644 --- a/code_samples/field_types/2dpoint_ft/steps/step_3/Point2DType.php +++ b/code_samples/field_types/2dpoint_ft/steps/step_3/Point2DType.php @@ -11,8 +11,10 @@ final class Point2DType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder->add('x', NumberType::class); $builder->add('y', NumberType::class); } diff --git a/code_samples/field_types/2dpoint_ft/steps/step_3/Type.php b/code_samples/field_types/2dpoint_ft/steps/step_3/Type.php index 9e0bbc346d9..07c6a8f0508 100644 --- a/code_samples/field_types/2dpoint_ft/steps/step_3/Type.php +++ b/code_samples/field_types/2dpoint_ft/steps/step_3/Type.php @@ -16,8 +16,10 @@ public function getFieldTypeIdentifier(): string return 'point2d'; } - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void - { + public function mapFieldValueForm( + FormInterface $fieldForm, + FieldData $data + ): void { $definition = $data->getFieldDefinition(); $fieldForm->add('value', Point2DType::class, [ 'required' => $definition->isRequired, diff --git a/code_samples/field_types/2dpoint_ft/steps/step_6/Type.php b/code_samples/field_types/2dpoint_ft/steps/step_6/Type.php index 617411f67e7..b42ffd18796 100644 --- a/code_samples/field_types/2dpoint_ft/steps/step_6/Type.php +++ b/code_samples/field_types/2dpoint_ft/steps/step_6/Type.php @@ -26,8 +26,10 @@ public function getSettingsSchema(): array ]; } - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void - { + public function mapFieldValueForm( + FormInterface $fieldForm, + FieldData $data + ): void { $definition = $data->getFieldDefinition(); $fieldForm->add('value', Point2DType::class, [ 'required' => $definition->isRequired, diff --git a/code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Comparison/HelloWorldComparisonEngine.php b/code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Comparison/HelloWorldComparisonEngine.php index 60fdf5ca716..9569b98b2ec 100644 --- a/code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Comparison/HelloWorldComparisonEngine.php +++ b/code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Comparison/HelloWorldComparisonEngine.php @@ -7,30 +7,33 @@ use Ibexa\Contracts\VersionComparison\Engine\FieldTypeComparisonEngine; use Ibexa\Contracts\VersionComparison\FieldType\FieldTypeComparisonValue; use Ibexa\Contracts\VersionComparison\Result\ComparisonResult; +use Ibexa\VersionComparison\Engine\Value\StringComparisonEngine; final readonly class HelloWorldComparisonEngine implements FieldTypeComparisonEngine { - public function __construct(private \Ibexa\VersionComparison\Engine\Value\StringComparisonEngine $stringValueComparisonEngine) - { - } + public function __construct(private StringComparisonEngine $stringValueComparisonEngine) {} /** - * @param \App\FieldType\HelloWorld\Comparison\Value $comparisonDataA - * @param \App\FieldType\HelloWorld\Comparison\Value $comparisonDataB + * @param Value $comparisonDataA + * @param Value $comparisonDataB */ - public function compareFieldsTypeValues(FieldTypeComparisonValue $comparisonDataA, FieldTypeComparisonValue $comparisonDataB): ComparisonResult - { + public function compareFieldsTypeValues( + FieldTypeComparisonValue $comparisonDataA, + FieldTypeComparisonValue $comparisonDataB + ): ComparisonResult { return new HelloWorldComparisonResult( $this->stringValueComparisonEngine->compareValues($comparisonDataA->name, $comparisonDataB->name) ); } /** - * @param \App\FieldType\HelloWorld\Comparison\Value $comparisonDataA - * @param \App\FieldType\HelloWorld\Comparison\Value $comparisonDataB + * @param Value $comparisonDataA + * @param Value $comparisonDataB */ - public function shouldRunComparison(FieldTypeComparisonValue $comparisonDataA, FieldTypeComparisonValue $comparisonDataB): bool - { + public function shouldRunComparison( + FieldTypeComparisonValue $comparisonDataA, + FieldTypeComparisonValue $comparisonDataB + ): bool { return $comparisonDataA->name->value !== $comparisonDataB->name->value; } } diff --git a/code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Comparison/HelloWorldComparisonResult.php b/code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Comparison/HelloWorldComparisonResult.php index a8bab2d2f7e..a97569385a1 100644 --- a/code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Comparison/HelloWorldComparisonResult.php +++ b/code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Comparison/HelloWorldComparisonResult.php @@ -9,9 +9,7 @@ final readonly class HelloWorldComparisonResult implements ComparisonResult { - public function __construct(private \Ibexa\VersionComparison\Result\Value\StringComparisonResult $stringDiff) - { - } + public function __construct(private StringComparisonResult $stringDiff) {} public function getHelloWorldDiff(): StringComparisonResult { diff --git a/code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Comparison/Value.php b/code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Comparison/Value.php index b820682ec84..85b5b85c6b7 100644 --- a/code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Comparison/Value.php +++ b/code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Comparison/Value.php @@ -5,9 +5,10 @@ namespace App\FieldType\HelloWorld\Comparison; use Ibexa\Contracts\VersionComparison\FieldType\FieldTypeComparisonValue; +use Ibexa\VersionComparison\ComparisonValue\StringComparisonValue; class Value extends FieldTypeComparisonValue { - /** @var \Ibexa\VersionComparison\ComparisonValue\StringComparisonValue */ - public \Ibexa\VersionComparison\ComparisonValue\StringComparisonValue $name; + /** @var StringComparisonValue */ + public StringComparisonValue $name; } diff --git a/code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Type.php b/code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Type.php index 62e5e121ae5..a60a01ff9ba 100644 --- a/code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Type.php +++ b/code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Type.php @@ -15,8 +15,10 @@ public function getFieldTypeIdentifier(): string return 'hello_world'; } - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void - { + public function mapFieldValueForm( + FormInterface $fieldForm, + FieldData $data + ): void { $definition = $data->getFieldDefinition(); $fieldForm->add('value', HelloWorldType::class, [ diff --git a/code_samples/field_types/generic_ft/src/Form/Type/HelloWorldType.php b/code_samples/field_types/generic_ft/src/Form/Type/HelloWorldType.php index 6a0cbf5e9b2..5e69bd81e1f 100644 --- a/code_samples/field_types/generic_ft/src/Form/Type/HelloWorldType.php +++ b/code_samples/field_types/generic_ft/src/Form/Type/HelloWorldType.php @@ -12,8 +12,10 @@ final class HelloWorldType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder->add('name', TextType::class); } diff --git a/code_samples/forms/custom_form_attribute/src/FormBuilder/FieldType/Field/Mapper/CheckboxWithRichtextDescriptionFieldMapper.php b/code_samples/forms/custom_form_attribute/src/FormBuilder/FieldType/Field/Mapper/CheckboxWithRichtextDescriptionFieldMapper.php index 015ee0e76ef..735089e3ce8 100644 --- a/code_samples/forms/custom_form_attribute/src/FormBuilder/FieldType/Field/Mapper/CheckboxWithRichtextDescriptionFieldMapper.php +++ b/code_samples/forms/custom_form_attribute/src/FormBuilder/FieldType/Field/Mapper/CheckboxWithRichtextDescriptionFieldMapper.php @@ -11,8 +11,10 @@ class CheckboxWithRichtextDescriptionFieldMapper extends GenericFieldMapper * {@inheritdoc} */ #[\Override] - protected function mapFormOptions(Field $field, array $constraints): array - { + protected function mapFormOptions( + Field $field, + array $constraints + ): array { $options = parent::mapFormOptions($field, $constraints); $options['label'] = $field->getAttributeValue('label'); $options['richtext_description'] = $field->getAttributeValue('richtext_description'); diff --git a/code_samples/forms/custom_form_attribute/src/FormBuilder/Form/Type/CheckboxWithRichtextDescriptionType.php b/code_samples/forms/custom_form_attribute/src/FormBuilder/Form/Type/CheckboxWithRichtextDescriptionType.php index a5603b63f6c..7a46fd57c5d 100644 --- a/code_samples/forms/custom_form_attribute/src/FormBuilder/Form/Type/CheckboxWithRichtextDescriptionType.php +++ b/code_samples/forms/custom_form_attribute/src/FormBuilder/Form/Type/CheckboxWithRichtextDescriptionType.php @@ -36,8 +36,11 @@ public function configureOptions(OptionsResolver $resolver): void $resolver->setAllowedTypes('richtext_description', ['null', 'string']); } - public function buildView(FormView $view, FormInterface $form, array $options): void - { + public function buildView( + FormView $view, + FormInterface $form, + array $options + ): void { // pass the Dom object of the richtext doc to the template $dom = new \DOMDocument(); if (!empty($options['richtext_description'])) { diff --git a/code_samples/forms/custom_form_attribute/src/FormBuilder/FormSubmission/Converter/RichtextDescriptionFieldSubmissionConverter.php b/code_samples/forms/custom_form_attribute/src/FormBuilder/FormSubmission/Converter/RichtextDescriptionFieldSubmissionConverter.php index 30981233db7..afd3c1ce24e 100644 --- a/code_samples/forms/custom_form_attribute/src/FormBuilder/FormSubmission/Converter/RichtextDescriptionFieldSubmissionConverter.php +++ b/code_samples/forms/custom_form_attribute/src/FormBuilder/FormSubmission/Converter/RichtextDescriptionFieldSubmissionConverter.php @@ -4,6 +4,4 @@ use Ibexa\FormBuilder\FormSubmission\Converter\BooleanFieldSubmissionConverter; -class RichtextDescriptionFieldSubmissionConverter extends BooleanFieldSubmissionConverter -{ -} +class RichtextDescriptionFieldSubmissionConverter extends BooleanFieldSubmissionConverter {} diff --git a/code_samples/forms/custom_form_field/src/FormBuilder/Field/Mapper/CountryFieldMapper.php b/code_samples/forms/custom_form_field/src/FormBuilder/Field/Mapper/CountryFieldMapper.php index 32d4b9774a5..80e91b60c7a 100644 --- a/code_samples/forms/custom_form_field/src/FormBuilder/Field/Mapper/CountryFieldMapper.php +++ b/code_samples/forms/custom_form_field/src/FormBuilder/Field/Mapper/CountryFieldMapper.php @@ -8,8 +8,10 @@ class CountryFieldMapper extends GenericFieldMapper { #[\Override] - protected function mapFormOptions(Field $field, array $constraints): array - { + protected function mapFormOptions( + Field $field, + array $constraints + ): array { $options = parent::mapFormOptions($field, $constraints); $options['label'] = $field->getAttributeValue('label'); $options['help'] = $field->getAttributeValue('help'); diff --git a/code_samples/front/embed_content/src/Controller/RelationController.php b/code_samples/front/embed_content/src/Controller/RelationController.php index 58dc2d4af73..e30e63e33de 100644 --- a/code_samples/front/embed_content/src/Controller/RelationController.php +++ b/code_samples/front/embed_content/src/Controller/RelationController.php @@ -13,11 +13,12 @@ class RelationController public function __construct( private readonly ContentService $contentService, private readonly LocationService $locationService - ) { - } + ) {} - public function showContentAction(View $view, $locationId): View - { + public function showContentAction( + View $view, + $locationId + ): View { $acceptedContentTypes = $view->getParameter('accepted_content_types'); $location = $this->locationService->loadLocation($locationId); diff --git a/code_samples/front/layouts/breadcrumbs/src/Controller/BreadcrumbController.php b/code_samples/front/layouts/breadcrumbs/src/Controller/BreadcrumbController.php index b82a4feeede..cdc28a5ba26 100644 --- a/code_samples/front/layouts/breadcrumbs/src/Controller/BreadcrumbController.php +++ b/code_samples/front/layouts/breadcrumbs/src/Controller/BreadcrumbController.php @@ -14,8 +14,7 @@ class BreadcrumbController extends Controller public function __construct( private readonly LocationService $locationService, private readonly SearchService $searchService - ) { - } + ) {} public function showBreadcrumbsAction($locationId): Response { diff --git a/code_samples/front/layouts/menu/src/Menu/MenuBuilder.php b/code_samples/front/layouts/menu/src/Menu/MenuBuilder.php index 9266372cf2f..f320e4cb22a 100644 --- a/code_samples/front/layouts/menu/src/Menu/MenuBuilder.php +++ b/code_samples/front/layouts/menu/src/Menu/MenuBuilder.php @@ -7,9 +7,7 @@ class MenuBuilder { - public function __construct(private readonly FactoryInterface $factory) - { - } + public function __construct(private readonly FactoryInterface $factory) {} public function buildMenu(): ItemInterface { diff --git a/code_samples/front/render_content_in_php/src/Command/ViewCommand.php b/code_samples/front/render_content_in_php/src/Command/ViewCommand.php index 10d0544cf8e..7e6439bdeb9 100644 --- a/code_samples/front/render_content_in_php/src/Command/ViewCommand.php +++ b/code_samples/front/render_content_in_php/src/Command/ViewCommand.php @@ -31,8 +31,10 @@ protected function configure(): void ->addOption('view-type', 't', InputOption::VALUE_OPTIONAL, 'View Type', 'line'); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $contentId = $input->getOption('content-id'); $locationId = $input->getOption('location-id'); if (empty($contentId) && empty($locationId)) { diff --git a/code_samples/front/shop/checkout/src/Form/Type/OnePageCheckoutType.php b/code_samples/front/shop/checkout/src/Form/Type/OnePageCheckoutType.php index 08d23273a65..080805b718f 100644 --- a/code_samples/front/shop/checkout/src/Form/Type/OnePageCheckoutType.php +++ b/code_samples/front/shop/checkout/src/Form/Type/OnePageCheckoutType.php @@ -15,8 +15,10 @@ final class OnePageCheckoutType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder->add( 'payment_method', PaymentMethodChoiceType::class, diff --git a/code_samples/front/shop/checkout/src/Form/Type/SelectSeatType.php b/code_samples/front/shop/checkout/src/Form/Type/SelectSeatType.php index 6d73df05526..05dc25dcc3d 100644 --- a/code_samples/front/shop/checkout/src/Form/Type/SelectSeatType.php +++ b/code_samples/front/shop/checkout/src/Form/Type/SelectSeatType.php @@ -11,8 +11,10 @@ final class SelectSeatType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder->add( 'selection', TextType::class, diff --git a/code_samples/front/shop/payment/src/lib/PaymentMethod/Voter/NewPaymentMethodTypeVoter.php b/code_samples/front/shop/payment/src/lib/PaymentMethod/Voter/NewPaymentMethodTypeVoter.php index 432752221e4..03ad3893200 100644 --- a/code_samples/front/shop/payment/src/lib/PaymentMethod/Voter/NewPaymentMethodTypeVoter.php +++ b/code_samples/front/shop/payment/src/lib/PaymentMethod/Voter/NewPaymentMethodTypeVoter.php @@ -10,8 +10,10 @@ final class NewPaymentMethodTypeVoter extends AbstractVoter { - protected function getVote(PaymentMethodInterface $method, CartInterface $cart): bool - { + protected function getVote( + PaymentMethodInterface $method, + CartInterface $cart + ): bool { // Add custom logic if method should not always be visible return true; diff --git a/code_samples/front/shop/shipping/src/ShippingMethodType/Cost/CustomCostFormatter.php b/code_samples/front/shop/shipping/src/ShippingMethodType/Cost/CustomCostFormatter.php index cd9b959179f..65c9cd5be05 100644 --- a/code_samples/front/shop/shipping/src/ShippingMethodType/Cost/CustomCostFormatter.php +++ b/code_samples/front/shop/shipping/src/ShippingMethodType/Cost/CustomCostFormatter.php @@ -9,8 +9,10 @@ final class CustomCostFormatter implements CostFormatterInterface { - public function formatCost(ShippingMethodInterface $shippingMethod, array $parameters = []): ?string - { + public function formatCost( + ShippingMethodInterface $shippingMethod, + array $parameters = [] + ): ?string { return $shippingMethod->getOptions()->get('customer_identifier'); } } diff --git a/code_samples/front/shop/shipping/src/ShippingMethodType/Form/Type/CustomShippingMethodOptionsType.php b/code_samples/front/shop/shipping/src/ShippingMethodType/Form/Type/CustomShippingMethodOptionsType.php index d331e377812..80007ba8687 100644 --- a/code_samples/front/shop/shipping/src/ShippingMethodType/Form/Type/CustomShippingMethodOptionsType.php +++ b/code_samples/front/shop/shipping/src/ShippingMethodType/Form/Type/CustomShippingMethodOptionsType.php @@ -19,8 +19,10 @@ public function getBlockPrefix(): string return 'ibexa_shipping_method_custom'; } - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder->add('customer_identifier', TextType::class); } diff --git a/code_samples/front/shop/shipping/src/ShippingMethodType/Voter/CustomVoter.php b/code_samples/front/shop/shipping/src/ShippingMethodType/Voter/CustomVoter.php index 7e4682fd967..f97175f6c4e 100644 --- a/code_samples/front/shop/shipping/src/ShippingMethodType/Voter/CustomVoter.php +++ b/code_samples/front/shop/shipping/src/ShippingMethodType/Voter/CustomVoter.php @@ -10,8 +10,10 @@ final class CustomVoter extends AbstractVoter { - protected function getVote(ShippingMethodInterface $method, CartInterface $cart): bool - { + protected function getVote( + ShippingMethodInterface $method, + CartInterface $cart + ): bool { return $method->getOptions()->get('customer_identifier') === 'Acme'; } } diff --git a/code_samples/front/view_matcher/src/View/Matcher/Owner.php b/code_samples/front/view_matcher/src/View/Matcher/Owner.php index 9c21e121410..d4417830636 100644 --- a/code_samples/front/view_matcher/src/View/Matcher/Owner.php +++ b/code_samples/front/view_matcher/src/View/Matcher/Owner.php @@ -2,6 +2,7 @@ namespace App\View\Matcher; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Location; @@ -16,12 +17,10 @@ class Owner implements MatcherInterface /** @var string[] */ private array $matchingUserLogins; - public function __construct(private readonly UserService $userService) - { - } + public function __construct(private readonly UserService $userService) {} /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ public function matchLocation(Location $location): bool { @@ -29,7 +28,7 @@ public function matchLocation(Location $location): bool } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ public function matchContentInfo(ContentInfo $contentInfo): bool { @@ -37,7 +36,7 @@ public function matchContentInfo(ContentInfo $contentInfo): bool } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ public function match(View $view): ?bool { @@ -53,7 +52,7 @@ public function match(View $view): ?bool } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ private function hasOwner(ContentInfo $contentInfo): bool { diff --git a/code_samples/mcp/src/Command/McpServerListCommand.php b/code_samples/mcp/src/Command/McpServerListCommand.php index f4deeb6de00..12ccbb909e8 100644 --- a/code_samples/mcp/src/Command/McpServerListCommand.php +++ b/code_samples/mcp/src/Command/McpServerListCommand.php @@ -10,13 +10,11 @@ #[AsCommand(name: 'app:mcp:server_list', description: 'List MCP servers')] class McpServerListCommand { - public function __construct(private readonly McpServerConfigurationRegistryInterface $configRegistry) - { - } + public function __construct(private readonly McpServerConfigurationRegistryInterface $configRegistry) {} public function __invoke(SymfonyStyle $io): int { - foreach($this->configRegistry->getServerConfigurations() as $serverConfiguration) { + foreach ($this->configRegistry->getServerConfigurations() as $serverConfiguration) { $io->title($serverConfiguration->identifier); dump($serverConfiguration); } diff --git a/code_samples/multisite/siteaccess/AcmeExampleExtension.php b/code_samples/multisite/siteaccess/AcmeExampleExtension.php index 47de70ea6c8..ba6039f1272 100644 --- a/code_samples/multisite/siteaccess/AcmeExampleExtension.php +++ b/code_samples/multisite/siteaccess/AcmeExampleExtension.php @@ -16,8 +16,10 @@ final class AcmeExampleExtension extends Extension /** * @throws \Exception */ - public function load(array $configs, ContainerBuilder $container): void - { + public function load( + array $configs, + ContainerBuilder $container + ): void { $configuration = $this->getConfiguration($configs, $container); $config = $this->processConfiguration($configuration, $configs); @@ -29,7 +31,11 @@ public function load(array $configs, ContainerBuilder $container): void $config, // Any kind of callable can be used here. // It is called for each declared scope/SiteAccess. - static function ($scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void { + static function ( + $scopeSettings, + $currentScope, + ContextualizerInterface $contextualizer + ): void { // Maps the "name" setting to "acme_example.<$currentScope>.name" container parameter // It is then possible to retrieve this parameter through ConfigResolver in the application code: // $helloSetting = $configResolver->getParameter( 'name', 'acme_example' ); @@ -55,8 +61,10 @@ static function ($scopeSettings, $currentScope, ContextualizerInterface $context /** @param array $config */ #[\Override] - public function getConfiguration(array $config, ContainerBuilder $container): Configuration - { + public function getConfiguration( + array $config, + ContainerBuilder $container + ): Configuration { return new Configuration(); } } diff --git a/code_samples/multisite/siteaccess/Configuration.php b/code_samples/multisite/siteaccess/Configuration.php index 36e58f29e23..965bf30b080 100644 --- a/code_samples/multisite/siteaccess/Configuration.php +++ b/code_samples/multisite/siteaccess/Configuration.php @@ -8,7 +8,7 @@ class Configuration extends SiteAccessConfiguration { /** - * @phpstan-return \Symfony\Component\Config\Definition\Builder\TreeBuilder<'array'> The tree builder + * @phpstan-return TreeBuilder<'array'> The tree builder */ public function getConfigTreeBuilder(): TreeBuilder { diff --git a/code_samples/notifications/Src/Query/search.php b/code_samples/notifications/Src/Query/search.php index d771b8b343b..1d1b85b82e7 100644 --- a/code_samples/notifications/Src/Query/search.php +++ b/code_samples/notifications/Src/Query/search.php @@ -11,8 +11,8 @@ $query->addCriterion(new Type('Workflow:Review')); $query->addCriterion(new Status(['unread'])); -$from = new \DateTimeImmutable('-7 days'); -$to = new \DateTimeImmutable(); +$from = new DateTimeImmutable('-7 days'); +$to = new DateTimeImmutable(); $query->addCriterion(new DateCreated($from, $to)); diff --git a/code_samples/page/custom_attribute/src/Block/Attribute/MyStringAttributeMapper.php b/code_samples/page/custom_attribute/src/Block/Attribute/MyStringAttributeMapper.php index f5158b7d1c3..f3641d6a653 100644 --- a/code_samples/page/custom_attribute/src/Block/Attribute/MyStringAttributeMapper.php +++ b/code_samples/page/custom_attribute/src/Block/Attribute/MyStringAttributeMapper.php @@ -10,12 +10,12 @@ class MyStringAttributeMapper implements AttributeFormTypeMapperInterface { /** - * @param \Symfony\Component\Form\FormBuilderInterface $formBuilder - * @param \Ibexa\Contracts\FieldTypePage\FieldType\Page\Block\Definition\BlockDefinition $blockDefinition - * @param \Ibexa\Contracts\FieldTypePage\FieldType\Page\Block\Definition\BlockAttributeDefinition $blockAttributeDefinition + * @param FormBuilderInterface $formBuilder + * @param BlockDefinition $blockDefinition + * @param BlockAttributeDefinition $blockAttributeDefinition * @param array $constraints * - * @return \Symfony\Component\Form\FormBuilderInterface + * @return FormBuilderInterface * * @throws \Exception */ diff --git a/code_samples/page/custom_block_validator/src/Form/Extension/AttributeTypeExtension.php b/code_samples/page/custom_block_validator/src/Form/Extension/AttributeTypeExtension.php index 0c3b08b6e65..779bcc8a74d 100644 --- a/code_samples/page/custom_block_validator/src/Form/Extension/AttributeTypeExtension.php +++ b/code_samples/page/custom_block_validator/src/Form/Extension/AttributeTypeExtension.php @@ -1,14 +1,17 @@ getConstraints()['custom_not_blank'])) { diff --git a/code_samples/page/custom_block_validator/src/Validator/AlphaOnlyValidator.php b/code_samples/page/custom_block_validator/src/Validator/AlphaOnlyValidator.php index df8526a72c5..30dd895b4d0 100644 --- a/code_samples/page/custom_block_validator/src/Validator/AlphaOnlyValidator.php +++ b/code_samples/page/custom_block_validator/src/Validator/AlphaOnlyValidator.php @@ -9,8 +9,10 @@ class AlphaOnlyValidator extends ConstraintValidator { - public function validate($value, Constraint $constraint): void - { + public function validate( + $value, + Constraint $constraint + ): void { if (!$constraint instanceof AlphaOnly) { throw new UnexpectedTypeException($constraint, AlphaOnly::class); } diff --git a/code_samples/page/custom_page_block/src/Event/Subscriber/BlockEmbedEventEventSubscriber.php b/code_samples/page/custom_page_block/src/Event/Subscriber/BlockEmbedEventEventSubscriber.php index 408be0db42a..6b068107921 100644 --- a/code_samples/page/custom_page_block/src/Event/Subscriber/BlockEmbedEventEventSubscriber.php +++ b/code_samples/page/custom_page_block/src/Event/Subscriber/BlockEmbedEventEventSubscriber.php @@ -5,13 +5,12 @@ use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\FieldTypePage\FieldType\Page\Block\Renderer\BlockRenderEvents; use Ibexa\FieldTypePage\FieldType\Page\Block\Renderer\Event\PreRenderEvent; +use Ibexa\FieldTypePage\FieldType\Page\Block\Renderer\Twig\TwigRenderRequest; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class BlockEmbedEventEventSubscriber implements EventSubscriberInterface { - public function __construct(private readonly ContentService $contentService) - { - } + public function __construct(private readonly ContentService $contentService) {} public static function getSubscribedEvents(): array { @@ -22,7 +21,7 @@ public static function getSubscribedEvents(): array public function onBlockPreRender(PreRenderEvent $event): void { - /** @var \Ibexa\FieldTypePage\FieldType\Page\Block\Renderer\Twig\TwigRenderRequest $renderRequest */ + /** @var TwigRenderRequest $renderRequest */ $renderRequest = $event->getRenderRequest(); $parameters = $event->getRenderRequest()->getParameters(); $parameters['event_content'] = $this->contentService->loadContent($parameters['event']); diff --git a/code_samples/page/page_listener/src/Block/Listener/MyBlockListener.php b/code_samples/page/page_listener/src/Block/Listener/MyBlockListener.php index 00f0884efb4..914b498f0f2 100644 --- a/code_samples/page/page_listener/src/Block/Listener/MyBlockListener.php +++ b/code_samples/page/page_listener/src/Block/Listener/MyBlockListener.php @@ -4,6 +4,7 @@ use Ibexa\FieldTypePage\FieldType\Page\Block\Renderer\BlockRenderEvents; use Ibexa\FieldTypePage\FieldType\Page\Block\Renderer\Event\PreRenderEvent; +use Ibexa\FieldTypePage\FieldType\Page\Block\Renderer\Twig\TwigRenderRequest; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class MyBlockListener implements EventSubscriberInterface @@ -17,7 +18,7 @@ public static function getSubscribedEvents(): array public function onBlockPreRender(PreRenderEvent $event): void { - /** @var \Ibexa\FieldTypePage\FieldType\Page\Block\Renderer\Twig\TwigRenderRequest $renderRequest */ + /** @var TwigRenderRequest $renderRequest */ $renderRequest = $event->getRenderRequest(); $parameters = $event->getRenderRequest()->getParameters(); diff --git a/code_samples/pim/availability/src/ProductAvailabilityPurchasableWithoutStockStrategy.php b/code_samples/pim/availability/src/ProductAvailabilityPurchasableWithoutStockStrategy.php index 0c28ad889d0..c28aa7ddc7c 100644 --- a/code_samples/pim/availability/src/ProductAvailabilityPurchasableWithoutStockStrategy.php +++ b/code_samples/pim/availability/src/ProductAvailabilityPurchasableWithoutStockStrategy.php @@ -11,9 +11,7 @@ final readonly class ProductAvailabilityPurchasableWithoutStockStrategy implements ProductAvailabilityStrategyInterface { - public function __construct(private HandlerInterface $handler) - { - } + public function __construct(private HandlerInterface $handler) {} public function accept(AvailabilityContextInterface $context): bool { diff --git a/code_samples/pim/availability/src/PurchasableWithoutStockAvailabilityContext.php b/code_samples/pim/availability/src/PurchasableWithoutStockAvailabilityContext.php index e8e8e547f6c..0e4c6f1101c 100644 --- a/code_samples/pim/availability/src/PurchasableWithoutStockAvailabilityContext.php +++ b/code_samples/pim/availability/src/PurchasableWithoutStockAvailabilityContext.php @@ -4,6 +4,4 @@ use Ibexa\Contracts\ProductCatalog\Values\Availability\AvailabilityContextInterface; -final class PurchasableWithoutStockAvailabilityContext implements AvailabilityContextInterface -{ -} +final class PurchasableWithoutStockAvailabilityContext implements AvailabilityContextInterface {} diff --git a/code_samples/product_catalog/Symbol/Format/Checksum/LuhnChecksum.php b/code_samples/product_catalog/Symbol/Format/Checksum/LuhnChecksum.php index 631a86dd05b..d2f89d00c3b 100644 --- a/code_samples/product_catalog/Symbol/Format/Checksum/LuhnChecksum.php +++ b/code_samples/product_catalog/Symbol/Format/Checksum/LuhnChecksum.php @@ -9,8 +9,10 @@ final class LuhnChecksum implements ChecksumInterface { - public function validate(AttributeDefinitionInterface $attributeDefinition, string $value): bool - { + public function validate( + AttributeDefinitionInterface $attributeDefinition, + string $value + ): bool { $digits = $this->getDigits($value); $count = count($digits); diff --git a/code_samples/raptor_cdp/date_of_birth_export/src/Export/User/DateOfBirthUserItemProcessor.php b/code_samples/raptor_cdp/date_of_birth_export/src/Export/User/DateOfBirthUserItemProcessor.php index 33a0993cae9..9cce0a98b0c 100644 --- a/code_samples/raptor_cdp/date_of_birth_export/src/Export/User/DateOfBirthUserItemProcessor.php +++ b/code_samples/raptor_cdp/date_of_birth_export/src/Export/User/DateOfBirthUserItemProcessor.php @@ -16,8 +16,10 @@ public function __construct( parent::__construct($userFieldTypeIdentifier); } - protected function doProcess(array $processedItemData, Content $userContent): array - { + protected function doProcess( + array $processedItemData, + Content $userContent + ): array { $userField = $this->getUserField($userContent); if (null === $userField) { diff --git a/code_samples/recent_activity/src/ActivityLog/ClassNameMapper/MyFeatureNameMapper.php b/code_samples/recent_activity/src/ActivityLog/ClassNameMapper/MyFeatureNameMapper.php index 92b08b11d81..dcdfa62b084 100644 --- a/code_samples/recent_activity/src/ActivityLog/ClassNameMapper/MyFeatureNameMapper.php +++ b/code_samples/recent_activity/src/ActivityLog/ClassNameMapper/MyFeatureNameMapper.php @@ -17,7 +17,7 @@ public function getClassNameToShortNameMap(): iterable public static function getTranslationMessages(): array { return [ - (new Message('ibexa.activity_log.search_form.object_class.my_feature', 'ibexa_activity_log')) + new Message('ibexa.activity_log.search_form.object_class.my_feature', 'ibexa_activity_log') ->setDesc('My Feature'), ]; } diff --git a/code_samples/recent_activity/src/Command/ActivityLogContextTestCommand.php b/code_samples/recent_activity/src/Command/ActivityLogContextTestCommand.php index c53703e2fa9..52813c10a60 100644 --- a/code_samples/recent_activity/src/Command/ActivityLogContextTestCommand.php +++ b/code_samples/recent_activity/src/Command/ActivityLogContextTestCommand.php @@ -39,8 +39,10 @@ protected function configure(): void $this->addArgument('id', InputArgument::REQUIRED, 'A test number'); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $id = $input->getArgument('id'); $this->permissionResolver->setCurrentUserReference($this->userService->loadUserByLogin('admin')); diff --git a/code_samples/recent_activity/src/Command/DispatchMyFeatureEventCommand.php b/code_samples/recent_activity/src/Command/DispatchMyFeatureEventCommand.php index ab8cec0ef06..33e17307730 100644 --- a/code_samples/recent_activity/src/Command/DispatchMyFeatureEventCommand.php +++ b/code_samples/recent_activity/src/Command/DispatchMyFeatureEventCommand.php @@ -21,8 +21,10 @@ public function __construct(private readonly EventDispatcherInterface $eventDisp parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $event = new MyFeatureEvent(new MyFeature(['id' => 123, 'name' => 'Logged Name']), 'simulate'); $this->eventDispatcher->dispatch($event); diff --git a/code_samples/recent_activity/src/Command/MonitorRecentContentCreationCommand.php b/code_samples/recent_activity/src/Command/MonitorRecentContentCreationCommand.php index 8b82da5673a..e08bc890369 100644 --- a/code_samples/recent_activity/src/Command/MonitorRecentContentCreationCommand.php +++ b/code_samples/recent_activity/src/Command/MonitorRecentContentCreationCommand.php @@ -29,8 +29,10 @@ public function __construct( parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $query = new Query([ new Criterion\ObjectCriterion(Content::class), new Criterion\ActionCriterion([ActivityLogServiceInterface::ACTION_CREATE]), diff --git a/code_samples/recent_activity/src/Event/MyFeatureEvent.php b/code_samples/recent_activity/src/Event/MyFeatureEvent.php index 84b46ba6c19..51b7ba50e15 100644 --- a/code_samples/recent_activity/src/Event/MyFeatureEvent.php +++ b/code_samples/recent_activity/src/Event/MyFeatureEvent.php @@ -9,8 +9,7 @@ class MyFeatureEvent extends Event public function __construct( private readonly object $object, private readonly string $action - ) { - } + ) {} public function getObject(): object { diff --git a/code_samples/recent_activity/src/EventSubscriber/MyFeatureEventSubscriber.php b/code_samples/recent_activity/src/EventSubscriber/MyFeatureEventSubscriber.php index 812875614ca..4ba4a98456c 100644 --- a/code_samples/recent_activity/src/EventSubscriber/MyFeatureEventSubscriber.php +++ b/code_samples/recent_activity/src/EventSubscriber/MyFeatureEventSubscriber.php @@ -3,14 +3,13 @@ namespace App\EventSubscriber; use App\Event\MyFeatureEvent; +use App\MyFeature\MyFeature; use Ibexa\Contracts\ActivityLog\ActivityLogServiceInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class MyFeatureEventSubscriber implements EventSubscriberInterface { - public function __construct(private readonly ActivityLogServiceInterface $activityLogService) - { - } + public function __construct(private readonly ActivityLogServiceInterface $activityLogService) {} public static function getSubscribedEvents(): array { @@ -21,7 +20,7 @@ public static function getSubscribedEvents(): array public function onMyFeatureEvent(MyFeatureEvent $event): void { - /** @var \App\MyFeature\MyFeature $object */ + /** @var MyFeature $object */ $object = $event->getObject(); $className = $object::class; $id = (string)$object->id; diff --git a/code_samples/recent_activity/src/EventSubscriber/MyFeaturePostActivityListLoadEventSubscriber.php b/code_samples/recent_activity/src/EventSubscriber/MyFeaturePostActivityListLoadEventSubscriber.php index 619ff17f6ef..354928100ce 100644 --- a/code_samples/recent_activity/src/EventSubscriber/MyFeaturePostActivityListLoadEventSubscriber.php +++ b/code_samples/recent_activity/src/EventSubscriber/MyFeaturePostActivityListLoadEventSubscriber.php @@ -11,9 +11,7 @@ class MyFeaturePostActivityListLoadEventSubscriber implements EventSubscriberInterface { - public function __construct(private readonly MyFeatureService $myFeatureService) - { - } + public function __construct(private readonly MyFeatureService $myFeatureService) {} public static function getSubscribedEvents(): array { @@ -43,7 +41,7 @@ public function loadMyFeature(PostActivityGroupListLoadEvent $event): void } $log->setRelatedObject($visitedIds[$id]); - } catch (NotFoundException|UnauthorizedException) { + } catch (NotFoundException | UnauthorizedException) { $visitedIds[$id] = null; } } diff --git a/code_samples/recent_activity/src/recent_activity_disable.php b/code_samples/recent_activity/src/recent_activity_disable.php index ba153acadfe..0482bb01600 100644 --- a/code_samples/recent_activity/src/recent_activity_disable.php +++ b/code_samples/recent_activity/src/recent_activity_disable.php @@ -1,6 +1,7 @@ disable(); // Perform operations that should not be logged to the activity log diff --git a/code_samples/recommendations/EventData.php b/code_samples/recommendations/EventData.php index 4825ed61146..78a20b405a4 100644 --- a/code_samples/recommendations/EventData.php +++ b/code_samples/recommendations/EventData.php @@ -10,8 +10,7 @@ class EventData { public function __construct( private readonly ServerSideTrackingDispatcherInterface $trackingDispatcher, - ) { - } + ) {} public function dispatchVisitEvent(ProductInterface $product): void { diff --git a/code_samples/recommendations/EventMapper.php b/code_samples/recommendations/EventMapper.php index cf0bd3bd8ee..f8b924a91f7 100644 --- a/code_samples/recommendations/EventMapper.php +++ b/code_samples/recommendations/EventMapper.php @@ -13,8 +13,7 @@ class EventMapper public function __construct( private readonly EventMapperInterface $eventMapper, private readonly ServerSideTrackingDispatcherInterface $trackingDispatcher, - ) { - } + ) {} public function trackProductView(ProductInterface $product): void { diff --git a/code_samples/recommendations/EventSubscriber.php b/code_samples/recommendations/EventSubscriber.php index 175784efc44..1be6a3fa84e 100644 --- a/code_samples/recommendations/EventSubscriber.php +++ b/code_samples/recommendations/EventSubscriber.php @@ -14,8 +14,7 @@ class EventSubscriber implements EventSubscriberInterface public function __construct( private readonly EventMapperInterface $eventMapper, private readonly ServerSideTrackingDispatcherInterface $trackingDispatcher, - ) { - } + ) {} public static function getSubscribedEvents(): array { diff --git a/code_samples/search/content/customfield_criterion.php b/code_samples/search/content/customfield_criterion.php index a9a52400dee..f675f94e42e 100644 --- a/code_samples/search/content/customfield_criterion.php +++ b/code_samples/search/content/customfield_criterion.php @@ -1,5 +1,6 @@ query = new Query\Criterion\CustomField('content_name_s', Operator::EQ, '/Ibexa.*/'); -/** @var \Ibexa\Contracts\Core\Repository\SearchService $searchService */ +/** @var SearchService $searchService */ $searchService->findContent($query); diff --git a/code_samples/search/content/taxonomy_no_entries_criterion.php b/code_samples/search/content/taxonomy_no_entries_criterion.php index 048006d41c5..2055b506ecf 100644 --- a/code_samples/search/content/taxonomy_no_entries_criterion.php +++ b/code_samples/search/content/taxonomy_no_entries_criterion.php @@ -2,6 +2,7 @@ declare(strict_types=1); +use Ibexa\Contracts\Core\Repository\SearchService; use Ibexa\Contracts\Core\Repository\Values\Content\Query; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ContentTypeIdentifier; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalAnd; @@ -15,5 +16,5 @@ ] ); -/** @var \Ibexa\Contracts\Core\Repository\SearchService $searchService */ +/** @var SearchService $searchService */ $results = $searchService->findContent($query); diff --git a/code_samples/search/content/taxonomy_subtree_criterion.php b/code_samples/search/content/taxonomy_subtree_criterion.php index c13f94ed70a..fc4e59ff9d7 100644 --- a/code_samples/search/content/taxonomy_subtree_criterion.php +++ b/code_samples/search/content/taxonomy_subtree_criterion.php @@ -2,6 +2,7 @@ declare(strict_types=1); +use Ibexa\Contracts\Core\Repository\SearchService; use Ibexa\Contracts\Core\Repository\Values\Content\Query; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ContentTypeIdentifier; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalAnd; @@ -15,5 +16,5 @@ ] ); -/** @var \Ibexa\Contracts\Core\Repository\SearchService $searchService */ +/** @var SearchService $searchService */ $results = $searchService->findContent($query); diff --git a/code_samples/search/custom/src/GroupResolver/ContentTypeGroupGroupResolver.php b/code_samples/search/custom/src/GroupResolver/ContentTypeGroupGroupResolver.php index a707b331c51..31f0257cef4 100644 --- a/code_samples/search/custom/src/GroupResolver/ContentTypeGroupGroupResolver.php +++ b/code_samples/search/custom/src/GroupResolver/ContentTypeGroupGroupResolver.php @@ -10,9 +10,7 @@ final readonly class ContentTypeGroupGroupResolver implements GroupResolverInterface { - public function __construct(private Handler $contentTypeHandler) - { - } + public function __construct(private Handler $contentTypeHandler) {} public function resolveDocumentGroup(BaseDocument $document): string { diff --git a/code_samples/search/custom/src/Query/Aggregation/Elasticsearch/PriorityRangeAggregationResultExtractor.php b/code_samples/search/custom/src/Query/Aggregation/Elasticsearch/PriorityRangeAggregationResultExtractor.php index ab64e1be3f3..5fd4f180480 100644 --- a/code_samples/search/custom/src/Query/Aggregation/Elasticsearch/PriorityRangeAggregationResultExtractor.php +++ b/code_samples/search/custom/src/Query/Aggregation/Elasticsearch/PriorityRangeAggregationResultExtractor.php @@ -12,13 +12,18 @@ final class PriorityRangeAggregationResultExtractor implements AggregationResultExtractor { - public function supports(Aggregation $aggregation, LanguageFilter $languageFilter): bool - { + public function supports( + Aggregation $aggregation, + LanguageFilter $languageFilter + ): bool { return $aggregation instanceof PriorityRangeAggregation; } - public function extract(Aggregation $aggregation, LanguageFilter $languageFilter, array $data): AggregationResult - { + public function extract( + Aggregation $aggregation, + LanguageFilter $languageFilter, + array $data + ): AggregationResult { $entries = []; foreach ($data['buckets'] as $bucket) { diff --git a/code_samples/search/custom/src/Query/Aggregation/Elasticsearch/PriorityRangeAggregationVisitor.php b/code_samples/search/custom/src/Query/Aggregation/Elasticsearch/PriorityRangeAggregationVisitor.php index 7782ff33b69..6795bcd978d 100644 --- a/code_samples/search/custom/src/Query/Aggregation/Elasticsearch/PriorityRangeAggregationVisitor.php +++ b/code_samples/search/custom/src/Query/Aggregation/Elasticsearch/PriorityRangeAggregationVisitor.php @@ -14,18 +14,23 @@ */ final class PriorityRangeAggregationVisitor implements AggregationVisitor { - public function supports(Aggregation $aggregation, LanguageFilter $languageFilter): bool - { + public function supports( + Aggregation $aggregation, + LanguageFilter $languageFilter + ): bool { return $aggregation instanceof PriorityRangeAggregation; } /** - * @param \App\Query\Aggregation\PriorityRangeAggregation $aggregation + * @param PriorityRangeAggregation $aggregation * * @return array> */ - public function visit(AggregationVisitor $dispatcher, Aggregation $aggregation, LanguageFilter $languageFilter): array - { + public function visit( + AggregationVisitor $dispatcher, + Aggregation $aggregation, + LanguageFilter $languageFilter + ): array { $ranges = []; foreach ($aggregation->getRanges() as $range) { diff --git a/code_samples/search/custom/src/Query/Aggregation/PriorityRangeAggregation.php b/code_samples/search/custom/src/Query/Aggregation/PriorityRangeAggregation.php index 2952020fcd0..7089067cb15 100644 --- a/code_samples/search/custom/src/Query/Aggregation/PriorityRangeAggregation.php +++ b/code_samples/search/custom/src/Query/Aggregation/PriorityRangeAggregation.php @@ -12,6 +12,4 @@ * * @phpstan-extends \Ibexa\Contracts\Core\Repository\Values\Content\Query\Aggregation\AbstractRangeAggregation */ -final class PriorityRangeAggregation extends AbstractRangeAggregation implements LocationAggregation -{ -} +final class PriorityRangeAggregation extends AbstractRangeAggregation implements LocationAggregation {} diff --git a/code_samples/search/custom/src/Query/Aggregation/Solr/PriorityRangeAggregationResultExtractor.php b/code_samples/search/custom/src/Query/Aggregation/Solr/PriorityRangeAggregationResultExtractor.php index a81fb9b7432..550c26f4726 100644 --- a/code_samples/search/custom/src/Query/Aggregation/Solr/PriorityRangeAggregationResultExtractor.php +++ b/code_samples/search/custom/src/Query/Aggregation/Solr/PriorityRangeAggregationResultExtractor.php @@ -15,13 +15,18 @@ final class PriorityRangeAggregationResultExtractor implements AggregationResultExtractor { - public function canVisit(Aggregation $aggregation, array $languageFilter): bool - { + public function canVisit( + Aggregation $aggregation, + array $languageFilter + ): bool { return $aggregation instanceof PriorityRangeAggregation; } - public function extract(Aggregation $aggregation, array $languageFilter, stdClass $data): AggregationResult - { + public function extract( + Aggregation $aggregation, + array $languageFilter, + stdClass $data + ): AggregationResult { $entries = []; foreach ($data as $key => $bucket) { if ($key === 'count' || !str_contains($key, '_')) { diff --git a/code_samples/search/custom/src/Query/Aggregation/Solr/PriorityRangeAggregationVisitor.php b/code_samples/search/custom/src/Query/Aggregation/Solr/PriorityRangeAggregationVisitor.php index 4f669dc70f9..22dfde06e5c 100644 --- a/code_samples/search/custom/src/Query/Aggregation/Solr/PriorityRangeAggregationVisitor.php +++ b/code_samples/search/custom/src/Query/Aggregation/Solr/PriorityRangeAggregationVisitor.php @@ -13,13 +13,15 @@ */ final class PriorityRangeAggregationVisitor implements AggregationVisitor { - public function canVisit(Aggregation $aggregation, array $languageFilter): bool - { + public function canVisit( + Aggregation $aggregation, + array $languageFilter + ): bool { return $aggregation instanceof PriorityRangeAggregation; } /** - * @param \App\Query\Aggregation\PriorityRangeAggregation $aggregation + * @param PriorityRangeAggregation $aggregation */ public function visit( AggregationVisitor $dispatcherVisitor, diff --git a/code_samples/search/custom/src/Query/Criterion/Elasticsearch/CameraManufacturerVisitor.php b/code_samples/search/custom/src/Query/Criterion/Elasticsearch/CameraManufacturerVisitor.php index 142990bbd76..58f2c79ecaf 100644 --- a/code_samples/search/custom/src/Query/Criterion/Elasticsearch/CameraManufacturerVisitor.php +++ b/code_samples/search/custom/src/Query/Criterion/Elasticsearch/CameraManufacturerVisitor.php @@ -11,16 +11,21 @@ final class CameraManufacturerVisitor implements CriterionVisitor { - public function supports(CriterionInterface $criterion, LanguageFilter $languageFilter): bool - { + public function supports( + CriterionInterface $criterion, + LanguageFilter $languageFilter + ): bool { return $criterion instanceof CameraManufacturerCriterion; } /** - * @param \App\Query\Criterion\CameraManufacturerCriterion $criterion + * @param CameraManufacturerCriterion $criterion */ - public function visit(CriterionVisitor $dispatcher, CriterionInterface $criterion, LanguageFilter $languageFilter): array - { + public function visit( + CriterionVisitor $dispatcher, + CriterionInterface $criterion, + LanguageFilter $languageFilter + ): array { return [ 'terms' => [ 'exif_camera_manufacturer_id' => (array)$criterion->value, diff --git a/code_samples/search/custom/src/Query/Criterion/Solr/CameraManufacturerVisitor.php b/code_samples/search/custom/src/Query/Criterion/Solr/CameraManufacturerVisitor.php index c4cf00e5982..1a4622ebd43 100644 --- a/code_samples/search/custom/src/Query/Criterion/Solr/CameraManufacturerVisitor.php +++ b/code_samples/search/custom/src/Query/Criterion/Solr/CameraManufacturerVisitor.php @@ -16,10 +16,12 @@ public function canVisit(CriterionInterface $criterion): bool } /** - * @param \App\Query\Criterion\CameraManufacturerCriterion $criterion + * @param CameraManufacturerCriterion $criterion */ - public function visit(CriterionInterface $criterion, ?CriterionVisitor $subVisitor = null): string - { + public function visit( + CriterionInterface $criterion, + ?CriterionVisitor $subVisitor = null + ): string { $expressions = array_map( fn ($value): string => 'exif_camera_manufacturer_id:"' . $this->escapeQuote((string) $value) . '"', $criterion->value diff --git a/code_samples/search/custom/src/Query/SortClause/Elasticsearch/ScoreVisitor.php b/code_samples/search/custom/src/Query/SortClause/Elasticsearch/ScoreVisitor.php index 45a35b808cf..471031306a6 100644 --- a/code_samples/search/custom/src/Query/SortClause/Elasticsearch/ScoreVisitor.php +++ b/code_samples/search/custom/src/Query/SortClause/Elasticsearch/ScoreVisitor.php @@ -12,13 +12,18 @@ final class ScoreVisitor implements SortClauseVisitor { - public function supports(SortClause $sortClause, LanguageFilter $languageFilter): bool - { + public function supports( + SortClause $sortClause, + LanguageFilter $languageFilter + ): bool { return $sortClause instanceof ScoreSortClause; } - public function visit(SortClauseVisitor $visitor, SortClause $sortClause, LanguageFilter $languageFilter): array - { + public function visit( + SortClauseVisitor $visitor, + SortClause $sortClause, + LanguageFilter $languageFilter + ): array { $order = $sortClause->direction === Query::SORT_ASC ? 'asc' : 'desc'; return [ diff --git a/code_samples/search/custom/src/Search/FieldMapper/WebinarEventParentNameFieldMapper.php b/code_samples/search/custom/src/Search/FieldMapper/WebinarEventParentNameFieldMapper.php index a02e3a04a0f..6c894f539bb 100644 --- a/code_samples/search/custom/src/Search/FieldMapper/WebinarEventParentNameFieldMapper.php +++ b/code_samples/search/custom/src/Search/FieldMapper/WebinarEventParentNameFieldMapper.php @@ -6,6 +6,7 @@ use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Search; +use Ibexa\Contracts\Core\Search\Field; use Ibexa\Contracts\Solr\FieldMapper\ContentFieldMapper; class WebinarEventParentNameFieldMapper extends ContentFieldMapper @@ -13,8 +14,7 @@ class WebinarEventParentNameFieldMapper extends ContentFieldMapper public function __construct( protected ContentHandler $contentHandler, protected LocationHandler $locationHandler - ) { - } + ) {} public function accept(Content $content): bool { @@ -23,7 +23,7 @@ public function accept(Content $content): bool } /** - * @return \Ibexa\Contracts\Core\Search\Field[] + * @return Field[] */ public function mapFields(Content $content): array { @@ -33,7 +33,7 @@ public function mapFields(Content $content): array $parentContentInfo = $this->contentHandler->loadContentInfo($parentLocation->contentId); return [ - new Search\Field( + new Field( 'parent_name', $parentContentInfo->name, new Search\FieldType\StringField() diff --git a/code_samples/search/location/isbookmarked_criterion.php b/code_samples/search/location/isbookmarked_criterion.php index c61bf951b19..c7a67f7316b 100644 --- a/code_samples/search/location/isbookmarked_criterion.php +++ b/code_samples/search/location/isbookmarked_criterion.php @@ -1,9 +1,10 @@ filter = new IsBookmarked(); -/** @var \Ibexa\Contracts\Core\Repository\SearchService $searchService */ +/** @var SearchService $searchService */ $results = $searchService->findLocations($query); diff --git a/code_samples/shopping_list/add_to_shopping_list/src/Controller/ProductViewController.php b/code_samples/shopping_list/add_to_shopping_list/src/Controller/ProductViewController.php index 6a4ee6cde47..0e5fdfb877d 100644 --- a/code_samples/shopping_list/add_to_shopping_list/src/Controller/ProductViewController.php +++ b/code_samples/shopping_list/add_to_shopping_list/src/Controller/ProductViewController.php @@ -13,12 +13,12 @@ class ProductViewController extends AbstractController { - public function __construct(private readonly LocalProductServiceInterface $productService) - { - } + public function __construct(private readonly LocalProductServiceInterface $productService) {} - public function viewAction(Request $request, ContentView $view): View - { + public function viewAction( + Request $request, + ContentView $view + ): View { $product = $this->productService->getProductFromContent($view->getContent()); if ($product->isBaseProduct()) { $view->addParameters([ diff --git a/code_samples/shopping_list/php_api/src/Command/ShoppingListFilterCommand.php b/code_samples/shopping_list/php_api/src/Command/ShoppingListFilterCommand.php index 9001e099be2..88ade1f8c0c 100644 --- a/code_samples/shopping_list/php_api/src/Command/ShoppingListFilterCommand.php +++ b/code_samples/shopping_list/php_api/src/Command/ShoppingListFilterCommand.php @@ -24,8 +24,10 @@ public function __construct( parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $login = 'admin'; $desiredProductCodes = ['TODO', 'TODO']; $name = 'shopping-list-test-filtering'; @@ -56,8 +58,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int return Command::SUCCESS; } - private function displayList(OutputInterface $output, ShoppingListInterface $list): void - { + private function displayList( + OutputInterface $output, + ShoppingListInterface $list + ): void { $output->writeln("{$list->getOwner()->getName()} ({$list->getOwner()->getLogin()})"); $output->writeln("{$list->getName()} ({$list->getIdentifier()})" . ($list->isDefault() ? ' [default]' : '')); $entries = $list->getEntries(); diff --git a/code_samples/shopping_list/php_api/src/Command/ShoppingListMoveCommand.php b/code_samples/shopping_list/php_api/src/Command/ShoppingListMoveCommand.php index 8d02d055b5e..03302d35faa 100644 --- a/code_samples/shopping_list/php_api/src/Command/ShoppingListMoveCommand.php +++ b/code_samples/shopping_list/php_api/src/Command/ShoppingListMoveCommand.php @@ -24,8 +24,10 @@ public function __construct( parent::__construct(); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $login = 'admin'; $productCodes = ['TODO', 'TODO']; $movedProductCodes = $productCodes; @@ -62,8 +64,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int return Command::SUCCESS; } - private function displayList(OutputInterface $output, ShoppingListInterface $list): void - { + private function displayList( + OutputInterface $output, + ShoppingListInterface $list + ): void { $output->writeln("{$list->getOwner()->getName()} ({$list->getOwner()->getLogin()})"); $output->writeln("{$list->getName()} ({$list->getIdentifier()})" . ($list->isDefault() ? ' [default]' : '')); $entries = $list->getEntries(); diff --git a/code_samples/shopping_list/php_api/src/Controller/CartShoppingListTransferController.php b/code_samples/shopping_list/php_api/src/Controller/CartShoppingListTransferController.php index e65fce2e1db..01758aa43d6 100644 --- a/code_samples/shopping_list/php_api/src/Controller/CartShoppingListTransferController.php +++ b/code_samples/shopping_list/php_api/src/Controller/CartShoppingListTransferController.php @@ -5,6 +5,7 @@ use Ibexa\Contracts\Cart\CartServiceInterface; use Ibexa\Contracts\Cart\CartShoppingListTransferServiceInterface; use Ibexa\Contracts\Cart\Value\CartCreateStruct; +use Ibexa\Contracts\Cart\Value\CartInterface; use Ibexa\Contracts\Cart\Value\CartQuery; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; @@ -30,8 +31,7 @@ public function __construct( private readonly ShoppingListServiceInterface $shoppingListService, private readonly CartShoppingListTransferServiceInterface $cartShoppingListTransferService, private readonly LocalProductServiceInterface $productService - ) { - } + ) {} #[Route( path: '/app-shopping-list-cart', @@ -49,13 +49,7 @@ public function __invoke(Request $request): Response $cartQuery = new CartQuery(); $cartQuery->setOwnerId($user->getId()); $cartsList = $this->cartService->findCarts($cartQuery); - $cart = null; - foreach ($cartsList->getCarts() as $cartItem) { - if ($cartItem->getName() === $name) { - $cart = $cartItem; - break; - } - } + $cart = array_find($cartsList->getCarts(), static fn (CartInterface $cartItem): bool => $cartItem->getName() === $name); if (null === $cart) { $cart = $this->cartService->createCart(new CartCreateStruct($name, $this->currencyService->getCurrencyByCode($currency), $user)); } diff --git a/code_samples/shopping_list/search/criteria.php b/code_samples/shopping_list/search/criteria.php index 18c0ae2429a..054c916e001 100644 --- a/code_samples/shopping_list/search/criteria.php +++ b/code_samples/shopping_list/search/criteria.php @@ -1,9 +1,10 @@ getCurrentUserReference()), diff --git a/code_samples/shopping_list/search/sort_clauses.php b/code_samples/shopping_list/search/sort_clauses.php index 4927957c09b..8530a64aa44 100644 --- a/code_samples/shopping_list/search/sort_clauses.php +++ b/code_samples/shopping_list/search/sort_clauses.php @@ -1,10 +1,11 @@ findShoppingLists( new ShoppingListQuery( null, diff --git a/code_samples/translations_management/src/TranslationsManagement/ImageAltTextTransformer.php b/code_samples/translations_management/src/TranslationsManagement/ImageAltTextTransformer.php index d11ec9b1305..350bf28905b 100644 --- a/code_samples/translations_management/src/TranslationsManagement/ImageAltTextTransformer.php +++ b/code_samples/translations_management/src/TranslationsManagement/ImageAltTextTransformer.php @@ -34,8 +34,11 @@ public function encode(Field $field): EncodedFieldValue /** * @param array $metadata */ - public function decode(string $value, mixed $previousFieldValue, array $metadata): Value - { + public function decode( + string $value, + mixed $previousFieldValue, + array $metadata + ): Value { if (!$previousFieldValue instanceof ImageValue) { throw new InvalidArgumentException( '$previousFieldValue', diff --git a/code_samples/translations_management/src/TranslationsManagement/MyApiClient.php b/code_samples/translations_management/src/TranslationsManagement/MyApiClient.php index 4091bb52859..19428fdd394 100644 --- a/code_samples/translations_management/src/TranslationsManagement/MyApiClient.php +++ b/code_samples/translations_management/src/TranslationsManagement/MyApiClient.php @@ -7,8 +7,11 @@ /** Placeholder for your own HTTP client or third-party SDK wrapper. */ final class MyApiClient { - public function translate(string $text, string $sourceLanguage, string $targetLanguage): string - { + public function translate( + string $text, + string $sourceLanguage, + string $targetLanguage + ): string { // Your implementation here. return ''; } diff --git a/code_samples/translations_management/src/TranslationsManagement/MyCustomAiProvider.php b/code_samples/translations_management/src/TranslationsManagement/MyCustomAiProvider.php index b1a2c4bf12a..33353fa67bd 100644 --- a/code_samples/translations_management/src/TranslationsManagement/MyCustomAiProvider.php +++ b/code_samples/translations_management/src/TranslationsManagement/MyCustomAiProvider.php @@ -16,8 +16,7 @@ public function __construct( private MyApiClient $apiClient, private string $actionConfigurationIdentifier, - ) { - } + ) {} public function getIdentifier(): string { diff --git a/code_samples/translations_management/src/TranslationsManagement/MyCustomProvider.php b/code_samples/translations_management/src/TranslationsManagement/MyCustomProvider.php index e726d3435fd..204b93e79b8 100644 --- a/code_samples/translations_management/src/TranslationsManagement/MyCustomProvider.php +++ b/code_samples/translations_management/src/TranslationsManagement/MyCustomProvider.php @@ -15,8 +15,7 @@ */ public function __construct( private MyApiClient $apiClient, - ) { - } + ) {} public function getIdentifier(): string { diff --git a/code_samples/tutorials/page_tutorial/src/Event/RandomBlockListener.php b/code_samples/tutorials/page_tutorial/src/Event/RandomBlockListener.php index 04d20d6b935..580273da51a 100644 --- a/code_samples/tutorials/page_tutorial/src/Event/RandomBlockListener.php +++ b/code_samples/tutorials/page_tutorial/src/Event/RandomBlockListener.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\FieldTypePage\FieldType\Page\Block\Renderer\BlockRenderEvents; use Ibexa\FieldTypePage\FieldType\Page\Block\Renderer\Event\PreRenderEvent; +use Ibexa\FieldTypePage\FieldType\Page\Block\Renderer\Twig\TwigRenderRequest; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class RandomBlockListener implements EventSubscriberInterface @@ -20,8 +21,7 @@ public function __construct( private readonly ContentService $contentService, private readonly LocationService $locationService, private readonly SearchService $searchService - ) { - } + ) {} public static function getSubscribedEvents(): array { @@ -33,7 +33,7 @@ public static function getSubscribedEvents(): array public function onBlockPreRender(PreRenderEvent $event): void { $blockValue = $event->getBlockValue(); - /** @var \Ibexa\FieldTypePage\FieldType\Page\Block\Renderer\Twig\TwigRenderRequest $renderRequest */ + /** @var TwigRenderRequest $renderRequest */ $renderRequest = $event->getRenderRequest(); $parameters = $renderRequest->getParameters(); diff --git a/code_samples/user_management/in_memory/src/EventSubscriber/AuthenticationTokenCreatedSubscriber.php b/code_samples/user_management/in_memory/src/EventSubscriber/AuthenticationTokenCreatedSubscriber.php index 4f351028c54..9a24a9f89ee 100644 --- a/code_samples/user_management/in_memory/src/EventSubscriber/AuthenticationTokenCreatedSubscriber.php +++ b/code_samples/user_management/in_memory/src/EventSubscriber/AuthenticationTokenCreatedSubscriber.php @@ -16,8 +16,7 @@ public function __construct( private readonly ConfigResolverInterface $configResolver, private readonly UserService $userService, private readonly array $userMap = [], - ) { - } + ) {} public static function getSubscribedEvents(): array { diff --git a/code_samples/user_management/oauth_google/src/OAuth/GoogleResourceOwnerMapper.php b/code_samples/user_management/oauth_google/src/OAuth/GoogleResourceOwnerMapper.php index cbd1d14a74d..b82f2c29ceb 100644 --- a/code_samples/user_management/oauth_google/src/OAuth/GoogleResourceOwnerMapper.php +++ b/code_samples/user_management/oauth_google/src/OAuth/GoogleResourceOwnerMapper.php @@ -31,7 +31,7 @@ public function __construct( } /** - * @param \League\OAuth2\Client\Provider\GoogleUser $resourceOwner + * @param GoogleUser $resourceOwner */ protected function loadUser( ResourceOwnerInterface $resourceOwner, @@ -41,7 +41,7 @@ protected function loadUser( } /** - * @param \League\OAuth2\Client\Provider\GoogleUser $resourceOwner + * @param GoogleUser $resourceOwner */ protected function createUser( ResourceOwnerInterface $resourceOwner, diff --git a/code_samples/workflow/custom_workflow/src/EventListener/ApprovedTransitionListener.php b/code_samples/workflow/custom_workflow/src/EventListener/ApprovedTransitionListener.php index 1e6d72e7010..d113b372c27 100644 --- a/code_samples/workflow/custom_workflow/src/EventListener/ApprovedTransitionListener.php +++ b/code_samples/workflow/custom_workflow/src/EventListener/ApprovedTransitionListener.php @@ -10,9 +10,7 @@ class ApprovedTransitionListener extends AbstractTransitionWorkflowActionListener { - public function __construct(private readonly NotificationInterface $notificationHandler) - { - } + public function __construct(private readonly NotificationInterface $notificationHandler) {} public function getIdentifier(): string { diff --git a/code_samples/workflow/custom_workflow/src/EventListener/LegalTransitionListener.php b/code_samples/workflow/custom_workflow/src/EventListener/LegalTransitionListener.php index 067f46ee142..8bf9453e9dc 100644 --- a/code_samples/workflow/custom_workflow/src/EventListener/LegalTransitionListener.php +++ b/code_samples/workflow/custom_workflow/src/EventListener/LegalTransitionListener.php @@ -6,13 +6,15 @@ use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface as NotificationInterface; use Ibexa\Contracts\Workflow\Event\Action\AbstractTransitionWorkflowActionListener; +use Ibexa\Contracts\Workflow\Registry\WorkflowRegistryInterface; use Symfony\Component\Workflow\Event\TransitionEvent; class LegalTransitionListener extends AbstractTransitionWorkflowActionListener { - public function __construct(private readonly NotificationInterface $notificationHandler) - { - } + public function __construct( + private readonly NotificationInterface $notificationHandler, + protected WorkflowRegistryInterface $workflowRegistry + ) {} public function getIdentifier(): string { @@ -21,7 +23,8 @@ public function getIdentifier(): string public function onWorkflowEvent(TransitionEvent $event): void { - $metadata = $this->getActionMetadata($event->getWorkflow(), $event->getTransition()); + $workflow = $this->workflowRegistry->getWorkflow($event->getWorkflowName()); + $metadata = $this->getActionMetadata($workflow, $event->getTransition()); $message = $metadata['data']['message'] ?? ''; $this->notificationHandler->info( diff --git a/composer.json b/composer.json index ca8f37eff0a..56e3905b791 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "symfony/yaml": "^8.1", "ibexa/api-platform": "~6.0.x-dev", "ibexa/connector-gemini": "6.0.x-dev", - "ibexa/code-style": "~2.0.0", + "ibexa/code-style": "~2.0", "friendsofphp/php-cs-fixer": "^3.30", "phpstan/phpstan": "^2.0", "phpstan/phpstan-symfony": "^2.0", diff --git a/deptrac.baseline.yaml b/deptrac.baseline.yaml index 0d74c2a7ef3..cef67b4a11a 100644 --- a/deptrac.baseline.yaml +++ b/deptrac.baseline.yaml @@ -36,9 +36,6 @@ deptrac: - Ibexa\Collaboration\Persistence\Values\AbstractSessionCreateStruct App\Collaboration\Cart\Persistence\Values\CartSessionUpdateStruct: - Ibexa\Collaboration\Persistence\Values\AbstractSessionUpdateStruct - App\Command\AddMissingAltTextCommand: - - Ibexa\Core\FieldType\Image\Value - - Ibexa\Core\IO\IOBinarydataHandler App\Command\CalendarCommand: - Ibexa\Scheduler\Calendar\EventAction\RescheduleEventActionContext App\Command\CatalogCommand: @@ -59,9 +56,6 @@ deptrac: - Ibexa\ProductCatalog\Money\IntlMoneyFactory App\Command\PaymentMethodCommand: - Ibexa\Payment\Values\PaymentMethodType - App\Command\SegmentCommand: - - Ibexa\Segmentation\Value\SegmentCreateStruct - - Ibexa\Segmentation\Value\SegmentGroupCreateStruct App\Command\ShippingMethodCommand: - Ibexa\ProductCatalog\Local\Repository\Values\Region - Ibexa\Shipping\Value\ShippingMethodType @@ -96,6 +90,7 @@ deptrac: - Ibexa\Core\MVC\Symfony\View\View App\Controller\RideController: - Ibexa\Bundle\Core\Controller + - Ibexa\Core\FieldType\RelationList\Value - Ibexa\Core\MVC\Symfony\View\ContentView App\Controller\SvgController: - Ibexa\Core\Helper\TranslationHelper @@ -227,9 +222,6 @@ deptrac: - Ibexa\Core\QueryType\QueryType App\Search\Model\Suggestion\ProductSuggestion: - Ibexa\ProductCatalog\Local\Repository\Values\Product - App\Security\FormPolicyProvider: - - Ibexa\Bundle\Core\DependencyInjection\Configuration\ConfigBuilderInterface - - Ibexa\Bundle\Core\DependencyInjection\Security\PolicyProvider\PolicyProviderInterface App\Security\FormSubmissionServiceDecorator: - Ibexa\Core\Base\Exceptions\NotFoundException - Ibexa\Core\Base\Exceptions\UnauthorizedException @@ -279,3 +271,5 @@ deptrac: - Ibexa\AdminUi\UniversalDiscovery\Event\ConfigResolveEvent MyMapper: - Ibexa\ContentForms\Form\Type\FieldType\CheckboxFieldType + NavigationController: + - Ibexa\Bundle\Core\Controller diff --git a/docs/administration/back_office/back_office_elements/extending_thumbnails.md b/docs/administration/back_office/back_office_elements/extending_thumbnails.md index 0966ee80541..38b23bc098a 100644 --- a/docs/administration/back_office/back_office_elements/extending_thumbnails.md +++ b/docs/administration/back_office/back_office_elements/extending_thumbnails.md @@ -93,8 +93,10 @@ class FieldValueUrl implements FieldTypeBasedThumbnailStrategy return 'ibexa_text'; } - public function getThumbnail(Field $field, ?VersionInfo $versionInfo = null): ?Thumbnail - { + public function getThumbnail( + Field $field, + ?VersionInfo $versionInfo = null + ): ?Thumbnail { return new Thumbnail([ 'resource' => $field->value, ]); diff --git a/docs/administration/back_office/back_office_menus/back_office_menus.md b/docs/administration/back_office/back_office_menus/back_office_menus.md index 0290c90c872..b3d7e6c9993 100644 --- a/docs/administration/back_office/back_office_menus/back_office_menus.md +++ b/docs/administration/back_office/back_office_menus/back_office_menus.md @@ -86,7 +86,9 @@ The following method adds a new menu section under **Content**, and under it, a You can also pass parameters to templates used to render menu items with `template_parameters`: ``` php -/** @var \Knp\Menu\ItemInterface $menu */ +use Knp\Menu\ItemInterface; + +/** @var ItemInterface $menu */ $menu->addChild( 'all_content_list', [ @@ -107,7 +109,9 @@ You can then use the variable `custom_parameter` in `templates/themes/admin/list To have translatable labels, use `translation.key` from the `messages` domain: ``` php -/** @var \Knp\Menu\ItemInterface $menu */ +use Knp\Menu\ItemInterface; + +/** @var ItemInterface $menu */ $menu->addChild( 'all_content_list', [ diff --git a/docs/administration/back_office/customize_calendar.md b/docs/administration/back_office/customize_calendar.md index b73e371334f..e71d634c757 100644 --- a/docs/administration/back_office/customize_calendar.md +++ b/docs/administration/back_office/customize_calendar.md @@ -82,9 +82,10 @@ To add an in-memory collection as an event source, create `src/Calendar/Holidays ``` php use App\Calendar\Holidays\Event; + use App\Calendar\Holidays\EventType; use Ibexa\Contracts\Calendar\EventCollection; - /** @var \App\Calendar\Holidays\EventType $eventType */ + /** @var EventType $eventType */ $collection = new EventCollection([ new Event('Event 1', new DateTime('2024-01-01'), $eventType), new Event('Event 2', new DateTime('2024-01-02'), $eventType), diff --git a/docs/administration/back_office/notifications.md b/docs/administration/back_office/notifications.md index 352934598ab..ca2b7952658 100644 --- a/docs/administration/back_office/notifications.md +++ b/docs/administration/back_office/notifications.md @@ -26,7 +26,9 @@ There are four types of notifications: `info`, `success`, `warning` and `error`. To send a notification from PHP, inject the `TranslatableNotificationHandlerInterface` into your class. ``` php -/** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface $notificationHandler */ +use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; + +/** @var TranslatableNotificationHandlerInterface $notificationHandler */ $notificationHandler->info( /** @Desc("Notification text") */ 'example.notification.text', diff --git a/docs/administration/configuration/configuration.md b/docs/administration/configuration/configuration.md index 064d8ac3e45..3247edde16a 100644 --- a/docs/administration/configuration/configuration.md +++ b/docs/administration/configuration/configuration.md @@ -73,8 +73,10 @@ parameters: ``` ``` php +use Symfony\Component\DependencyInjection\ContainerInterface; + // Usage inside a controller -/** @var \Symfony\Component\DependencyInjection\ContainerInterface $container */ +/** @var ContainerInterface $container */ $myParameter = $container->getParameter('myapp.parameter.name'); ``` diff --git a/docs/administration/configuration/dynamic_configuration.md b/docs/administration/configuration/dynamic_configuration.md index c5ebd43fe35..df5b1ee9ef7 100644 --- a/docs/administration/configuration/dynamic_configuration.md +++ b/docs/administration/configuration/dynamic_configuration.md @@ -84,9 +84,7 @@ use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; class Service { - public function __construct(private readonly ConfigResolverInterface $configResolver) - { - } + public function __construct(private readonly ConfigResolverInterface $configResolver) {} public function someMethodThatNeedConfig(): void { diff --git a/docs/administration/configuration/repository_configuration.md b/docs/administration/configuration/repository_configuration.md index dddcccebe13..1e5be86e36b 100644 --- a/docs/administration/configuration/repository_configuration.md +++ b/docs/administration/configuration/repository_configuration.md @@ -327,6 +327,7 @@ final class CustomRepositoryConfigParser implements RepositoryConfigParserInterf You need to register this configuration extension in the following way: ``` php +use Ibexa\Bundle\Core\DependencyInjection\IbexaCoreExtension; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; @@ -336,7 +337,7 @@ final class AcmeFeatureBundle extends Bundle { // ... - /** @var Ibexa\Bundle\Core\DependencyInjection\IbexaCoreExtension $kernel */ + /** @var IbexaCoreExtension $kernel */ $kernel = $container->getExtension('ibexa'); $kernel->addRepositoryConfigParser(new CustomRepositoryConfigParser()); } @@ -346,6 +347,8 @@ final class AcmeFeatureBundle extends Bundle To access the configuration settings, use the `Ibexa\Bundle\Core\ApiLoader\RepositoryConfigurationProvider::getRepositoryConfig` method: ``` php -/** @var \Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface $repositoryConfigProvider */ +use Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface; + +/** @var RepositoryConfigurationProviderInterface $repositoryConfigProvider */ $acmeConfig = $repositoryConfigProvider->getRepositoryConfig()['acme']; ``` diff --git a/docs/ai/ai_actions/configure_ai_actions.md b/docs/ai/ai_actions/configure_ai_actions.md index 5e1eccbf1b9..716965b28a6 100644 --- a/docs/ai/ai_actions/configure_ai_actions.md +++ b/docs/ai/ai_actions/configure_ai_actions.md @@ -106,9 +106,11 @@ composer require ibexa/connector-gemini Then, if not using Symfony Flex, enable the bundle in `config/bundles.php`: ``` php +use Ibexa\Bundle\ConnectorGemini\IbexaConnectorGeminiBundle; + return [ // ... - Ibexa\Bundle\ConnectorGemini\IbexaConnectorGeminiBundle::class => ['all' => true], + IbexaConnectorGeminiBundle::class => ['all' => true], ]; ``` diff --git a/docs/ai/ai_actions/extend_ai_actions.md b/docs/ai/ai_actions/extend_ai_actions.md index 69913215e44..90ffc1aec7f 100644 --- a/docs/ai/ai_actions/extend_ai_actions.md +++ b/docs/ai/ai_actions/extend_ai_actions.md @@ -14,7 +14,7 @@ For example, you can create a handler that connects to a translation model and u You can execute AI Actions by using the [ActionServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionServiceInterface.html) service, as in the following example: ``` php -[[= include_code('code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php', 87, 105, remove_indent=True) =]] +[[= include_code('code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php', 92, 110, remove_indent=True) =]] ``` The `GenerateAltTextAction` is a built-in action that implements the [ActionInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionInterface.html), takes an [Image](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-DataType-Image.html) as an input, and generates the alternative text in the response. @@ -43,7 +43,7 @@ You can influence the execution of an Action with two events: Below you can find the full example of a Symfony Command, together with a matching service definition. The command finds the images modified in the last 24 hours, and adds the alternative text to them if it's missing. -``` php hl_lines="72 85-110" +``` php hl_lines="75 88-115" [[= include_code('code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php') =]] ``` @@ -77,7 +77,7 @@ See [Action Configuration Search Criteria reference](action_configuration_criter The following example creates a new Action Configuration: ``` php hl_lines="3 17" -[[= include_code('code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php', 47, 63, remove_indent=True) =]] +[[= include_code('code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php', 49, 65, remove_indent=True) =]] ``` Actions Configurations are tied to a specific Action Type and are translatable. @@ -88,7 +88,7 @@ Reuse existing Action Configurations to simplify the execution of AI Actions. You can pass one directly to the `ActionServiceInterface::execute()` method: ``` php hl_lines="7-8" -[[= include_code('code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php', 65, 72, remove_indent=True) =]] +[[= include_code('code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php', 67, 74, remove_indent=True) =]] ``` The passed Action Configuration is only taken into account if the Action Context was not passed to the Action directly using the [ActionInterface::setActionContext()](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionInterface.html#method_hasActionContext) method. @@ -116,7 +116,7 @@ Create a class implementing the [ActionHandlerInterface](/api/php_api/php_api_re See the code sample below, together with a matching service definition: -``` php hl_lines="17 25-28 30-65 67-70" +``` php hl_lines="17 24-27 29-66 68-71" [[= include_code('code_samples/ai_actions/src/AI/Handler/LLaVaTextToTextActionHandler.php') =]] ``` @@ -136,7 +136,7 @@ The built-in Action Types use service tags to find Action Handlers capable of ha Form configuration makes the Handler configurable by using the back office. The example handler uses the `system_prompt` option, which becomes part of the Action Configuration UI thanks to the following code: -``` php hl_lines="16-20" +``` php hl_lines="18-22" [[= include_code('code_samples/ai_actions/src/Form/Type/TextToTextOptionsType.php') =]] ``` @@ -216,7 +216,7 @@ The `TranscribeAudio` Action Type requires adding two data classes that exist in Custom Form Type is needed if the Action Type requires additional options configurable in the UI. The following example adds a checkbox field that indicates to the Action Handler whether the transcription should include the timestamps. -``` php hl_lines="16-20" +``` php hl_lines="18-22" [[= include_code('code_samples/ai_actions/src/Form/Type/TranscribeAudioOptionsType.php') =]] ``` @@ -232,7 +232,7 @@ An example Action Handler combines the input data and the Action Type options an The language of the transcribed data is extracted from the Runtime Context for better results. The Action Type options provided in the Action Context dictate whether the timestamps will be removed before returning the result. -``` php hl_lines="34-37 52-55" +``` php hl_lines="37-40 55-58" [[= include_code('code_samples/ai_actions/src/AI/Handler/WhisperAudioToTextActionHandler.php') =]] ``` diff --git a/docs/api/graphql/graphql_custom_ft.md b/docs/api/graphql/graphql_custom_ft.md index 59b4018fbd5..0124edd7ee6 100644 --- a/docs/api/graphql/graphql_custom_ft.md +++ b/docs/api/graphql/graphql_custom_ft.md @@ -60,8 +60,8 @@ It requires that you implement the `getFieldTypeIdentifier` method to tell which Add `MyFieldDefinitionMapper.php` mapper to `src/GraphQL/Schema`: ``` php -[[= include_code('code_samples/api/graphql/src/GraphQL/Schema/MyFieldDefinitionMapper.php', 1, 17) =]] -[[= include_code('code_samples/api/graphql/src/GraphQL/Schema/MyFieldDefinitionMapper.php', 38, 39) =]] +[[= include_code('code_samples/api/graphql/src/GraphQL/Schema/MyFieldDefinitionMapper.php', 1, 16) =]] +} ``` The `FieldDefinitionMapper` interface defines following methods: @@ -76,7 +76,7 @@ When a mapper method is decorated, you need to call the decorated service method To do that, you need to replace `mapXXX` by the method it's in: ``` php -[[= include_code('code_samples/api/graphql/src/GraphQL/Schema/MyFieldDefinitionMapper.php', 21, 24, remove_indent=True) =]] +[[= include_code('code_samples/api/graphql/src/GraphQL/Schema/MyFieldDefinitionMapper.php', 23, 25, remove_indent=True) =]] ``` It's required for every implemented method, so that other mappers are called for the other field types. diff --git a/docs/api/notification_channels.md b/docs/api/notification_channels.md index dca42abde4c..af4582732b6 100644 --- a/docs/api/notification_channels.md +++ b/docs/api/notification_channels.md @@ -226,7 +226,7 @@ The [`…\Service\NotificationServiceInterface::send()`](/api/php_api/php_api_re For example, to send a notification, you often use a combination like the following: -``` php hl_lines="13-16" +``` php hl_lines="16-18" [[= include_code('code_samples/api/notifications/notification_send.php', 2) =]] ``` diff --git a/docs/commerce/cart/cart_api.md b/docs/commerce/cart/cart_api.md index 1b89eec34e7..95d43c51161 100644 --- a/docs/commerce/cart/cart_api.md +++ b/docs/commerce/cart/cart_api.md @@ -23,7 +23,7 @@ From the developer's perspective, carts and entries are referenced with a UUID i To access a single cart, use the `CartServiceInterface::getCart` method: ``` php -[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 64, 66, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 66, 68, remove_indent=True) =]] ``` ## Get multiple carts @@ -32,10 +32,11 @@ To fetch multiple carts, use the `CartServiceInterface::findCarts` method. It follows the same search Query pattern as other APIs: ``` php -[[= include_file('code_samples/api/commerce/src/Command/CartCommand.php', 10, 11) =]] +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 11, 11) =]] + // ... -[[= include_file('code_samples/api/commerce/src/Command/CartCommand.php', 49, 57) =]] +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 52, 59) =]] ``` ## Create cart @@ -43,10 +44,11 @@ It follows the same search Query pattern as other APIs: To create a cart, use the `CartServiceInterface::createCart` method and provide it with `Ibexa\Contracts\Cart\Value\CartCreateStruct` that contains metadata (name, currency, owner): ``` php -[[= include_file('code_samples/api/commerce/src/Command/CartCommand.php', 8, 9) =]] +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 9, 9) =]] + // ... -[[= include_file('code_samples/api/commerce/src/Command/CartCommand.php', 70, 78) =]] +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 73, 80) =]] ``` ## Update cart metadata @@ -56,23 +58,27 @@ You could do it to support a scenario when, for example, the user changes a curr To update cart metadata, use the `CartServiceInterface::updateCartMetadata` method: ``` php -[[= include_file('code_samples/api/commerce/src/Command/CartCommand.php', 9, 10) =]] +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 10, 10) =]] + // ... -[[= include_file('code_samples/api/commerce/src/Command/CartCommand.php', 82, 89) =]] +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 85, 91) =]] ``` You can also use this method to change cart ownership: ``` php +use Ibexa\Contracts\Cart\CartServiceInterface; +use Ibexa\Contracts\Cart\Value\CartInterface; use Ibexa\Contracts\Cart\Value\CartMetadataUpdateStruct; +use Ibexa\Contracts\Core\Repository\UserService; // ... /** - * @var \Ibexa\Contracts\Core\Repository\UserService $userService - * @var \Ibexa\Contracts\Cart\CartServiceInterface $cartService - * @var \Ibexa\Contracts\Cart\Value\CartInterface $cart + * @var UserService $userService + * @var CartServiceInterface $cartService + * @var CartInterface $cart */ $updateMetadataStruct = new CartMetadataUpdateStruct(); $updateMetadataStruct->setOwner($userService->loadUserByLogin('user')); @@ -85,8 +91,9 @@ $cart = $cartService->updateCartMetadata($cart, $updateMetadataStruct); To delete a cart permanently, use the `CartServiceInterface::deleteCart` method and pass the `CartInterface` object: ``` php -[[= include_file('code_samples/api/commerce/src/Command/CartCommand.php', 63, 64) =]] -[[= include_file('code_samples/api/commerce/src/Command/CartCommand.php', 124, 125) =]] +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 66, 66) =]] + +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 127, 127) =]] ``` ## Empty cart @@ -94,8 +101,9 @@ To delete a cart permanently, use the `CartServiceInterface::deleteCart` method To remove all products from the cart in a single operation, use the `CartServiceInterface::emptyCart` method: ``` php -[[= include_file('code_samples/api/commerce/src/Command/CartCommand.php', 63, 64) =]] -[[= include_file('code_samples/api/commerce/src/Command/CartCommand.php', 91, 92) =]] +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 66, 66) =]] + +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 94, 94) =]] ``` ## Check cart validity @@ -106,8 +114,9 @@ To validate the cart, use the `CartServiceInterface::validateCart` method. Validation is done with help from the `symfony/validator` component, and the method returns a `Symfony\Component\Validator\ConstraintViolationListInterface` object. ``` php -[[= include_file('code_samples/api/commerce/src/Command/CartCommand.php', 63, 64) =]] -[[= include_file('code_samples/api/commerce/src/Command/CartCommand.php', 94, 95) =]] +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 66, 66) =]] + +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 97, 97) =]] ``` ## Add entry to cart @@ -116,11 +125,13 @@ To add entries (products) to the cart, create an `Ibexa\Contracts\Cart\Value\Ent Then pass it to the `CartServiceInterface::addEntry` method: ``` php -[[= include_file('code_samples/api/commerce/src/Command/CartCommand.php', 11, 12) =]] +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 12, 12) =]] + // ... -[[= include_file('code_samples/api/commerce/src/Command/CartCommand.php', 63, 64) =]] -[[= include_file('code_samples/api/commerce/src/Command/CartCommand.php', 99, 106) =]] +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 66, 66) =]] + +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 102, 108) =]] ``` ## Remove entry from cart @@ -128,8 +139,9 @@ Then pass it to the `CartServiceInterface::addEntry` method: To remove an entry from the cart, use the `CartServiceInterface::removeEntry` method. ``` php -[[= include_file('code_samples/api/commerce/src/Command/CartCommand.php', 63, 64) =]] -[[= include_file('code_samples/api/commerce/src/Command/CartCommand.php', 109, 112) =]] +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 66, 66) =]] + +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 112, 114) =]] ``` ## Update entry metadata @@ -138,12 +150,15 @@ Entries have their own metadata, for example, quantity. To change entry metadata, use the `CartServiceInterface::updateEntry` method and provide it with `Ibexa\Contracts\Cart\Value\EntryUpdateStruct`. ``` php -[[= include_file('code_samples/api/commerce/src/Command/CartCommand.php', 12, 13) =]] +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 13, 13) =]] + // ... -[[= include_file('code_samples/api/commerce/src/Command/CartCommand.php', 63, 64) =]] -[[= include_file('code_samples/api/commerce/src/Command/CartCommand.php', 109, 110) =]] -[[= include_file('code_samples/api/commerce/src/Command/CartCommand.php', 114, 122) =]] +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 66, 66) =]] + +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 112, 112) =]] + +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 117, 124) =]] ``` ## Adding context data @@ -156,12 +171,13 @@ It can include any relevant information that you want to associate with a partic To add context data to a cart, follow this example: ``` php +use Ibexa\Contracts\Cart\CartServiceInterface; use Ibexa\Contracts\Cart\Value\CartCreateStruct; use Ibexa\Contracts\Core\Collection\ArrayMap; use Ibexa\Contracts\ProductCatalog\Values\CurrencyInterface; /** - * @var \Ibexa\Contracts\Cart\CartServiceInterface $cartService + * @var CartServiceInterface $cartService * @var CurrencyInterface $currency */ $createStruct = new CartCreateStruct('My Cart', $currency); @@ -180,13 +196,15 @@ You also add "X1MF7699" coupon code as context data to the cart. To attach context data to a cart entry, proceed as follows: ``` php +use Ibexa\Contracts\Cart\CartServiceInterface; +use Ibexa\Contracts\Cart\Value\CartInterface; use Ibexa\Contracts\Cart\Value\EntryAddStruct; use Ibexa\Contracts\Core\Collection\ArrayMap; use Ibexa\ProductCatalog\Local\Repository\Values\Product; /** - * @var \Ibexa\Contracts\Cart\CartServiceInterface $cartService - * @var \Ibexa\Contracts\Cart\Value\CartInterface $cart + * @var CartServiceInterface $cartService + * @var CartInterface $cart * @var Product $product */ $entryAddStruct = new EntryAddStruct($product); @@ -194,7 +212,7 @@ $entryAddStruct->setContext(new ArrayMap([ 'tshirt_text' => 'EqEqEqEq', ])); - $cartService->addEntry($cart, $entryAddStruct); +$cartService->addEntry($cart, $entryAddStruct); ``` In the above example, you create a cart entry by using the `EntryAddStruct` method. @@ -207,5 +225,5 @@ To combine the contents of multiple shopping carts into a target cart, use the ` This operation is helpful when you want to consolidate items from a reorder cart and a current cart into a single order. ``` php -[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 127, 139, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/CartCommand.php', 129, 141, remove_indent=True) =]] ``` diff --git a/docs/commerce/checkout/checkout_api.md b/docs/commerce/checkout/checkout_api.md index cfcdb2655c8..c9cdc2c95c7 100644 --- a/docs/commerce/checkout/checkout_api.md +++ b/docs/commerce/checkout/checkout_api.md @@ -22,7 +22,7 @@ From the developer's perspective, checkouts are referenced with an UUID identifi To access a single checkout, use the `CheckoutServiceInterface::getCheckout` method: ``` php -[[= include_code('code_samples/api/commerce/src/Controller/CustomCheckoutController.php', 29, 29, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Controller/CustomCheckoutController.php', 28, 28, remove_indent=True) =]] ``` ## Get single checkout for specific cart @@ -31,7 +31,7 @@ To fetch checkout for a cart that already exists, use the `CheckoutServiceInterf You can use it when you want to initiate the checkout process right after products are successfully added to a cart. ``` php -[[= include_code('code_samples/api/commerce/src/Controller/CustomCheckoutController.php', 23, 26, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Controller/CustomCheckoutController.php', 22, 25, remove_indent=True) =]] ``` ## Create checkout @@ -39,7 +39,7 @@ You can use it when you want to initiate the checkout process right after produc To create a checkout, use the `CheckoutServiceInterface::createCheckout` method and provide it with a `CheckoutCreateStruct` struct that contains a `CartInterface` object. ``` php -[[= include_code('code_samples/api/commerce/src/Controller/CustomCheckoutController.php', 32, 37, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Controller/CustomCheckoutController.php', 31, 36, remove_indent=True) =]] ``` ## Update checkout @@ -53,7 +53,7 @@ To update the checkout, use the `CheckoutServiceInterface::updateCheckout` metho All data is placed in session storage. ``` php -[[= include_code('code_samples/api/commerce/src/Controller/CustomCheckoutController.php', 40, 41, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Controller/CustomCheckoutController.php', 39, 40, remove_indent=True) =]] ``` ## Delete checkout @@ -61,5 +61,5 @@ All data is placed in session storage. To delete a checkout from the session, use the `CheckoutServiceInterface::deleteCheckout` method: ``` php -[[= include_code('code_samples/api/commerce/src/Controller/CustomCheckoutController.php', 44, 44, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Controller/CustomCheckoutController.php', 43, 43, remove_indent=True) =]] ``` diff --git a/docs/commerce/order_management/order_management_api.md b/docs/commerce/order_management/order_management_api.md index 2dd2863c612..a08493b5fe8 100644 --- a/docs/commerce/order_management/order_management_api.md +++ b/docs/commerce/order_management/order_management_api.md @@ -31,7 +31,7 @@ See the [Discounts API](discounts_api.md#retrieve-applied-discounts) to learn ho To access a single order by using its numerical ID, use the [`OrderServiceInterface::getOrder`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-OrderManagement-OrderServiceInterface.html#method_getOrder) method: ``` php -[[= include_code('code_samples/api/commerce/src/Command/OrderCommand.php', 54, 57, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/OrderCommand.php', 56, 59, remove_indent=True) =]] ``` ## Get multiple orders @@ -40,10 +40,12 @@ To fetch multiple orders, use the [`OrderServiceInterface::findOrders`](/api/php It follows the same search query pattern as other APIs: ``` php -[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 8, 9) =]][[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 10, 14) =]] +[[= include_code('code_samples/api/commerce/src/Command/OrderCommand.php', 9, 9) =]] +[[= include_code('code_samples/api/commerce/src/Command/OrderCommand.php', 11, 14) =]] // ... -[[= include_file('code_samples/api/commerce/src/Command/OrderCommand.php', 106, 115) =]] + +[[= include_code('code_samples/api/commerce/src/Command/OrderCommand.php', 109, 117) =]] ``` ## Create order @@ -51,7 +53,7 @@ It follows the same search query pattern as other APIs: To create an order, use the [`OrderServiceInterface::createOrder`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-OrderManagement-OrderServiceInterface.html#method_createOrder) method and provide it with the [`Ibexa\Contracts\OrderManagement\Value\Struct\OrderCreateStruct`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-OrderManagement-Value-Struct-OrderCreateStruct.html) object that contains a list of products, purchased quantities, product, total prices, and tax amounts. ``` php -[[= include_code('code_samples/api/commerce/src/Command/OrderCommand.php', 88, 98, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/OrderCommand.php', 90, 100, remove_indent=True) =]] ``` ## Update order @@ -61,5 +63,5 @@ You could do it to support a scenario when, for example, the order is processed To update order information, use the [`OrderServiceInterface::updateOrder`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-OrderManagement-OrderServiceInterface.html#method_updateOrder) method: ``` php -[[= include_code('code_samples/api/commerce/src/Command/OrderCommand.php', 101, 104, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/OrderCommand.php', 103, 106, remove_indent=True) =]] ``` diff --git a/docs/commerce/payment/enable_paypal_payments.md b/docs/commerce/payment/enable_paypal_payments.md index 945f4a86068..70e30670dd0 100644 --- a/docs/commerce/payment/enable_paypal_payments.md +++ b/docs/commerce/payment/enable_paypal_payments.md @@ -36,7 +36,7 @@ Ensure that the `username`, `password,` and `signature` fields contain the PayPa You can now provide language translations for the PayPal payment service name. To do it, within the `ibexa_payment_type` namespace in your translation files, use the provided translation key structure for each of your supported languages: -```yaml +```yaml {skip-validation} ibexa: payment_method: type: diff --git a/docs/commerce/payment/enable_stripe_payments.md b/docs/commerce/payment/enable_stripe_payments.md index 5d03bd88290..2390ce4e725 100644 --- a/docs/commerce/payment/enable_stripe_payments.md +++ b/docs/commerce/payment/enable_stripe_payments.md @@ -37,7 +37,7 @@ Ensure that the `publishable_key` and `secret_key` fields contain the Stripe API You can now provide language translations for the Stripe payment platform name. To do it, within the `ibexa_payment_type` namespace in your translation files, use the provided translation key structure within your translation files: -```yaml +```yaml {skip-validation} ibexa: payment_method: type: diff --git a/docs/commerce/payment/extend_payment.md b/docs/commerce/payment/extend_payment.md index 0b3eacf71a3..551029fee6c 100644 --- a/docs/commerce/payment/extend_payment.md +++ b/docs/commerce/payment/extend_payment.md @@ -94,11 +94,11 @@ When you create a payment, you can attach custom data to it, for example, you ca You add custom data by using the `setContext` method: ``` php -[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 78, 89, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 80, 91, remove_indent=True) =]] ``` Then, you retrieve it with the `getContext` method: ``` php -[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 51, 54, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 53, 56, remove_indent=True) =]] ``` diff --git a/docs/commerce/payment/payment_api.md b/docs/commerce/payment/payment_api.md index a0e4a8d6e41..2c7f84693d4 100644 --- a/docs/commerce/payment/payment_api.md +++ b/docs/commerce/payment/payment_api.md @@ -17,7 +17,7 @@ You can change that by providing a custom payment identifier in `Ibexa\Contracts To access a single payment by using its numerical ID, use the `PaymentServiceInterface::getPayment` method: ``` php -[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 45, 48, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 47, 50, remove_indent=True) =]] ``` ### Get single payment by identifier @@ -25,7 +25,7 @@ To access a single payment by using its numerical ID, use the `PaymentServiceInt To access a single payment by using its string identifier, use the `PaymentServiceInterface::getPaymentByIdentifier` method: ``` php -[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 51, 52, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 53, 54, remove_indent=True) =]] ``` ## Get multiple payments @@ -34,7 +34,7 @@ To fetch multiple payments, use the `PaymentServiceInterface::findPayments` meth It follows the same search query pattern as other APIs: ``` php -[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 60, 75, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 62, 77, remove_indent=True) =]] ``` ## Create payment @@ -42,7 +42,7 @@ It follows the same search query pattern as other APIs: To create a payment, use the `PaymentServiceInterface::createPayment` method and provide it with the `Ibexa\Contracts\Payment\Payment\PaymentCreateStruct` object that takes the following arguments: `method`, `order` and `amount`. ``` php -[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 78, 91, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 80, 93, remove_indent=True) =]] ``` ## Update payment @@ -53,7 +53,7 @@ The `Ibexa\Contracts\Payment\Payment\PaymentUpdateStruct` object takes the follo To update payment information, use the `PaymentServiceInterface::updatePayment` method: ``` php -[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 94, 99, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 96, 101, remove_indent=True) =]] ``` ## Delete payment @@ -61,5 +61,5 @@ To update payment information, use the `PaymentServiceInterface::updatePayment` To delete a payment from the system, use the `PaymentServiceInterface::deletePayment` method: ``` php -[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 102, 102, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/PaymentCommand.php', 104, 104, remove_indent=True) =]] ``` diff --git a/docs/commerce/payment/payment_method_api.md b/docs/commerce/payment/payment_method_api.md index 998dcd20900..47d68e66699 100644 --- a/docs/commerce/payment/payment_method_api.md +++ b/docs/commerce/payment/payment_method_api.md @@ -26,7 +26,7 @@ From the developer's perspective, payment methods are referenced with identifier To access a single payment method by using its string identifier, use the `PaymentMethodService::getPaymentMethodByIdentifier` method: ``` php -[[= include_code('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 47, 50, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 49, 52, remove_indent=True) =]] ``` ### Get single payment method by ID @@ -34,7 +34,7 @@ To access a single payment method by using its string identifier, use the `Payme To access a single payment method by using its numerical ID, use the `PaymentMethodService::getPaymentMethod` method: ``` php -[[= include_code('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 41, 44, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 43, 46, remove_indent=True) =]] ``` ## Get multiple payment methods @@ -44,7 +44,7 @@ To fetch multiple payment methods, use the `PaymentMethodService::findPaymentMet It follows the same search query pattern as other APIs: ``` php -[[= include_code('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 53, 69, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 55, 71, remove_indent=True) =]] ``` ## Create payment method @@ -59,7 +59,8 @@ To create a payment method, use the `PaymentMethodService::createPaymentMethod` - `options` object. ``` php -[[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 52, 53) =]][[= include_file('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 71, 81) =]] +[[= include_code('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 55, 55) =]] +[[= include_code('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 74, 83) =]] ``` ## Update payment method @@ -70,7 +71,7 @@ An `Ibexa\Contracts\Payment\PaymentMethod\PaymentMethodUpdateStruct` object can To update payment method information, use the `PaymentMethodServiceInterface::updatePaymentMethod` method: ``` php -[[= include_code('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 84, 93, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 86, 95, remove_indent=True) =]] ``` ## Delete payment method @@ -78,7 +79,7 @@ To update payment method information, use the `PaymentMethodServiceInterface::up To delete a payment method from the system, use the `PaymentMethodService::deletePayment` method: ``` php -[[= include_code('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 96, 101, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 98, 103, remove_indent=True) =]] ``` ## Check whether payment method is used @@ -86,5 +87,5 @@ To delete a payment method from the system, use the `PaymentMethodService::delet To check whether a payment method is used, for example, before you delete it, use the `PaymentMethodService::isPaymentMethodUsed` method: ``` php -[[= include_code('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 104, 116, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/PaymentMethodCommand.php', 106, 118, remove_indent=True) =]] ``` diff --git a/docs/commerce/payment/payum_integration.md b/docs/commerce/payment/payum_integration.md index f7b41ecc173..aa8509244a9 100644 --- a/docs/commerce/payment/payum_integration.md +++ b/docs/commerce/payment/payum_integration.md @@ -51,7 +51,7 @@ ibexa_connector_payum: Within the `ibexa_payment_type` namespace in your translation files, add translations for each payment service that you configure. For language translations of payment service names, structure the translation files as follows: -```yaml +```yaml {skip-validation} ibexa: payment_method: type: diff --git a/docs/commerce/shipping_management/shipment_api.md b/docs/commerce/shipping_management/shipment_api.md index 2ea3f1b38d2..960f9ec6491 100644 --- a/docs/commerce/shipping_management/shipment_api.md +++ b/docs/commerce/shipping_management/shipment_api.md @@ -16,7 +16,7 @@ From the developer's perspective, shipments are referenced with a UUID identifie To access a single shipment by using its string identifier, use the `ShipmentService::getShipmentByIdentifier` method: ``` php -[[= include_code('code_samples/api/commerce/src/Command/ShipmentCommand.php', 58, 66, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/ShipmentCommand.php', 60, 68, remove_indent=True) =]] ``` ### Get single shipment by id @@ -24,7 +24,7 @@ To access a single shipment by using its string identifier, use the `ShipmentSer To access a single shipment by using its numerical id, use the `ShipmentService::getShipment` method: ``` php -[[= include_code('code_samples/api/commerce/src/Command/ShipmentCommand.php', 46, 55, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/ShipmentCommand.php', 48, 57, remove_indent=True) =]] ``` ## Get multiple shipments @@ -33,7 +33,7 @@ To fetch multiple shipments, use the `ShipmentService::findShipments` method. It follows the same search query pattern as other APIs: ``` php -[[= include_code('code_samples/api/commerce/src/Command/ShipmentCommand.php', 69, 87, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/ShipmentCommand.php', 71, 89, remove_indent=True) =]] ``` ## Create shipment @@ -41,7 +41,7 @@ It follows the same search query pattern as other APIs: To create a shipment, use the `ShipmentService::createShipment` method and provide it with an `Ibexa\Contracts\Shipping\Value\ShipmentCreateStruct` object that takes two parameters, a `shippingMethod` string and a `Money` object. ``` php -[[= include_code('code_samples/api/commerce/src/Command/ShipmentCommand.php', 90, 103, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/ShipmentCommand.php', 92, 105, remove_indent=True) =]] ``` ## Update shipment @@ -51,7 +51,7 @@ You could do it to support a scenario when, for example, the shipment is process To update shipment information, use the `ShipmentService::updateShipment` method: ``` php -[[= include_code('code_samples/api/commerce/src/Command/ShipmentCommand.php', 106, 116, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/ShipmentCommand.php', 108, 118, remove_indent=True) =]] ``` ## Delete shipment @@ -59,5 +59,5 @@ To update shipment information, use the `ShipmentService::updateShipment` method To delete a shipment from the system, use the `ShipmentService::deleteShipment` method: ``` php -[[= include_code('code_samples/api/commerce/src/Command/ShipmentCommand.php', 119, 119, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/ShipmentCommand.php', 121, 121, remove_indent=True) =]] ``` diff --git a/docs/commerce/shipping_management/shipping_method_api.md b/docs/commerce/shipping_management/shipping_method_api.md index 07ffb64da00..fa39b0ea82c 100644 --- a/docs/commerce/shipping_management/shipping_method_api.md +++ b/docs/commerce/shipping_management/shipping_method_api.md @@ -17,7 +17,7 @@ To access a shipping method by using its identifier, use the `ShippingMethodServ The method takes a string as `$identifier` parameter and uses a prioritized language from SiteAccess settings unless you pass another language as `forcedLanguage`. ``` php -[[= include_code('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 53, 62, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 55, 64, remove_indent=True) =]] ``` ### Get shipping method by ID @@ -26,7 +26,7 @@ To access a shipping method by using its ID, use the `ShippingMethodServiceInter The method takes a string as `$id` parameter and uses a prioritized language from SiteAccess settings unless you pass another language as `forcedLanguage`. ``` php -[[= include_code('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 41, 50, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 43, 52, remove_indent=True) =]] ``` ## Get multiple shipping methods @@ -35,7 +35,7 @@ To fetch multiple shipping methods, use the `ShippingMethodServiceInterface::get It follows the same search query pattern as other APIs: ``` php -[[= include_code('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 65, 82, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 67, 84, remove_indent=True) =]] ``` ## Create shipping method @@ -43,7 +43,7 @@ It follows the same search query pattern as other APIs: To create a shipping method, use the `ShippingMethodServiceInterface::createShippingMethod` method and provide it with the `Ibexa\Contracts\Shipping\Value\ShippingMethodCreateStruct` object that you created by using the `newShippingMethodCreateStruct` method. ``` php -[[= include_code('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 85, 107, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 87, 109, remove_indent=True) =]] ``` ## Update shipping method @@ -51,7 +51,7 @@ To create a shipping method, use the `ShippingMethodServiceInterface::createShip To update a shipping method, use the `ShippingMethodServiceInterface::updateShippingMethod` method and provide it with the `Ibexa\Contracts\Shipping\Value\ShippingMethodUpdateStruct` object that you created by using the `newShippingMethodUpdateStruct` method. ``` php -[[= include_code('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 110, 123, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 112, 125, remove_indent=True) =]] ``` ## Delete shipping method @@ -59,7 +59,7 @@ To update a shipping method, use the `ShippingMethodServiceInterface::updateShip To update a shipping method, use the `ShippingMethodServiceInterface::deleteShippingMethod` method. ``` php -[[= include_code('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 126, 131, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 128, 133, remove_indent=True) =]] ``` ## Delete shipping method translation @@ -67,5 +67,5 @@ To update a shipping method, use the `ShippingMethodServiceInterface::deleteShip To delete shipping method translation, use the `ShippingMethodServiceInterface::deleteShippingMethodTranslation` method. ``` php -[[= include_code('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 134, 142, remove_indent=True) =]] +[[= include_code('code_samples/api/commerce/src/Command/ShippingMethodCommand.php', 136, 144, remove_indent=True) =]] ``` diff --git a/docs/commerce/shopping_list/install_shopping_list.md b/docs/commerce/shopping_list/install_shopping_list.md index 3238f3982e2..a66d9f718e5 100644 --- a/docs/commerce/shopping_list/install_shopping_list.md +++ b/docs/commerce/shopping_list/install_shopping_list.md @@ -19,9 +19,11 @@ The associated Symfony Flex recipe configures the bundle and its routes. Check that the following line has been added by the recipe to `config/bundles.php` file's array: ``` php +use Ibexa\Bundle\ShoppingList\IbexaShoppingListBundle; + return [ // ... - Ibexa\Bundle\ShoppingList\IbexaShoppingListBundle::class => ['all' => true], + IbexaShoppingListBundle::class => ['all' => true], ]; ``` diff --git a/docs/content_management/collaborative_editing/configure_collaborative_editing.md b/docs/content_management/collaborative_editing/configure_collaborative_editing.md index b96b50a217b..003029fd3b1 100644 --- a/docs/content_management/collaborative_editing/configure_collaborative_editing.md +++ b/docs/content_management/collaborative_editing/configure_collaborative_editing.md @@ -26,11 +26,13 @@ Then, if not using Symfony Flex, add the following code to the `config/bundles.p ``` php ['all' => true], - Ibexa\Bundle\CkeditorPremium\IbexaCkeditorPremiumBundle::class => ['all' => true], + IbexaFieldTypeRichTextRTEBundle::class => ['all' => true], + IbexaCkeditorPremiumBundle::class => ['all' => true], ]; ``` diff --git a/docs/content_management/content_api/browsing_content.md b/docs/content_management/content_api/browsing_content.md index 5f726dd949a..c67db68ff90 100644 --- a/docs/content_management/content_api/browsing_content.md +++ b/docs/content_management/content_api/browsing_content.md @@ -114,9 +114,12 @@ You can get the current version's `VersionInfo` using [`ContentService::loadVers You can also specify the version number as the second argument to get Relations for a specific version: ``` php +use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; + /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo - * @var \Ibexa\Contracts\Core\Repository\ContentService $contentService + * @var ContentInfo $contentInfo + * @var ContentService $contentService */ $versionInfo = $contentService->loadVersionInfo($contentInfo, 2); ``` @@ -185,9 +188,11 @@ The repository is SiteAccess-aware, so languages defined by the SiteAccess are a To load a specific language, provide its language code when loading the content item: ``` php +use Ibexa\Contracts\Core\Repository\ContentService; + /** * @var int $contentId - * @var \Ibexa\Contracts\Core\Repository\ContentService $contentService + * @var ContentService $contentService */ $content = $contentService->loadContent($contentId, ['ger-DE']); ``` @@ -195,11 +200,13 @@ $content = $contentService->loadContent($contentId, ['ger-DE']); To load all languages as a prioritized list, use `Language::ALL`: ``` php +use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\Language; /** - * @var \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content + * @var ContentService $contentService + * @var Content $content */ $contentService->loadContent($content->id, Language::ALL); ``` @@ -228,7 +235,9 @@ You can do it through the `getMainLocation` method of the ContentInfo object. Next, use the `getParentLocation` method of the location object to access the parent location: ``` php -/** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo */ +use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; + +/** @var ContentInfo $contentInfo */ $mainLocation = $contentInfo->getMainLocation(); $parentLocation = $mainLocation?->getParentLocation(); if ($parentLocation !== null) { @@ -252,12 +261,16 @@ The versions must have the same language. For example, to get the comparison between the `name` field of two versions: ``` php +use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; +use Ibexa\Contracts\VersionComparison\Service\VersionComparisonServiceInterface; + /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo + * @var ContentInfo $contentInfo * @var int $versionFromId * @var int $versionToId - * @var \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @var \Ibexa\Contracts\VersionComparison\Service\VersionComparisonServiceInterface $comparisonService + * @var ContentService $contentService + * @var VersionComparisonServiceInterface $comparisonService */ $versionFrom = $contentService->loadVersionInfo($contentInfo, $versionFromId); $versionTo = $contentService->loadVersionInfo($contentInfo, $versionToId); diff --git a/docs/content_management/content_api/creating_content.md b/docs/content_management/content_api/creating_content.md index 55c3ee89c1c..829075766d6 100644 --- a/docs/content_management/content_api/creating_content.md +++ b/docs/content_management/content_api/creating_content.md @@ -104,8 +104,11 @@ You can delete a single translation from a content item's version using [`Conten The method must be provided with a `VersionInfo` object and the code of the language to delete: ``` php -/** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $versionInfo */ +use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; + +/** @var VersionInfo $versionInfo */ $languageCode = 'ger-DE'; -/** @var \Ibexa\Contracts\Core\Repository\ContentService $contentService */ +/** @var ContentService $contentService */ $contentService->deleteTranslationFromDraft($versionInfo, $languageCode); ``` diff --git a/docs/content_management/content_api/managing_content.md b/docs/content_management/content_api/managing_content.md index 2a05e068d33..b2685f719d5 100644 --- a/docs/content_management/content_api/managing_content.md +++ b/docs/content_management/content_api/managing_content.md @@ -117,10 +117,14 @@ The content item is restored under its previous location. You can also provide a different location to restore in as a second argument: ``` php +use Ibexa\Contracts\Core\Repository\LocationService; +use Ibexa\Contracts\Core\Repository\TrashService; +use Ibexa\Contracts\Core\Repository\Values\Content\TrashItem; + /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\TrashItem $trashItem - * @var \Ibexa\Contracts\Core\Repository\LocationService $locationService - * @var \Ibexa\Contracts\Core\Repository\TrashService $trashService + * @var TrashItem $trashItem + * @var LocationService $locationService + * @var TrashService $trashService */ $locationId = 12345; $newParent = $locationService->loadLocation($locationId); diff --git a/docs/content_management/data_migration/data_migration_api.md b/docs/content_management/data_migration/data_migration_api.md index f2020917d51..4786c79cfaa 100644 --- a/docs/content_management/data_migration/data_migration_api.md +++ b/docs/content_management/data_migration/data_migration_api.md @@ -11,13 +11,13 @@ You can use the PHP API to manage and run [data migrations](data_migration.md). To list all migration files available in the directory defined in configuration (by default, `src/Migrations/Ibexa`), use the `MigrationService:listMigrations()` method: ``` php -[[= include_code('code_samples/api/migration/src/Command/MigrationCommand.php', 32, 34, remove_indent=True) =]] +[[= include_code('code_samples/api/migration/src/Command/MigrationCommand.php', 34, 36, remove_indent=True) =]] ``` To get a single migration file by its name, use the `MigrationService:findOneByName()` method: ``` php -[[= include_code('code_samples/api/migration/src/Command/MigrationCommand.php', 37, 37, remove_indent=True) =]] +[[= include_code('code_samples/api/migration/src/Command/MigrationCommand.php', 39, 39, remove_indent=True) =]] ``` ## Running migration files @@ -25,7 +25,7 @@ To get a single migration file by its name, use the `MigrationService:findOneByN To run migration file(s), use either `MigrationService:executeOne()` or `MigrationService:executeAll()`: ``` php -[[= include_code('code_samples/api/migration/src/Command/MigrationCommand.php', 39, 40, remove_indent=True) =]] +[[= include_code('code_samples/api/migration/src/Command/MigrationCommand.php', 41, 42, remove_indent=True) =]] ``` Both `executeOne()` and `executeAll()` can take an optional parameter: the login of the User that you want to execute the migrations as. @@ -35,5 +35,5 @@ Both `executeOne()` and `executeAll()` can take an optional parameter: the login To add a new migration file, use the `MigrationService:add()` method: ``` php -[[= include_code('code_samples/api/migration/src/Command/MigrationCommand.php', 25, 30, remove_indent=True) =]] +[[= include_code('code_samples/api/migration/src/Command/MigrationCommand.php', 27, 32, remove_indent=True) =]] ``` diff --git a/docs/content_management/field_types/field_type_reference/authorfield.md b/docs/content_management/field_types/field_type_reference/authorfield.md index e43d8432e36..7ab382a507a 100644 --- a/docs/content_management/field_types/field_type_reference/authorfield.md +++ b/docs/content_management/field_types/field_type_reference/authorfield.md @@ -22,16 +22,16 @@ Example: use Ibexa\Core\FieldType\Author; $authorList = new Author\Value([ - new Author\Author([ - 'id' => 1, - 'name' => 'Boba Fett', - 'email' => 'boba.fett@example.com', - ]), - new Author\Author([ - 'id' => 2, - 'name' => 'Darth Vader', - 'email' => 'darth.vader@example.com', - ]), + new Author\Author([ + 'id' => 1, + 'name' => 'Boba Fett', + 'email' => 'boba.fett@example.com', + ]), + new Author\Author([ + 'id' => 2, + 'name' => 'Darth Vader', + 'email' => 'darth.vader@example.com', + ]), ]); ``` @@ -42,18 +42,20 @@ The hash format mostly matches the value object. It has the following key `autho Example ``` php -[ - [ - 'id' => 1, - 'name' => 'Boba Fett', - 'email' => 'boba.fett@example.com', - ], - [ - 'id' => 2, - 'name' => 'Darth Vader', - 'email' => 'darth.vader@example.com', - ], -]; +use Ibexa\Core\FieldType\Author; + +$authorList = new Author\Value([ + new Author\Author([ + 'id' => 1, + 'name' => 'Boba Fett', + 'email' => 'boba.fett@example.com', + ]), + new Author\Author([ + 'id' => 2, + 'name' => 'Darth Vader', + 'email' => 'darth.vader@example.com', + ]), +]); ``` #### String representation diff --git a/docs/content_management/field_types/field_type_reference/binaryfilefield.md b/docs/content_management/field_types/field_type_reference/binaryfilefield.md index 0d3d48903a3..dc417f0b375 100644 --- a/docs/content_management/field_types/field_type_reference/binaryfilefield.md +++ b/docs/content_management/field_types/field_type_reference/binaryfilefield.md @@ -47,8 +47,11 @@ The hash format mostly matches the value object. It has the following keys: Example: ``` php -/** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentCreateStruct $fileContentCreateStruct */ -$fileContentCreateStruct->setField('file', new Ibexa\Core\FieldType\BinaryFile\Value([ +use Ibexa\Contracts\Core\Repository\Values\Content\ContentCreateStruct; +use Ibexa\Core\FieldType\BinaryFile\Value; + +/** @var ContentCreateStruct $fileContentCreateStruct */ +$fileContentCreateStruct->setField('file', new Value([ 'fileName' => 'example.pdf', 'inputUri' => '/tmp/example_for_website.pdf', ])); diff --git a/docs/content_management/field_types/field_type_reference/countryfield.md b/docs/content_management/field_types/field_type_reference/countryfield.md index 7acea36ab33..171c431774b 100644 --- a/docs/content_management/field_types/field_type_reference/countryfield.md +++ b/docs/content_management/field_types/field_type_reference/countryfield.md @@ -50,8 +50,10 @@ The format used for serialization is simpler than the full format. It's also available when setting value on the content field, by setting the value to an array instead of the value object. Example of that shown below: ``` php +use Ibexa\Contracts\Core\Repository\Values\Content\Content; + // Value object content example -/** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ +/** @var Content $content */ $content->fields['countries'] = ['JP', 'NO']; ``` @@ -69,7 +71,9 @@ The Value class of this field type contains the following properties: ``` php // Value object content example -/** @var \Ibexa\Core\FieldType\Country\Value $value */ +use Ibexa\Core\FieldType\Country\Value; + +/** @var Value $value */ $value->countries = [ 'JP' => [ 'Name' => 'Japan', diff --git a/docs/content_management/field_types/field_type_reference/dateandtimefield.md b/docs/content_management/field_types/field_type_reference/dateandtimefield.md index 47baf267e90..34d08f511e4 100644 --- a/docs/content_management/field_types/field_type_reference/dateandtimefield.md +++ b/docs/content_management/field_types/field_type_reference/dateandtimefield.md @@ -91,6 +91,7 @@ Following `defaultType` default value options are available as constants in the ``` php // DateAndTime FieldType example settings +use Ibexa\Contracts\Core\Repository\ContentTypeService; use Ibexa\Core\FieldType\DateAndTime\Type; $settings = [ @@ -99,7 +100,7 @@ $settings = [ 'dateInterval' => null, ]; -/** @var \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService */ +/** @var ContentTypeService $contentTypeService */ $dateAndTimeFieldCreateStruct = $contentTypeService->newFieldDefinitionCreateStruct( 'my_date_and_time_field', 'ibexa_datetime' diff --git a/docs/content_management/field_types/field_type_reference/floatfield.md b/docs/content_management/field_types/field_type_reference/floatfield.md index b8f36d8faaf..ad31067e329 100644 --- a/docs/content_management/field_types/field_type_reference/floatfield.md +++ b/docs/content_management/field_types/field_type_reference/floatfield.md @@ -63,8 +63,9 @@ This field type supports `FloatValueValidator`, defining maximum and minimum flo ``` php // Validator configuration example in PHP +use Ibexa\Contracts\Core\Repository\Repository; -/** @var \Ibexa\Contracts\Core\Repository\Repository $repository */ +/** @var Repository $repository */ $contentTypeService = $repository->getContentTypeService(); $floatFieldCreateStruct = $contentTypeService->newFieldDefinitionCreateStruct('float', 'ibexa_float'); diff --git a/docs/content_management/field_types/field_type_reference/imageassetfield.md b/docs/content_management/field_types/field_type_reference/imageassetfield.md index f32fcff4530..ff13ddccecd 100644 --- a/docs/content_management/field_types/field_type_reference/imageassetfield.md +++ b/docs/content_management/field_types/field_type_reference/imageassetfield.md @@ -30,11 +30,14 @@ Value object of `ibexa_image_asset` contains the following properties: | `alternativeText` | `string` | The alternative image text (for example "Picture of an apple."). | ``` php +use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; +use Ibexa\Core\FieldType\ImageAsset\Value; + /** * Value object content example. * - * @var \Ibexa\Core\FieldType\ImageAsset\Value $imageAssetValue - * @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo + * @var Value $imageAssetValue + * @var ContentInfo $contentInfo */ $imageAssetValue->destinationContentId = $contentInfo->id; $imageAssetValue->alternativeText = 'Picture of an apple.'; @@ -48,9 +51,10 @@ It expects an ID of a content item representing asset and the alternative text. ``` php // Constructor example +use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Core\FieldType\ImageAsset as ImageAsset; -/** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo */ +/** @var ContentInfo $contentInfo */ // Instantiates a ImageAsset Value object $imageAssetValue = new ImageAsset\Value($contentInfo->id, 'Picture of an apple.'); ``` diff --git a/docs/content_management/field_types/field_type_reference/imagefield.md b/docs/content_management/field_types/field_type_reference/imagefield.md index ad9ea718665..0d28a8c4bef 100644 --- a/docs/content_management/field_types/field_type_reference/imagefield.md +++ b/docs/content_management/field_types/field_type_reference/imagefield.md @@ -150,10 +150,14 @@ The variation service, `ibexa.field_type.ibexa_image.variation_service`, can be It expects a VersionInfo, the Image field, and the variation name as a string (`large`, `medium`, and more.): ``` php +use Ibexa\Contracts\Core\Repository\Values\Content\Field; +use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; +use Ibexa\Contracts\Core\Variation\VariationHandler; + /** - * @var \Ibexa\Contracts\Core\Variation\VariationHandler $imageVariationHandler - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Field $imageField - * @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $versionInfo + * @var VariationHandler $imageVariationHandler + * @var Field $imageField + * @var VersionInfo $versionInfo */ $variation = $imageVariationHandler->getVariation( $imageField, @@ -172,9 +176,12 @@ As for any field type, there are several ways to input content to a field. For an Image, the quickest is to call `setField()` on the ContentStruct: ``` php +use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\ContentTypeService; + /** - * @var \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @var \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService + * @var ContentService $contentService + * @var ContentTypeService $contentTypeService */ $createStruct = $contentService->newContentCreateStruct( $contentTypeService->loadContentTypeByIdentifier('image'), @@ -188,16 +195,20 @@ To customize the Image's alternative texts, you must first get an `Image\Value` For that, you can use the `Image\Value::fromString()` method that accepts the path to a local file: ``` php +use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Core\FieldType\Image\Value; + /** - * @var \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @var \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService + * @var ContentService $contentService + * @var ContentTypeService $contentTypeService */ $createStruct = $contentService->newContentCreateStruct( $contentTypeService->loadContentTypeByIdentifier('image'), 'eng-GB' ); -$imageField = \Ibexa\Core\FieldType\Image\Value::fromString('/tmp/image.png'); +$imageField = Value::fromString('/tmp/image.png'); $imageField->alternativeText = 'My alternative text'; $createStruct->setField('image', $imageField); ``` @@ -205,8 +216,11 @@ $createStruct->setField('image', $imageField); You can also provide a hash of `Image\Value` properties, either to `setField()`, or to the constructor: ``` php -/** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentCreateStruct $createStruct */ -$imageValue = new \Ibexa\Core\FieldType\Image\Value( +use Ibexa\Contracts\Core\Repository\Values\Content\ContentCreateStruct; +use Ibexa\Core\FieldType\Image\Value; + +/** @var ContentCreateStruct $createStruct */ +$imageValue = new Value( [ 'id' => '/tmp/image.png', 'fileSize' => 37931, diff --git a/docs/content_management/field_types/field_type_reference/integerfield.md b/docs/content_management/field_types/field_type_reference/integerfield.md index 13155143136..123eb9d73e9 100644 --- a/docs/content_management/field_types/field_type_reference/integerfield.md +++ b/docs/content_management/field_types/field_type_reference/integerfield.md @@ -26,7 +26,9 @@ The Value class of this field type contains the following properties: ``` php // Value object content example -/** @var \Ibexa\Core\FieldType\Integer\Value $integer */ +use Ibexa\Core\FieldType\Integer\Value; + +/** @var Value $integer */ $integer->value = 8; ``` diff --git a/docs/content_management/field_types/field_type_reference/measurementfield.md b/docs/content_management/field_types/field_type_reference/measurementfield.md index 5a16c7dabd5..a0b1dcaac6f 100644 --- a/docs/content_management/field_types/field_type_reference/measurementfield.md +++ b/docs/content_management/field_types/field_type_reference/measurementfield.md @@ -45,9 +45,10 @@ Depending on the selected input type, the object resembles the following example ``` php // Simple input (single value) example +use Ibexa\Contracts\Measurement\MeasurementServiceInterface; use Ibexa\Measurement\FieldType\MeasurementValue; -/** @var \Ibexa\Contracts\Measurement\MeasurementServiceInterface $measurementService */ +/** @var MeasurementServiceInterface $measurementService */ // Instantiates a Measurement Value object $measurementValue = new MeasurementValue( @@ -62,9 +63,10 @@ $measurementValue = new MeasurementValue( ``` php // Range input value example +use Ibexa\Contracts\Measurement\MeasurementServiceInterface; use Ibexa\Measurement\FieldType\MeasurementValue; -/** @var \Ibexa\Contracts\Measurement\MeasurementServiceInterface $measurementService */ +/** @var MeasurementServiceInterface $measurementService */ // Instantiates a Measurement Value object $measurementValue = new MeasurementValue( diff --git a/docs/content_management/field_types/field_type_reference/mediafield.md b/docs/content_management/field_types/field_type_reference/mediafield.md index d29074113ef..4c4e3fbecce 100644 --- a/docs/content_management/field_types/field_type_reference/mediafield.md +++ b/docs/content_management/field_types/field_type_reference/mediafield.md @@ -74,9 +74,10 @@ The field type supports `FileSizeValidator`, defining maximum size of media file ``` php // Example of using Media field type validator in PHP +use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Core\FieldType\Media\Type; -/** @var \Ibexa\Contracts\Core\Repository\Repository $repository */ +/** @var Repository $repository */ $contentTypeService = $repository->getContentTypeService(); $mediaFieldCreateStruct = $contentTypeService->newFieldDefinitionCreateStruct('media', 'ibexa_media'); @@ -111,9 +112,10 @@ List of all available `mediaType` constants is defined in the `Ibexa\Core\FieldT ``` php // Example of using Media field type settings in PHP +use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Core\FieldType\Media\Type; -/** @var \Ibexa\Contracts\Core\Repository\Repository $repository */ +/** @var Repository $repository */ $contentTypeService = $repository->getContentTypeService(); $mediaFieldCreateStruct = $contentTypeService->newFieldDefinitionCreateStruct('media', 'ibexa_media'); diff --git a/docs/content_management/field_types/field_type_reference/relationfield.md b/docs/content_management/field_types/field_type_reference/relationfield.md index 78be9fe561c..07df670c494 100644 --- a/docs/content_management/field_types/field_type_reference/relationfield.md +++ b/docs/content_management/field_types/field_type_reference/relationfield.md @@ -26,11 +26,14 @@ The Value class of this field type contains the following properties: | `$destinationContentId` | `string`, `int`, or `null` | This property is used to store the value provided, which represents the related content. | ``` php +use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; +use Ibexa\Core\FieldType\Relation\Value; + /** * Value object content example. * - * @var \Ibexa\Core\FieldType\Relation\Value $relation - * @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo + * @var Value $relation + * @var ContentInfo $contentInfo */ $relation->destinationContentId = $contentInfo->id; ``` @@ -41,9 +44,10 @@ The `Relation\Value` constructor initializes a new value object with the value p ``` php // Constructor example +use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Core\FieldType\Relation as Relation; -/** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo */ +/** @var ContentInfo $contentInfo */ // Instantiates a Relation Value object $relationValue = new Relation\Value($contentInfo->id); ``` @@ -65,8 +69,6 @@ The field definition of this field type can be configured with three options: ``` php // Relation FieldType example settings -use Ibexa\Core\FieldType\Relation\Type; - $settings = [ 'selectionMethod' => 1, 'selectionRoot' => null, diff --git a/docs/content_management/field_types/field_type_reference/relationlistfield.md b/docs/content_management/field_types/field_type_reference/relationlistfield.md index a658f288681..206eddd3b56 100644 --- a/docs/content_management/field_types/field_type_reference/relationlistfield.md +++ b/docs/content_management/field_types/field_type_reference/relationlistfield.md @@ -28,12 +28,15 @@ This field type makes it possible to store and retrieve values of a relation to |`destinationContentIds`|`array`|An array of related Content IDs|`[ 24, 42 ]`| ``` php +use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; +use Ibexa\Core\FieldType\RelationList\Value; + /** * Value object content example. * - * @var \Ibexa\Core\FieldType\RelationList\Value $relationList - * @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo1 - * @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo2 + * @var Value $relationList + * @var ContentInfo $contentInfo1 + * @var ContentInfo $contentInfo2 */ $relationList->destinationContentIds = [ $contentInfo1->id, @@ -49,11 +52,12 @@ It expects a mixed array as value. ``` php //Constructor example +use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Core\FieldType\RelationList as RelationList; /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo1 - * @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo2 + * @var ContentInfo $contentInfo1 + * @var ContentInfo $contentInfo2 */ // Instantiates a RelationList Value object $relationListValue = new RelationList\Value( @@ -110,7 +114,7 @@ $fieldSettings = [ 'selectionMethod' => Type::SELECTION_BROWSE, 'selectionDefaultLocation' => null, 'selectionContentTypes' => [], - ]; +]; $validators = [ 'RelationListValueValidator' => [ diff --git a/docs/content_management/field_types/field_type_reference/richtextfield.md b/docs/content_management/field_types/field_type_reference/richtextfield.md index 1c91af55abd..b6ec78bb173 100644 --- a/docs/content_management/field_types/field_type_reference/richtextfield.md +++ b/docs/content_management/field_types/field_type_reference/richtextfield.md @@ -71,9 +71,12 @@ You can use the [[= product_name_base =]] flavor of the DocBook format in PHP AP The following example shows how to pass DocBook content to a [create struct](creating_content.md#creating-content-item-draft): ``` php +use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; + /** - * @var \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType + * @var ContentService $contentService + * @var ContentType $contentType */ $contentCreateStruct = $contentService->newContentCreateStruct($contentType, 'eng-GB'); diff --git a/docs/content_management/field_types/field_type_reference/selectionfield.md b/docs/content_management/field_types/field_type_reference/selectionfield.md index 8d76e61b6e1..63276da00df 100644 --- a/docs/content_management/field_types/field_type_reference/selectionfield.md +++ b/docs/content_management/field_types/field_type_reference/selectionfield.md @@ -27,7 +27,9 @@ The Value class of this field type contains the following properties: ``` php // Value object content examples -/** @var \Ibexa\Core\FieldType\Selection\Value $value */ +use Ibexa\Core\FieldType\Selection\Value; + +/** @var Value $value */ // Single selection $value->selection = [1]; diff --git a/docs/content_management/field_types/field_type_reference/taxonomyentryassignmentfield.md b/docs/content_management/field_types/field_type_reference/taxonomyentryassignmentfield.md index cef649394c3..ed3076874df 100644 --- a/docs/content_management/field_types/field_type_reference/taxonomyentryassignmentfield.md +++ b/docs/content_management/field_types/field_type_reference/taxonomyentryassignmentfield.md @@ -26,11 +26,12 @@ Example using an `Ibexa\Taxonomy\FieldType\TaxonomyEntryAssignment\Value` object ``` php use Ibexa\Contracts\Taxonomy\Service\TaxonomyServiceInterface; +use Ibexa\Taxonomy\FieldType\TaxonomyEntryAssignment\Value; /** @var TaxonomyServiceInterface $taxonomyService */ $taxonomyEntry1 = $taxonomyService->loadEntryByIdentifier('example_entry', 'tags'); $taxonomyEntry2 = $taxonomyService->loadEntryByIdentifier('example_entry_2', 'tags'); -new \Ibexa\Taxonomy\FieldType\TaxonomyEntryAssignment\Value( +new Value( [ $taxonomyEntry1, $taxonomyEntry2, diff --git a/docs/content_management/field_types/field_type_reference/taxonomyentryfield.md b/docs/content_management/field_types/field_type_reference/taxonomyentryfield.md index fe4ddd75136..fa7009d41b7 100644 --- a/docs/content_management/field_types/field_type_reference/taxonomyentryfield.md +++ b/docs/content_management/field_types/field_type_reference/taxonomyentryfield.md @@ -20,10 +20,11 @@ Example using an `Ibexa\Taxonomy\FieldType\TaxonomyEntry\Value` object: ``` php use Ibexa\Contracts\Taxonomy\Service\TaxonomyServiceInterface; +use Ibexa\Taxonomy\FieldType\TaxonomyEntry\Value; /** @var TaxonomyServiceInterface $taxonomyService */ $taxonomyEntry = $taxonomyService->loadEntryByIdentifier('example_entry', 'tags'); -$taxonomyEntryField = new \Ibexa\Taxonomy\FieldType\TaxonomyEntry\Value($taxonomyEntry); +$taxonomyEntryField = new Value($taxonomyEntry); ``` Example using array: diff --git a/docs/content_management/field_types/field_type_reference/textlinefield.md b/docs/content_management/field_types/field_type_reference/textlinefield.md index abb5912f8ca..5335516a4c4 100644 --- a/docs/content_management/field_types/field_type_reference/textlinefield.md +++ b/docs/content_management/field_types/field_type_reference/textlinefield.md @@ -35,11 +35,11 @@ The length of the string provided must be between the minimum length defined in The default value for both properties is 0, which means that the validation is disabled by default. To set the validation properties, the `validateValidatorConfiguration()` method needs to be inspected, which receives an array with `minStringLength` and `maxStringLength` like in the following representation: -``` php +``` php {skip-validation} [ - 'StringLengthValidator' => [ - 'maxStringLength' => 60, - 'minStringLength' => 1, - ], + 'StringLengthValidator' => [ + 'maxStringLength' => 60, + 'minStringLength' => 1, + ], ]; ``` diff --git a/docs/content_management/field_types/field_type_reference/urlfield.md b/docs/content_management/field_types/field_type_reference/urlfield.md index 9aae6a0c608..fe465092b03 100644 --- a/docs/content_management/field_types/field_type_reference/urlfield.md +++ b/docs/content_management/field_types/field_type_reference/urlfield.md @@ -30,7 +30,9 @@ The Value class of this field type contains the following properties: ``` php // Value object content example -/** @var \Ibexa\Core\FieldType\Url\Value $url */ +use Ibexa\Core\FieldType\Url\Value; + +/** @var Value $url */ $url->link = 'https://www.ibexa.co'; $url->text = 'Ibexa'; ``` diff --git a/docs/content_management/field_types/form_and_template.md b/docs/content_management/field_types/form_and_template.md index d9acec0e912..d4a40bb31fb 100644 --- a/docs/content_management/field_types/form_and_template.md +++ b/docs/content_management/field_types/form_and_template.md @@ -32,8 +32,10 @@ use Symfony\Component\Form\FormInterface; class MyMapper implements FieldValueFormMapperInterface { /** @param FormInterface $fieldForm */ - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void - { + public function mapFieldValueForm( + FormInterface $fieldForm, + FieldData $data + ): void { $fieldDefinition = $data->getFieldDefinition(); $formConfig = $fieldForm->getConfig(); @@ -78,8 +80,10 @@ use Symfony\Component\Form\FormInterface; class MyMapper implements FieldDefinitionFormMapperInterface { /** @param FormInterface $fieldDefinitionForm */ - public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void - { + public function mapFieldDefinitionForm( + FormInterface $fieldDefinitionForm, + FieldDefinitionData $data + ): void { $fieldDefinitionForm ->add( 'isMultiple', diff --git a/docs/content_management/file_management/file_management.md b/docs/content_management/file_management/file_management.md index f2cd924f123..7ee61f6a900 100644 --- a/docs/content_management/file_management/file_management.md +++ b/docs/content_management/file_management/file_management.md @@ -9,9 +9,12 @@ description: Configurations and management of binary files. To access binary files from the PHP API, use the `Ibexa\Core\IO\IOServiceInterface::loadBinaryFile()` method: ``` php +use Ibexa\Contracts\Core\Repository\Values\Content\Field; +use Ibexa\Core\IO\IOServiceInterface; + /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Field $field - * @var \Ibexa\Core\IO\IOServiceInterface $ioService + * @var Field $field + * @var IOServiceInterface $ioService */ $file = $ioService->loadBinaryFile($field->value->id); $fileContent = $ioService->getFileContents($file); diff --git a/docs/content_management/images/configure_image_editor.md b/docs/content_management/images/configure_image_editor.md index ebbca8eed94..01614bc6e1a 100644 --- a/docs/content_management/images/configure_image_editor.md +++ b/docs/content_management/images/configure_image_editor.md @@ -71,18 +71,18 @@ To modify the value of additional information programmatically, you can set a va use Ibexa\Core\FieldType\Image\Value as FieldValue; $value = new FieldValue([ - 'data' => [ - 'width' => '100', - 'height' => '200', - 'alternativeText' => 'test', - 'mime' => 'image/png', - 'id' => 1, - 'fileName' => 'image.png', - 'additionalData' => [ - 'focalPointX' => 50, - 'focalPointY' => 100, - 'author' => 'John Smith', - ], - ], - ]); + 'data' => [ + 'width' => '100', + 'height' => '200', + 'alternativeText' => 'test', + 'mime' => 'image/png', + 'id' => 1, + 'fileName' => 'image.png', + 'additionalData' => [ + 'focalPointX' => 50, + 'focalPointY' => 100, + 'author' => 'John Smith', + ], + ], +]); ``` diff --git a/docs/content_management/taxonomy/taxonomy_api.md b/docs/content_management/taxonomy/taxonomy_api.md index 3956d093caf..9a3514c6eec 100644 --- a/docs/content_management/taxonomy/taxonomy_api.md +++ b/docs/content_management/taxonomy/taxonomy_api.md @@ -21,9 +21,12 @@ and use `TaxonomyServiceInterface::loadEntryByIdentifier()`: A taxonomy entry identifier is unique per taxonomy. If you have [several taxonomies](taxonomy.md#customize-taxonomy-structure), you can increase code readability by always passing the taxonomy identifier even when it's the default one. The default taxonomy is `tags` if it exists, else the first configured taxonomy (see `\Ibexa\Taxonomy\Service\TaxonomyConfiguration::getDefaultTaxonomyName` for details). ``` php + use Ibexa\Contracts\Taxonomy\Service\TaxonomyServiceInterface; + use Ibexa\Contracts\Taxonomy\Value\TaxonomyEntry; + /** - * @var array $springs - * @var \Ibexa\Contracts\Taxonomy\Service\TaxonomyServiceInterface $taxonomyService + * @var array $springs + * @var TaxonomyServiceInterface $taxonomyService */ $springs[] = $taxonomyService->loadEntryByIdentifier('spring', 'tags'); $springs[] = $taxonomyService->loadEntryByIdentifier('spring', 'events'); diff --git a/docs/content_management/url_management/url_management.md b/docs/content_management/url_management/url_management.md index 628535126cd..c98760a8fc3 100644 --- a/docs/content_management/url_management/url_management.md +++ b/docs/content_management/url_management/url_management.md @@ -213,7 +213,9 @@ The **URL wildcards** tab contains all the information about each URL wildcard. You can create URL wildcards with the public PHP API by using the `URLWildcardService` service: ``` php -/** @var \Ibexa\Contracts\Core\Repository\Repository $repository */ +use Ibexa\Contracts\Core\Repository\Repository; + +/** @var Repository $repository */ $source = 'pictures/*/*'; $destination = 'media/images/{1}/{2}'; $redirect = true; diff --git a/docs/content_management/workflow/add_custom_workflow_action.md b/docs/content_management/workflow/add_custom_workflow_action.md index 344b2f9fca0..9985b50bd41 100644 --- a/docs/content_management/workflow/add_custom_workflow_action.md +++ b/docs/content_management/workflow/add_custom_workflow_action.md @@ -81,9 +81,11 @@ You can also modify the context using the `setContext()` method. For example, you can override the message typed by the user: ``` php +use Symfony\Component\Workflow\Event\TransitionEvent; + /** * @var array $context - * @var \Symfony\Component\Workflow\Event\TransitionEvent $event + * @var TransitionEvent $event */ $new_context = $context; $new_context['message'] = 'This article went through proofreading'; diff --git a/docs/infrastructure_and_maintenance/background_tasks.md b/docs/infrastructure_and_maintenance/background_tasks.md index 534832b4d8e..9333aecda08 100644 --- a/docs/infrastructure_and_maintenance/background_tasks.md +++ b/docs/infrastructure_and_maintenance/background_tasks.md @@ -125,8 +125,7 @@ final readonly class SomeClassThatSchedulesExecutionInTheBackground { public function __construct( private MessageBusInterface $bus - ) { - } + ) {} public function schedule(): void { diff --git a/docs/infrastructure_and_maintenance/cache/http_cache/content_aware_cache.md b/docs/infrastructure_and_maintenance/cache/http_cache/content_aware_cache.md index 677f2e02a7e..eddbda3cf1d 100644 --- a/docs/infrastructure_and_maintenance/cache/http_cache/content_aware_cache.md +++ b/docs/infrastructure_and_maintenance/cache/http_cache/content_aware_cache.md @@ -172,10 +172,14 @@ Examples for tagging everything needed for content using the autowireable [`Resp Examples for adding specific content tags using the autowireable `ContentTagInterface`: ``` php +use Ibexa\Contracts\Core\Repository\Values\Content\Content; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Contracts\HttpCache\Handler\ContentTagInterface; + /** - * @var \Ibexa\Contracts\HttpCache\Handler\ContentTagInterface $tagHandler - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @var ContentTagInterface $tagHandler + * @var Content $content + * @var Location $location */ // Example for tagging everything needed for Content: @@ -196,9 +200,10 @@ In PHP, FOSHttpCache exposes the `fos_http_cache.http.symfony_response_tagger` s The following example adds minimal tags when ID 33 and 34 are rendered in ESI, but parent response needs these tags to get refreshed if they're deleted: ``` php +use FOS\HttpCacheBundle\Http\SymfonyResponseTagger; use Ibexa\Contracts\HttpCache\Handler\ContentTagInterface; -/** @var \FOS\HttpCacheBundle\Http\SymfonyResponseTagger $responseTagger */ +/** @var SymfonyResponseTagger $responseTagger */ $responseTagger->addTags([ContentTagInterface::RELATION_PREFIX . '33', ContentTagInterface::RELATION_PREFIX . '34']); ``` @@ -210,7 +215,9 @@ For custom or built-in controllers (for example, REST) that still use `X-Locatio It supports singular and comma-separated location ID value(s): ``` php -/** @var \Symfony\Component\HttpFoundation\Response $response */ +use Symfony\Component\HttpFoundation\Response; + +/** @var Response $response */ $response->headers->set('X-Location-Id', '123'); // Alternatively using several Location ID values @@ -342,8 +349,7 @@ class MyCustomCacheCommand public function __construct( #[Autowire(service: 'ibexa.http_cache.purge_client')] private readonly PurgeClientInterface $purgeClient - ) { - } + ) {} public function __invoke(SymfonyStyle $io): int { diff --git a/docs/infrastructure_and_maintenance/cache/http_cache/reverse_proxy.md b/docs/infrastructure_and_maintenance/cache/http_cache/reverse_proxy.md index 8e0d6ac9ae9..d2aab3f0ae4 100644 --- a/docs/infrastructure_and_maintenance/cache/http_cache/reverse_proxy.md +++ b/docs/infrastructure_and_maintenance/cache/http_cache/reverse_proxy.md @@ -93,7 +93,7 @@ framework: ``` php use Symfony\Component\HttpFoundation\Request; - /** @var \Symfony\Component\HttpFoundation\Request $request */ + /** @var Request $request */ Request::setTrustedProxies([$request->server->get('REMOTE_ADDR')], Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PROTO | Request::HEADER_X_FORWARDED_PORT); ``` diff --git a/docs/multisite/languages/back_office_translations.md b/docs/multisite/languages/back_office_translations.md index c861234a389..35e836121bb 100644 --- a/docs/multisite/languages/back_office_translations.md +++ b/docs/multisite/languages/back_office_translations.md @@ -64,9 +64,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; final readonly class MyService { - public function __construct(private TranslatorInterface $translator) - { - } + public function __construct(private TranslatorInterface $translator) {} public function getTranslatedDescription(): string { diff --git a/docs/multisite/siteaccess/injecting_siteaccess.md b/docs/multisite/siteaccess/injecting_siteaccess.md index cdf32cdb28b..d3ea7aae5ed 100644 --- a/docs/multisite/siteaccess/injecting_siteaccess.md +++ b/docs/multisite/siteaccess/injecting_siteaccess.md @@ -23,15 +23,18 @@ declare(strict_types=1); namespace App; -use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessServiceInterface; class MyService { public function __construct( - private readonly SiteAccessServiceInterface $siteAccessService, - private readonly ContentService $contentService - ) { + private readonly SiteAccessServiceInterface $siteAccessService + ) {} + + public function doSomethingWithCurrentSiteAccess(): void + { + $currentSiteAccess = $this->siteAccessService->getCurrent(); + // ... } } ``` diff --git a/docs/permissions/custom_policies.md b/docs/permissions/custom_policies.md index 9894dd3c17b..a66db693629 100644 --- a/docs/permissions/custom_policies.md +++ b/docs/permissions/custom_policies.md @@ -53,11 +53,11 @@ class MyPolicyProvider implements PolicyProviderInterface public function addPolicies(ConfigBuilderInterface $configBuilder): void { $configBuilder->addConfig([ - 'custom_module' => [ - 'custom_function_1' => null, - 'custom_function_2' => ['CustomLimitation'], - ], - ]); + 'custom_module' => [ + 'custom_function_1' => null, + 'custom_function_2' => ['CustomLimitation'], + ], + ]); } } ``` @@ -114,21 +114,21 @@ class MyPolicyProvider implements PolicyProviderInterface, TranslationContainerI public function addPolicies(ConfigBuilderInterface $configBuilder): void { $configBuilder->addConfig([ - 'custom_module' => [ - 'custom_function_1' => null, - 'custom_function_2' => ['CustomLimitation'], - ], - ]); + 'custom_module' => [ + 'custom_function_1' => null, + 'custom_function_2' => ['CustomLimitation'], + ], + ]); } - /** @return array<\JMS\TranslationBundle\Model\Message> */ + /** @return array */ public static function getTranslationMessages(): array { return [ - (new Message('role.policy.custom_module', 'forms'))->setDesc('Custom module'), - (new Message('role.policy.custom_module.all_functions', 'forms'))->setDesc('Custom module / All functions'), - (new Message('role.policy.custom_module.custom_function_1', 'forms'))->setDesc('Custom module / Function #1'), - (new Message('role.policy.custom_module.custom_function_2', 'forms'))->setDesc('Custom module / Function #2'), + new Message('role.policy.custom_module', 'forms')->setDesc('Custom module'), + new Message('role.policy.custom_module.all_functions', 'forms')->setDesc('Custom module / All functions'), + new Message('role.policy.custom_module.custom_function_1', 'forms')->setDesc('Custom module / Function #1'), + new Message('role.policy.custom_module.custom_function_2', 'forms')->setDesc('Custom module / Function #2'), ]; } } diff --git a/docs/resources/rector.md b/docs/resources/rector.md index a79b065fdca..82db589ad43 100644 --- a/docs/resources/rector.md +++ b/docs/resources/rector.md @@ -39,12 +39,12 @@ use Rector\Config\RectorConfig; return RectorConfig::configure() ->withPaths( [ - __DIR__ . '/src', + __DIR__ . '/src', ] ) ->withSets( [ - IbexaSetList::IBEXA_50->value, + IbexaSetList::IBEXA_50->value, ] ) ->withPhpSets(php83: true) diff --git a/docs/search/activity_log_search_reference/logged_at_criterion.md b/docs/search/activity_log_search_reference/logged_at_criterion.md index c39b486fa3f..603b71383a0 100644 --- a/docs/search/activity_log_search_reference/logged_at_criterion.md +++ b/docs/search/activity_log_search_reference/logged_at_criterion.md @@ -24,6 +24,6 @@ The following example is to match all activity log groups that aren't older than use Ibexa\Contracts\ActivityLog\Values\ActivityLog as ActivityLog; $query = new ActivityLog\Query([ - new ActivityLog\Criterion\LoggedAtCriterion(new \DateTime('- 1 day'), ActivityLog\Criterion\LoggedAtCriterion::GTE), + new ActivityLog\Criterion\LoggedAtCriterion(new DateTime('- 1 day'), ActivityLog\Criterion\LoggedAtCriterion::GTE), ]); ``` diff --git a/docs/search/activity_log_search_reference/object_criterion.md b/docs/search/activity_log_search_reference/object_criterion.md index 55e7b069319..6a26a1e6a27 100644 --- a/docs/search/activity_log_search_reference/object_criterion.md +++ b/docs/search/activity_log_search_reference/object_criterion.md @@ -11,16 +11,18 @@ The `ObjectCriterion` Activity Log Criterion matches log group with a log entry ``` php use Ibexa\Contracts\ActivityLog\Values\ActivityLog as ActivityLog; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; $query = new ActivityLog\Query([ - new ActivityLog\Criterion\ObjectCriterion(Ibexa\Contracts\Core\Repository\Values\Content\Content::class), + new ActivityLog\Criterion\ObjectCriterion(Content::class), ]); ``` ``` php use Ibexa\Contracts\ActivityLog\Values\ActivityLog as ActivityLog; +use Ibexa\Contracts\ProductCatalog\Values\ProductVariantInterface; $query = new ActivityLog\Query([ - new ActivityLog\Criterion\ObjectCriterion(Ibexa\Contracts\ProductCatalog\Values\ProductVariantInterface::class, ['123', '234', '345']), + new ActivityLog\Criterion\ObjectCriterion(ProductVariantInterface::class, ['123', '234', '345']), ]); ``` diff --git a/docs/search/aggregation_reference/daterange_aggregation.md b/docs/search/aggregation_reference/daterange_aggregation.md index 5a4a9b9edd8..e560550e597 100644 --- a/docs/search/aggregation_reference/daterange_aggregation.md +++ b/docs/search/aggregation_reference/daterange_aggregation.md @@ -25,9 +25,9 @@ $query->aggregations[] = new Aggregation\Field\DateRangeAggregation( 'event', 'event_date', [ - Range::ofDateTime(null, new DateTime('2020-06-01')), - Range::ofDateTime(new DateTime('2020-06-01'), new DateTime('2020-12-31')), - Range::ofDateTime(new DateTime('2020-12-31'), null), -] + Range::ofDateTime(null, new DateTime('2020-06-01')), + Range::ofDateTime(new DateTime('2020-06-01'), new DateTime('2020-12-31')), + Range::ofDateTime(new DateTime('2020-12-31'), null), + ] ); ``` diff --git a/docs/search/aggregation_reference/datetimerange_aggregation.md b/docs/search/aggregation_reference/datetimerange_aggregation.md index 8e4cab9f28c..fd9873e51e1 100644 --- a/docs/search/aggregation_reference/datetimerange_aggregation.md +++ b/docs/search/aggregation_reference/datetimerange_aggregation.md @@ -25,9 +25,9 @@ $query->aggregations[] = new Aggregation\Field\DateTimeRangeAggregation( 'event', 'event_date', [ - Range::ofDateTime(null, new DateTime('2020-06-01')), - Range::ofDateTime(new DateTime('2020-06-01'), new DateTime('2020-12-31')), - Range::ofDateTime(new DateTime('2020-12-31'), null), -] + Range::ofDateTime(null, new DateTime('2020-06-01')), + Range::ofDateTime(new DateTime('2020-06-01'), new DateTime('2020-12-31')), + Range::ofDateTime(new DateTime('2020-12-31'), null), + ] ); ``` diff --git a/docs/search/aggregation_reference/floatrange_aggregation.md b/docs/search/aggregation_reference/floatrange_aggregation.md index e5451c4979d..1f6f122c953 100644 --- a/docs/search/aggregation_reference/floatrange_aggregation.md +++ b/docs/search/aggregation_reference/floatrange_aggregation.md @@ -25,9 +25,9 @@ $query->aggregations[] = new Aggregation\Field\FloatRangeAggregation( 'product', 'weight', [ - Range::ofFloat(null, 0.25), - Range::ofFloat(0.25, 0.75), - Range::ofFloat(0.75, null), -] + Range::ofFloat(null, 0.25), + Range::ofFloat(0.25, 0.75), + Range::ofFloat(0.75, null), + ] ); ``` diff --git a/docs/search/aggregation_reference/integerrange_aggregation.md b/docs/search/aggregation_reference/integerrange_aggregation.md index 4080d205218..ff33e1e3941 100644 --- a/docs/search/aggregation_reference/integerrange_aggregation.md +++ b/docs/search/aggregation_reference/integerrange_aggregation.md @@ -25,9 +25,9 @@ $query->aggregations[] = new Aggregation\Field\IntegerRangeAggregation( 'product', 'amount', [ - Range::ofInt(null, 12), - Range::ofInt(12, 24), - Range::ofInt(24, null), -] + Range::ofInt(null, 12), + Range::ofInt(12, 24), + Range::ofInt(24, null), + ] ); ``` diff --git a/docs/search/aggregation_reference/timerange_aggregation.md b/docs/search/aggregation_reference/timerange_aggregation.md index bd1fc9a1e84..9dc40ba7b17 100644 --- a/docs/search/aggregation_reference/timerange_aggregation.md +++ b/docs/search/aggregation_reference/timerange_aggregation.md @@ -30,8 +30,8 @@ $query->aggregations[] = new Aggregation\Field\TimeRangeAggregation( 'event', 'event_time', [ - Range::ofInt(null, $timestamp), - Range::ofInt($timestamp, null), -] + Range::ofInt(null, $timestamp), + Range::ofInt($timestamp, null), + ] ); ``` diff --git a/docs/search/criteria_reference/ancestor_criterion.md b/docs/search/criteria_reference/ancestor_criterion.md index 024d8c3c9cb..e98b23a9c82 100644 --- a/docs/search/criteria_reference/ancestor_criterion.md +++ b/docs/search/criteria_reference/ancestor_criterion.md @@ -15,11 +15,12 @@ The [`Ancestor` Search Criterion](/api/php_api/php_api_reference/classes/Ibexa-C ### PHP ``` php +use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\Values\Content\Query; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; $query = new Query(); -/** @var \Ibexa\Contracts\Core\Repository\LocationService $locationService */ +/** @var LocationService $locationService */ $query->query = new Criterion\Ancestor([$locationService->loadLocation(62)->pathString]); ``` @@ -49,26 +50,39 @@ $query->query = new Criterion\Ancestor([$locationService->loadLocation(62)->path You can use the Ancestor Search Criterion to create a list of breadcrumbs leading to the Location: -``` php hl_lines="8" +``` php hl_lines="20" +use Ibexa\Bundle\Core\Controller; +use Ibexa\Contracts\Core\Repository\LocationService; +use Ibexa\Contracts\Core\Repository\SearchService; use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Symfony\Component\HttpFoundation\Response; + +class NavigationController extends Controller +{ + public function __construct( + private readonly LocationService $locationService, + private readonly SearchService $searchService + ) {} + + public function breadcrumbsAction(): Response + { + $locationId = 12345; + + $query = new LocationQuery(); + $query->query = new Criterion\Ancestor([$this->locationService->loadLocation($locationId)->pathString]); + + $results = $this->searchService->findLocations($query); + $breadcrumbs = []; + foreach ($results->searchHits as $searchHit) { + $breadcrumbs[] = $searchHit; + } -$locationId = 12345; - -$query = new LocationQuery(); -/** @var \Ibexa\Contracts\Core\Repository\LocationService $locationService */ -$query->query = new Criterion\Ancestor([$locationService->loadLocation($locationId)->pathString]); - -/** @var \Ibexa\Contracts\Core\Repository\SearchService $searchService */ -$results = $searchService->findLocations($query); -$breadcrumbs = []; -foreach ($results->searchHits as $searchHit) { - $breadcrumbs[] = $searchHit; + return $this->render('parts/breadcrumbs.html.twig', [ + 'breadcrumbs' => $breadcrumbs, + ]); + } } - -return $this->render('parts/breadcrumbs.html.twig', [ - 'breadcrumbs' => $breadcrumbs, -]); ``` ``` html+twig diff --git a/docs/search/criteria_reference/baseprice_criterion.md b/docs/search/criteria_reference/baseprice_criterion.md index c834d0b4166..a540349c39c 100644 --- a/docs/search/criteria_reference/baseprice_criterion.md +++ b/docs/search/criteria_reference/baseprice_criterion.md @@ -21,13 +21,15 @@ The `BasePrice` Criterion isn't available in the Legacy Search engine. ``` php use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\BasePrice; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\Operator; +use Money\Money; $query = new ProductQuery( null, - new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\BasePrice( - \Money\Money::EUR(12900), - \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\Operator::GTE + new BasePrice( + Money::EUR(12900), + Operator::GTE ) ); ``` diff --git a/docs/search/criteria_reference/checkboxattribute_criterion.md b/docs/search/criteria_reference/checkboxattribute_criterion.md index 64fefc9895b..e2d984bf525 100644 --- a/docs/search/criteria_reference/checkboxattribute_criterion.md +++ b/docs/search/criteria_reference/checkboxattribute_criterion.md @@ -17,10 +17,10 @@ The `CheckboxAttribute` Search Criterion searches for products by the value of t ``` php use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\CheckboxAttribute; $query = new ProductQuery( null, - new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\CheckboxAttribute('automatic', true) + new CheckboxAttribute('automatic', true) ); ``` diff --git a/docs/search/criteria_reference/colorattribute_criterion.md b/docs/search/criteria_reference/colorattribute_criterion.md index 2de0571bbb1..909557896b9 100644 --- a/docs/search/criteria_reference/colorattribute_criterion.md +++ b/docs/search/criteria_reference/colorattribute_criterion.md @@ -17,11 +17,11 @@ The `ColorAttribute` Search Criterion searches for products by the value of thei ``` php use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ColorAttribute; $query = new ProductQuery( null, - new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ColorAttribute('color', ['#FF0000']) + new ColorAttribute('color', ['#FF0000']) ); ``` diff --git a/docs/search/criteria_reference/createdat_criterion.md b/docs/search/criteria_reference/createdat_criterion.md index 1c146535aad..1eaa41e1e68 100644 --- a/docs/search/criteria_reference/createdat_criterion.md +++ b/docs/search/criteria_reference/createdat_criterion.md @@ -17,11 +17,12 @@ The `CreatedAt` Search Criterion searches for products based on the date when th ``` php use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\CreatedAt; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\Operator; -$criteria = new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\CreatedAt( +$criteria = new CreatedAt( new DateTime('2023-03-01'), - \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\Operator::GTE, + Operator::GTE, ); $productQuery = new ProductQuery(null, $criteria); diff --git a/docs/search/criteria_reference/createdatrange_criterion.md b/docs/search/criteria_reference/createdatrange_criterion.md index 04a1265c202..d45b8b1d10c 100644 --- a/docs/search/criteria_reference/createdatrange_criterion.md +++ b/docs/search/criteria_reference/createdatrange_criterion.md @@ -17,11 +17,11 @@ The `CreatedAtRange` Search Criterion searches for products based on the date ra ``` php use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\CreatedAtRange; -$criteria = new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\CreatedAtRange( - new \DateTimeImmutable('2020-07-10T00:00:00+00:00'), - new \DateTimeImmutable('2023-07-12T00:00:00+00:00') +$criteria = new CreatedAtRange( + new DateTimeImmutable('2020-07-10T00:00:00+00:00'), + new DateTimeImmutable('2023-07-12T00:00:00+00:00') ); $productQuery = new ProductQuery(null, $criteria); diff --git a/docs/search/criteria_reference/currencycode_criterion.md b/docs/search/criteria_reference/currencycode_criterion.md index 7c6b98cbe51..05bc50b41ed 100644 --- a/docs/search/criteria_reference/currencycode_criterion.md +++ b/docs/search/criteria_reference/currencycode_criterion.md @@ -20,8 +20,9 @@ The `CurrencyCodeCriterion` Criterion isn't available in Solr or Elasticsearch e ``` php use Ibexa\Contracts\ProductCatalog\Values\Currency\CurrencyQuery; +use Ibexa\Contracts\ProductCatalog\Values\Currency\Query\Criterion\CurrencyCodeCriterion; $query = new CurrencyQuery( - new \Ibexa\Contracts\ProductCatalog\Values\Currency\Query\Criterion\CurrencyCodeCriterion('EUR') + new CurrencyCodeCriterion('EUR') ); ``` diff --git a/docs/search/criteria_reference/customprice_criterion.md b/docs/search/criteria_reference/customprice_criterion.md index 0855e9e5960..dc5721cf796 100644 --- a/docs/search/criteria_reference/customprice_criterion.md +++ b/docs/search/criteria_reference/customprice_criterion.md @@ -22,15 +22,18 @@ The `CustomPrice` Criterion isn't available in the Legacy Search engine. ### PHP ``` php +use Ibexa\Contracts\ProductCatalog\Values\CustomerGroupInterface; use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\CustomPrice; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\Operator; +use Money\Money; -/** @var \Ibexa\Contracts\ProductCatalog\Values\CustomerGroupInterface $customerGroup */ +/** @var CustomerGroupInterface $customerGroup */ $query = new ProductQuery( null, - new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\CustomPrice( - \Money\Money::EUR(13800), - \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\Operator::GTE, + new CustomPrice( + Money::EUR(13800), + Operator::GTE, $customerGroup ) ); diff --git a/docs/search/criteria_reference/floatattribute_criterion.md b/docs/search/criteria_reference/floatattribute_criterion.md index 928f495b7a7..164d4504f46 100644 --- a/docs/search/criteria_reference/floatattribute_criterion.md +++ b/docs/search/criteria_reference/floatattribute_criterion.md @@ -17,11 +17,11 @@ The `FloatAttribute` Search Criterion searches for products by the value of thei ``` php use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\FloatAttribute; $query = new ProductQuery( null, - new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\FloatAttribute( + new FloatAttribute( 'length', 16.5 ) diff --git a/docs/search/criteria_reference/image_criterion.md b/docs/search/criteria_reference/image_criterion.md index 43ad087a37a..a8cd90c1cdc 100644 --- a/docs/search/criteria_reference/image_criterion.md +++ b/docs/search/criteria_reference/image_criterion.md @@ -21,10 +21,10 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; $imageCriteriaData = [ 'mimeTypes' => [ - 'image/png', + 'image/png', ], 'orientation' => [ - 'image/png', + 'image/png', ], 'width' => [ 'min' => 0, // (default: 0, optional) diff --git a/docs/search/criteria_reference/imageorientation_criterion.md b/docs/search/criteria_reference/imageorientation_criterion.md index 73d54f75b0a..4e697610547 100644 --- a/docs/search/criteria_reference/imageorientation_criterion.md +++ b/docs/search/criteria_reference/imageorientation_criterion.md @@ -20,7 +20,6 @@ Supported orientation values: landscape, portrait and square. ``` php use Ibexa\Contracts\Core\Repository\Values\Content\Query; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Image\Orientation; $query = new Query(); diff --git a/docs/search/criteria_reference/integerattribute_criterion.md b/docs/search/criteria_reference/integerattribute_criterion.md index 9981cabd3c6..3b15279b70f 100644 --- a/docs/search/criteria_reference/integerattribute_criterion.md +++ b/docs/search/criteria_reference/integerattribute_criterion.md @@ -17,11 +17,11 @@ The `IntegerAttribute` Search Criterion searches for products by the value of th ``` php use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\IntegerAttribute; $query = new ProductQuery( null, - new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\IntegerAttribute( + new IntegerAttribute( 'size', 38 ) diff --git a/docs/search/criteria_reference/iscurrencyenabled_criterion.md b/docs/search/criteria_reference/iscurrencyenabled_criterion.md index d4705842110..1cad2041abc 100644 --- a/docs/search/criteria_reference/iscurrencyenabled_criterion.md +++ b/docs/search/criteria_reference/iscurrencyenabled_criterion.md @@ -21,8 +21,9 @@ The `IsCurrencyEnabledCriterion` Criterion isn't available in Solr or Elasticsea ``` php use Ibexa\Contracts\ProductCatalog\Values\Currency\CurrencyQuery; +use Ibexa\Contracts\ProductCatalog\Values\Currency\Query\Criterion\IsCurrencyEnabledCriterion; $query = new CurrencyQuery( - new \Ibexa\Contracts\ProductCatalog\Values\Currency\Query\Criterion\IsCurrencyEnabledCriterion() + new IsCurrencyEnabledCriterion() ); ``` diff --git a/docs/search/criteria_reference/ismainlocation_criterion.md b/docs/search/criteria_reference/ismainlocation_criterion.md index d3790a5045e..4686ce7b341 100644 --- a/docs/search/criteria_reference/ismainlocation_criterion.md +++ b/docs/search/criteria_reference/ismainlocation_criterion.md @@ -19,9 +19,8 @@ representing whether to search for a main or not main location ``` php use Ibexa\Contracts\Core\Repository\Values\Content\Query; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Location\IsMainLocation; $query = new Query(); -$query->query = new Criterion\Location\IsMainLocation(IsMainLocation::MAIN); +$query->query = new IsMainLocation(IsMainLocation::MAIN); ``` diff --git a/docs/search/criteria_reference/isproductbased_criterion.md b/docs/search/criteria_reference/isproductbased_criterion.md index 507450e3e3c..28e094f3752 100644 --- a/docs/search/criteria_reference/isproductbased_criterion.md +++ b/docs/search/criteria_reference/isproductbased_criterion.md @@ -12,8 +12,8 @@ The `IsProductBased` Search Criterion searches for content that plays the role o ``` php use Ibexa\Contracts\Core\Repository\Values\Content\Query; -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\ProductCatalog\Values\Content\Query\Criterion\IsProductBased; $query = new Query(); -$query->query = new \Ibexa\Contracts\ProductCatalog\Values\Content\Query\Criterion\IsProductBased(); +$query->query = new IsProductBased(); ``` diff --git a/docs/search/criteria_reference/isvirtual_criterion.md b/docs/search/criteria_reference/isvirtual_criterion.md index 5f2bb3aa029..a26d68ca97b 100644 --- a/docs/search/criteria_reference/isvirtual_criterion.md +++ b/docs/search/criteria_reference/isvirtual_criterion.md @@ -16,11 +16,11 @@ The `IsVirtual` Search Criterion searches for virtual or physical products. ``` php use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\IsVirtual; $query = new ProductQuery( null, - new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\IsVirtual(true) + new IsVirtual(true) ); ``` diff --git a/docs/search/criteria_reference/languagecode_criterion.md b/docs/search/criteria_reference/languagecode_criterion.md index 7b74156f66d..98da0ba178d 100644 --- a/docs/search/criteria_reference/languagecode_criterion.md +++ b/docs/search/criteria_reference/languagecode_criterion.md @@ -51,20 +51,21 @@ You can use the `LanguageCode` Criterion to search for articles that are lacking into a specific language: ``` php hl_lines="9" +use Ibexa\Contracts\Core\Repository\SearchService; use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; $query = new LocationQuery(); $query->query = new Criterion\LogicalAnd( [ - new Criterion\ContentTypeIdentifier('article'), - new Criterion\LogicalNot( - new Criterion\LanguageCode('ger-DE', false) - ), + new Criterion\ContentTypeIdentifier('article'), + new Criterion\LogicalNot( + new Criterion\LanguageCode('ger-DE', false) + ), ] ); -/** @var \Ibexa\Contracts\Core\Repository\SearchService $searchService */ +/** @var SearchService $searchService */ $results = $searchService->findContent($query); $articlesToTranslate = []; foreach ($results->searchHits as $searchHit) { diff --git a/docs/search/criteria_reference/order_company_associated_criterion.md b/docs/search/criteria_reference/order_company_associated_criterion.md index 84e95296144..9f72d0b59b0 100644 --- a/docs/search/criteria_reference/order_company_associated_criterion.md +++ b/docs/search/criteria_reference/order_company_associated_criterion.md @@ -16,10 +16,10 @@ The `IsCompanyAssociatedCriterion` Search Criterion searches for orders based on ### PHP ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\OrderManagement\Value\Order\OrderQuery; +use Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\IsCompanyAssociatedCriterion; $query = new OrderQuery( - new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\IsCompanyAssociatedCriterion(true) + new IsCompanyAssociatedCriterion(true) ); ``` diff --git a/docs/search/criteria_reference/order_company_name_criterion.md b/docs/search/criteria_reference/order_company_name_criterion.md index 170fd0eaaa0..d1eb532dd21 100644 --- a/docs/search/criteria_reference/order_company_name_criterion.md +++ b/docs/search/criteria_reference/order_company_name_criterion.md @@ -16,10 +16,10 @@ The `CompanyNameCriterion` Search Criterion searches for orders based on the nam ### PHP ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\OrderManagement\Value\Order\OrderQuery; +use Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\CompanyNameCriterion; $query = new OrderQuery( - new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\CompanyNameCriterion('IBM') + new CompanyNameCriterion('IBM') ); ``` diff --git a/docs/search/criteria_reference/order_created_criterion.md b/docs/search/criteria_reference/order_created_criterion.md index ac566ca2e67..c2e31af5ce1 100644 --- a/docs/search/criteria_reference/order_created_criterion.md +++ b/docs/search/criteria_reference/order_created_criterion.md @@ -18,9 +18,9 @@ The `CreatedAtCriterion` Search Criterion searches for orders based on the date ``` php use Ibexa\Contracts\OrderManagement\Value\Order\OrderQuery; -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; +use Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\CreatedAtCriterion; -$criteria = new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\CreatedAtCriterion( +$criteria = new CreatedAtCriterion( new DateTime('2023-03-01'), 'GTE' ); diff --git a/docs/search/criteria_reference/order_currency_code_criterion.md b/docs/search/criteria_reference/order_currency_code_criterion.md index 9f0b5f639c5..242d68ecced 100644 --- a/docs/search/criteria_reference/order_currency_code_criterion.md +++ b/docs/search/criteria_reference/order_currency_code_criterion.md @@ -16,10 +16,10 @@ The `CurrencyCodeCriterion` Search Criterion searches for orders based on the cu ### PHP ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\OrderManagement\Value\Order\OrderQuery; +use Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\CurrencyCodeCriterion; $query = new OrderQuery( - new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\CurrencyCodeCriterion('USD') + new CurrencyCodeCriterion('USD') ); ``` diff --git a/docs/search/criteria_reference/order_customer_name_criterion.md b/docs/search/criteria_reference/order_customer_name_criterion.md index 6f72425cc1c..976520401a1 100644 --- a/docs/search/criteria_reference/order_customer_name_criterion.md +++ b/docs/search/criteria_reference/order_customer_name_criterion.md @@ -16,10 +16,10 @@ The `CustomerNameCriterion` Search Criterion searches for orders based on the na ### PHP ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\OrderManagement\Value\Order\OrderQuery; +use Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\CustomerNameCriterion; $query = new OrderQuery( - new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\CustomerNameCriterion('john') + new CustomerNameCriterion('john') ); ``` diff --git a/docs/search/criteria_reference/order_identifier_criterion.md b/docs/search/criteria_reference/order_identifier_criterion.md index 107c4fa62df..9c475b656d2 100644 --- a/docs/search/criteria_reference/order_identifier_criterion.md +++ b/docs/search/criteria_reference/order_identifier_criterion.md @@ -16,10 +16,10 @@ The `IdentifierCriterion` Search Criterion searches for orders based on the orde ### PHP ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\OrderManagement\Value\Order\OrderQuery; +use Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\IdentifierCriterion; $query = new OrderQuery( - new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\IdentifierCriterion('f7578972-e7f4-4cae-85dc-a7c74610204e') + new IdentifierCriterion('f7578972-e7f4-4cae-85dc-a7c74610204e') ); ``` diff --git a/docs/search/criteria_reference/order_owner_criterion.md b/docs/search/criteria_reference/order_owner_criterion.md index 4b977a1e093..c869b154a3b 100644 --- a/docs/search/criteria_reference/order_owner_criterion.md +++ b/docs/search/criteria_reference/order_owner_criterion.md @@ -14,14 +14,15 @@ The `OwnerCriterion` Criterion searches for orders based on the user reference. ## Example ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\OrderManagement\Value\Order\OrderQuery; +use Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\OwnerCriterion; -/** @var \Ibexa\Contracts\Core\Repository\UserService $userService */ +/** @var UserService $userService */ $user = $userService->loadUserByLogin('user'); $query = new OrderQuery( - new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\OwnerCriterion( + new OwnerCriterion( $user ) ); @@ -30,18 +31,19 @@ $query = new OrderQuery( `OwnerCriterion` Criterion accepts also multiple values: ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\OrderManagement\Value\Order\OrderQuery; +use Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\OwnerCriterion; -/** @var \Ibexa\Contracts\Core\Repository\UserService $userService */ +/** @var UserService $userService */ $user1 = $userService->loadUser(12345); $user2 = $userService->loadUserByLogin('user'); $query = new OrderQuery( - new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\OwnerCriterion( + new OwnerCriterion( [ - $user1, - $user2, + $user1, + $user2, ] ) ); diff --git a/docs/search/criteria_reference/order_price_criterion.md b/docs/search/criteria_reference/order_price_criterion.md index e72f32c77b1..53ef13ae14c 100644 --- a/docs/search/criteria_reference/order_price_criterion.md +++ b/docs/search/criteria_reference/order_price_criterion.md @@ -17,10 +17,10 @@ The `PriceCriterion` searches for orders by their total net value. ### PHP ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\OrderManagement\Value\Order\OrderQuery; +use Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\PriceCriterion; -$criteria = new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\PriceCriterion( +$criteria = new PriceCriterion( 12900, 'GTE' ); diff --git a/docs/search/criteria_reference/order_source_criterion.md b/docs/search/criteria_reference/order_source_criterion.md index 956fae1ec38..17ebc6a9879 100644 --- a/docs/search/criteria_reference/order_source_criterion.md +++ b/docs/search/criteria_reference/order_source_criterion.md @@ -16,10 +16,10 @@ The `SourceCriterion` Search Criterion searches for orders based on the source o ### PHP ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\OrderManagement\Value\Order\OrderQuery; +use Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\SourceCriterion; $query = new OrderQuery( - new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\SourceCriterion('local_shop') + new SourceCriterion('local_shop') ); ``` diff --git a/docs/search/criteria_reference/order_status_criterion.md b/docs/search/criteria_reference/order_status_criterion.md index 237b2026940..009864ab757 100644 --- a/docs/search/criteria_reference/order_status_criterion.md +++ b/docs/search/criteria_reference/order_status_criterion.md @@ -16,10 +16,10 @@ The `StatusCriterion` Search Criterion searches for orders based on order status ### PHP ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\OrderManagement\Value\Order\OrderQuery; +use Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\StatusCriterion; $query = new OrderQuery( - new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\StatusCriterion('pending') + new StatusCriterion('pending') ); ``` diff --git a/docs/search/criteria_reference/parentlocationid_criterion.md b/docs/search/criteria_reference/parentlocationid_criterion.md index eb1514964ba..0fb4b7756d9 100644 --- a/docs/search/criteria_reference/parentlocationid_criterion.md +++ b/docs/search/criteria_reference/parentlocationid_criterion.md @@ -49,28 +49,40 @@ $query->query = new Criterion\ParentLocationId([54, 58]); You can use the `ParentLocationId` Search Criterion to list blog posts contained in a blog: -``` php hl_lines="9" +``` php hl_lines="20" +use Ibexa\Bundle\Core\Controller; +use Ibexa\Contracts\Core\Repository\SearchService; use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Symfony\Component\HttpFoundation\Response; + +class NavigationController extends Controller +{ + public function __construct( + private readonly SearchService $searchService + ) {} + + public function blogAction(): Response + { + $locationId = 12345; + + $query = new LocationQuery(); + $query->query = new Criterion\LogicalAnd([ + new Criterion\Visibility(Criterion\Visibility::VISIBLE), + new Criterion\ParentLocationId($locationId), + ]); + + $results = $this->searchService->findLocations($query); + $posts = []; + foreach ($results->searchHits as $searchHit) { + $posts[] = $searchHit; + } -$locationId = 12345; - -$query = new LocationQuery(); -$query->query = new Criterion\LogicalAnd([ - new Criterion\Visibility(Criterion\Visibility::VISIBLE), - new Criterion\ParentLocationId($locationId), -]); - -/** @var \Ibexa\Contracts\Core\Repository\SearchService $searchService */ -$results = $searchService->findLocations($query); -$posts = []; -foreach ($results->searchHits as $searchHit) { - $posts[] = $searchHit; + return $this->render('full/blog.html.twig', [ + 'posts' => $posts, + ]); + } } - -return $this->render('full/blog.html.twig', [ - 'posts' => $posts, -]); ``` ``` html+twig diff --git a/docs/search/criteria_reference/payment_createdat_criterion.md b/docs/search/criteria_reference/payment_createdat_criterion.md index 66c1130db3d..c6cb6ae5bad 100644 --- a/docs/search/criteria_reference/payment_createdat_criterion.md +++ b/docs/search/criteria_reference/payment_createdat_criterion.md @@ -18,9 +18,9 @@ The `CreatedAt` Search Criterion searches for payments based on the date when th ``` php use Ibexa\Contracts\Payment\Payment\PaymentQuery; -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; +use Ibexa\Contracts\Payment\Payment\Query\Criterion\CreatedAt; -$criteria = new \Ibexa\Contracts\Payment\Payment\Query\Criterion\CreatedAt( +$criteria = new CreatedAt( new DateTime('2023-03-01') ); $query = new PaymentQuery($criteria); diff --git a/docs/search/criteria_reference/payment_currency_criterion.md b/docs/search/criteria_reference/payment_currency_criterion.md index 59829269d6c..55867be94fc 100644 --- a/docs/search/criteria_reference/payment_currency_criterion.md +++ b/docs/search/criteria_reference/payment_currency_criterion.md @@ -17,8 +17,9 @@ The `Currency` Search Criterion searches for payments based on the currency code ``` php use Ibexa\Contracts\Payment\Payment\PaymentQuery; +use Ibexa\Contracts\Payment\Payment\Query\Criterion\Currency; $query = new PaymentQuery( - new \Ibexa\Contracts\Payment\Payment\Query\Criterion\Currency('EUR') + new Currency('EUR') ); ``` diff --git a/docs/search/criteria_reference/payment_id_criterion.md b/docs/search/criteria_reference/payment_id_criterion.md index 6c1a9bfeb3d..8f2e43120b2 100644 --- a/docs/search/criteria_reference/payment_id_criterion.md +++ b/docs/search/criteria_reference/payment_id_criterion.md @@ -17,8 +17,9 @@ The `Id` Search Criterion searches for payments based on the payment ID. ``` php use Ibexa\Contracts\Payment\Payment\PaymentQuery; +use Ibexa\Contracts\Payment\Payment\Query\Criterion\Id; $query = new PaymentQuery( - new \Ibexa\Contracts\Payment\Payment\Query\Criterion\Id(2) + new Id(2) ); ``` diff --git a/docs/search/criteria_reference/payment_identifier_criterion.md b/docs/search/criteria_reference/payment_identifier_criterion.md index 7de17744f0a..40d088169bf 100644 --- a/docs/search/criteria_reference/payment_identifier_criterion.md +++ b/docs/search/criteria_reference/payment_identifier_criterion.md @@ -17,8 +17,9 @@ The `Identifier` Search Criterion searches for payments based on the payment ide ``` php use Ibexa\Contracts\Payment\Payment\PaymentQuery; +use Ibexa\Contracts\Payment\Payment\Query\Criterion\Identifier; $query = new PaymentQuery( - new \Ibexa\Contracts\Payment\Payment\Query\Criterion\Identifier('f7578972-e7f4-4cae-85dc-a7c74610204e') + new Identifier('f7578972-e7f4-4cae-85dc-a7c74610204e') ); ``` diff --git a/docs/search/criteria_reference/payment_method_createdat_criterion.md b/docs/search/criteria_reference/payment_method_createdat_criterion.md index fd2280a011a..48fc9c135c4 100644 --- a/docs/search/criteria_reference/payment_method_createdat_criterion.md +++ b/docs/search/criteria_reference/payment_method_createdat_criterion.md @@ -18,9 +18,9 @@ The `CreatedAt` Search Criterion searches for payment methods based on the date ``` php use Ibexa\Contracts\Payment\PaymentMethod\PaymentMethodQuery; -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; +use Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\CreatedAt; -$criteria = new \Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\CreatedAt( +$criteria = new CreatedAt( new DateTime('2023-03-01') ); $query = new PaymentMethodQuery($criteria); diff --git a/docs/search/criteria_reference/payment_method_enabled_criterion.md b/docs/search/criteria_reference/payment_method_enabled_criterion.md index 2447da755f1..868a1e2059c 100644 --- a/docs/search/criteria_reference/payment_method_enabled_criterion.md +++ b/docs/search/criteria_reference/payment_method_enabled_criterion.md @@ -17,8 +17,9 @@ The `Enabled` Search Criterion searches for payment methods based on whether the ``` php use Ibexa\Contracts\Payment\PaymentMethod\PaymentMethodQuery; +use Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\Enabled; $query = new PaymentMethodQuery( - new \Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\Enabled(true) + new Enabled(true) ); ``` diff --git a/docs/search/criteria_reference/payment_method_id_criterion.md b/docs/search/criteria_reference/payment_method_id_criterion.md index 2a2a7fb661a..1c0f4557812 100644 --- a/docs/search/criteria_reference/payment_method_id_criterion.md +++ b/docs/search/criteria_reference/payment_method_id_criterion.md @@ -17,8 +17,9 @@ The `Id` Search Criterion searches for payment methods based on the payment meth ``` php use Ibexa\Contracts\Payment\PaymentMethod\PaymentMethodQuery; +use Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\Id; $query = new PaymentMethodQuery( - new \Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\Id(2) + new Id(2) ); ``` diff --git a/docs/search/criteria_reference/payment_method_identifier_criterion.md b/docs/search/criteria_reference/payment_method_identifier_criterion.md index 809cf68adc9..79f6e2a29e0 100644 --- a/docs/search/criteria_reference/payment_method_identifier_criterion.md +++ b/docs/search/criteria_reference/payment_method_identifier_criterion.md @@ -17,8 +17,9 @@ The `Identifier` Search Criterion searches for payment methods based on the paym ``` php use Ibexa\Contracts\Payment\PaymentMethod\PaymentMethodQuery; +use Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\Identifier; $query = new PaymentMethodQuery( - new \Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\Identifier('f7578972-e7f4-4cae-85dc-a7c74610204e') + new Identifier('f7578972-e7f4-4cae-85dc-a7c74610204e') ); ``` diff --git a/docs/search/criteria_reference/payment_method_name_criterion.md b/docs/search/criteria_reference/payment_method_name_criterion.md index 95499b72c6f..331d3a74f44 100644 --- a/docs/search/criteria_reference/payment_method_name_criterion.md +++ b/docs/search/criteria_reference/payment_method_name_criterion.md @@ -17,8 +17,9 @@ The `Name` Search Criterion searches for payment methods based on the existing p ``` php use Ibexa\Contracts\Payment\PaymentMethod\PaymentMethodQuery; +use Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\Name; $query = new PaymentMethodQuery( - new \Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\Name('Credit Card') + new Name('Credit Card') ); ``` diff --git a/docs/search/criteria_reference/payment_method_type_criterion.md b/docs/search/criteria_reference/payment_method_type_criterion.md index 72524ab9623..2e1a789ef1d 100644 --- a/docs/search/criteria_reference/payment_method_type_criterion.md +++ b/docs/search/criteria_reference/payment_method_type_criterion.md @@ -17,11 +17,13 @@ The `Type` Search Criterion searches for payment methods based on payment method ``` php use Ibexa\Contracts\Payment\PaymentMethod\PaymentMethodQuery; +use Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\Type; +use Ibexa\Contracts\Payment\PaymentMethod\Type\TypeRegistryInterface; -/** @var \Ibexa\Contracts\Payment\PaymentMethod\Type\TypeRegistryInterface $paymentMethodTypeRegistry */ +/** @var TypeRegistryInterface $paymentMethodTypeRegistry */ $paymentMethodType = $paymentMethodTypeRegistry->getPaymentMethodType('offline'); $query = new PaymentMethodQuery( - new \Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\Type($paymentMethodType) + new Type($paymentMethodType) ); ``` diff --git a/docs/search/criteria_reference/payment_method_updatedat_criterion.md b/docs/search/criteria_reference/payment_method_updatedat_criterion.md index 13a04438f65..21d6765dc6b 100644 --- a/docs/search/criteria_reference/payment_method_updatedat_criterion.md +++ b/docs/search/criteria_reference/payment_method_updatedat_criterion.md @@ -17,10 +17,10 @@ The `UpdatedAt` Search Criterion searches for payment methods based on the date ### PHP ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Payment\PaymentMethod\PaymentMethodQuery; +use Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\UpdatedAt; -$criteria = new \Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\UpdatedAt( +$criteria = new UpdatedAt( new DateTime('2023-03-01') ); $query = new PaymentMethodQuery($criteria); diff --git a/docs/search/criteria_reference/payment_order_criterion.md b/docs/search/criteria_reference/payment_order_criterion.md index 3eaf0045660..0876f8e1222 100644 --- a/docs/search/criteria_reference/payment_order_criterion.md +++ b/docs/search/criteria_reference/payment_order_criterion.md @@ -16,12 +16,14 @@ The `Order` Search Criterion searches for payments based on an ID of an associat ### PHP ``` php +use Ibexa\Contracts\OrderManagement\OrderServiceInterface; use Ibexa\Contracts\Payment\Payment\PaymentQuery; +use Ibexa\Contracts\Payment\Payment\Query\Criterion\Order; -/** @var \Ibexa\Contracts\OrderManagement\OrderServiceInterface $orderService */ +/** @var OrderServiceInterface $orderService */ $order = $orderService->getOrder(4); $query = new PaymentQuery( - new \Ibexa\Contracts\Payment\Payment\Query\Criterion\Order($order) + new Order($order) ); ``` diff --git a/docs/search/criteria_reference/payment_payment_method_criterion.md b/docs/search/criteria_reference/payment_payment_method_criterion.md index 98d7d033c3c..7253c6c9205 100644 --- a/docs/search/criteria_reference/payment_payment_method_criterion.md +++ b/docs/search/criteria_reference/payment_payment_method_criterion.md @@ -17,11 +17,13 @@ The `PaymentMethod` Search Criterion searches for payments based on a payment me ``` php use Ibexa\Contracts\Payment\Payment\PaymentQuery; +use Ibexa\Contracts\Payment\Payment\Query\Criterion\PaymentMethod; +use Ibexa\Contracts\Payment\PaymentMethodServiceInterface; -/** @var \Ibexa\Contracts\Payment\PaymentMethodServiceInterface $paymentMethodService */ +/** @var PaymentMethodServiceInterface $paymentMethodService */ $paymentMethod = $paymentMethodService->getPaymentMethod(2); $query = new PaymentQuery( - new \Ibexa\Contracts\Payment\Payment\Query\Criterion\PaymentMethod($paymentMethod) + new PaymentMethod($paymentMethod) ); ``` diff --git a/docs/search/criteria_reference/payment_status_criterion.md b/docs/search/criteria_reference/payment_status_criterion.md index deb1d6d8f2c..b1a3a70c456 100644 --- a/docs/search/criteria_reference/payment_status_criterion.md +++ b/docs/search/criteria_reference/payment_status_criterion.md @@ -17,8 +17,9 @@ The `Status` Search Criterion searches for payments based on payment status. ``` php use Ibexa\Contracts\Payment\Payment\PaymentQuery; +use Ibexa\Contracts\Payment\Payment\Query\Criterion\Status; $query = new PaymentQuery( - new \Ibexa\Contracts\Payment\Payment\Query\Criterion\Status('failed') + new Status('failed') ); ``` diff --git a/docs/search/criteria_reference/payment_updatedat_criterion.md b/docs/search/criteria_reference/payment_updatedat_criterion.md index 8257b614ac7..b605c97afee 100644 --- a/docs/search/criteria_reference/payment_updatedat_criterion.md +++ b/docs/search/criteria_reference/payment_updatedat_criterion.md @@ -17,10 +17,10 @@ The `UpdatedAt` Search Criterion searches for payments based on the date when th ### PHP ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Payment\Payment\PaymentQuery; +use Ibexa\Contracts\Payment\Payment\Query\Criterion\UpdatedAt; -$criteria = new \Ibexa\Contracts\Payment\Payment\Query\Criterion\UpdatedAt( +$criteria = new UpdatedAt( new DateTime('2023-03-01') ); $query = new PaymentQuery($criteria); diff --git a/docs/search/criteria_reference/price_currency_criterion.md b/docs/search/criteria_reference/price_currency_criterion.md index c96105d174b..1f01014507a 100644 --- a/docs/search/criteria_reference/price_currency_criterion.md +++ b/docs/search/criteria_reference/price_currency_criterion.md @@ -15,13 +15,14 @@ The `Currency` Search Criterion searches for prices based on the given currency. ### PHP ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\ProductCatalog\CurrencyServiceInterface; use Ibexa\Contracts\ProductCatalog\Values\Price\PriceQuery; +use Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\Currency; -/** @var \Ibexa\Contracts\ProductCatalog\CurrencyServiceInterface $currencyService */ +/** @var CurrencyServiceInterface $currencyService */ $currency = $currencyService->getCurrencyByCode('EUR'); $query = new PriceQuery( - new \Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\Currency($currency) + new Currency($currency) ); ``` diff --git a/docs/search/criteria_reference/price_customergroup_criterion.md b/docs/search/criteria_reference/price_customergroup_criterion.md index 2c33e1bd647..8e72aca9cae 100644 --- a/docs/search/criteria_reference/price_customergroup_criterion.md +++ b/docs/search/criteria_reference/price_customergroup_criterion.md @@ -15,13 +15,14 @@ The `CustomerGroup` Search Criterion searches for prices based on the customer g ### PHP ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\ProductCatalog\CustomerGroupServiceInterface; use Ibexa\Contracts\ProductCatalog\Values\Price\PriceQuery; +use Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\CustomerGroup; -/** @var \Ibexa\Contracts\ProductCatalog\CustomerGroupServiceInterface $customerGroupService */ +/** @var CustomerGroupServiceInterface $customerGroupService */ $customerGroup = $customerGroupService->getCustomerGroup(123); $query = new PriceQuery( - new \Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\CustomerGroup($customerGroup) + new CustomerGroup($customerGroup) ); ``` diff --git a/docs/search/criteria_reference/price_isbaseprice_criterion.md b/docs/search/criteria_reference/price_isbaseprice_criterion.md index 56efe39038f..a2deae7aee8 100644 --- a/docs/search/criteria_reference/price_isbaseprice_criterion.md +++ b/docs/search/criteria_reference/price_isbaseprice_criterion.md @@ -19,10 +19,10 @@ The `IsBasePrice` Criterion isn't available in Solr or Elasticsearch engines. ### PHP ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\ProductCatalog\Values\Price\PriceQuery; +use Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\IsBasePrice; $query = new PriceQuery( - new \Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\IsBasePrice() + new IsBasePrice() ); ``` diff --git a/docs/search/criteria_reference/price_iscustomprice_criterion.md b/docs/search/criteria_reference/price_iscustomprice_criterion.md index 0aa2ec2afb7..325fda0c477 100644 --- a/docs/search/criteria_reference/price_iscustomprice_criterion.md +++ b/docs/search/criteria_reference/price_iscustomprice_criterion.md @@ -19,10 +19,10 @@ The `IsCustomPrice` Criterion isn't available in Solr or Elasticsearch engines. ### PHP ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\ProductCatalog\Values\Price\PriceQuery; +use Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\IsCustomPrice; $query = new PriceQuery( - new \Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\IsCustomPrice() + new IsCustomPrice() ); ``` diff --git a/docs/search/criteria_reference/price_logicaland_criterion.md b/docs/search/criteria_reference/price_logicaland_criterion.md index 7693f7a8e52..e531370f440 100644 --- a/docs/search/criteria_reference/price_logicaland_criterion.md +++ b/docs/search/criteria_reference/price_logicaland_criterion.md @@ -16,13 +16,17 @@ The `LogicalAnd` Search Criterion matches prices if all provided Criteria match. ### PHP ``` php +use Ibexa\Contracts\ProductCatalog\Values\CurrencyInterface; use Ibexa\Contracts\ProductCatalog\Values\Price\PriceQuery; +use Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\Currency; +use Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\IsCustomPrice; +use Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\LogicalAnd; -/** @var \Ibexa\Contracts\ProductCatalog\Values\CurrencyInterface $currencyUSD */ +/** @var CurrencyInterface $currencyUSD */ $query = new PriceQuery( - new \Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\LogicalAnd( - new \Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\Currency($currencyUSD), - new \Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\IsCustomPrice() + new LogicalAnd( + new Currency($currencyUSD), + new IsCustomPrice() ) ); ``` diff --git a/docs/search/criteria_reference/price_logicalor_criterion.md b/docs/search/criteria_reference/price_logicalor_criterion.md index 246a4e14ec8..ae70000db49 100644 --- a/docs/search/criteria_reference/price_logicalor_criterion.md +++ b/docs/search/criteria_reference/price_logicalor_criterion.md @@ -16,16 +16,19 @@ The `LogicalOr` Search Criterion matches prices if at least one of the provided ### PHP ``` php +use Ibexa\Contracts\ProductCatalog\Values\CurrencyInterface; use Ibexa\Contracts\ProductCatalog\Values\Price\PriceQuery; +use Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\Currency; +use Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\LogicalOr; /** - * @var \Ibexa\Contracts\ProductCatalog\Values\CurrencyInterface $currencyUSD - * @var \Ibexa\Contracts\ProductCatalog\Values\CurrencyInterface $currencyEUR + * @var CurrencyInterface $currencyUSD + * @var CurrencyInterface $currencyEUR */ $query = new PriceQuery( - new \Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\LogicalOr( - new \Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\Currency($currencyUSD), - new \Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\Currency($currencyEUR) + new LogicalOr( + new Currency($currencyUSD), + new Currency($currencyEUR) ) ); ``` diff --git a/docs/search/criteria_reference/price_product_criterion.md b/docs/search/criteria_reference/price_product_criterion.md index ff213b6a058..1d2f3846fca 100644 --- a/docs/search/criteria_reference/price_product_criterion.md +++ b/docs/search/criteria_reference/price_product_criterion.md @@ -15,10 +15,10 @@ The `Product` Search Criterion searches for prices based on product codes. ### PHP ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\ProductCatalog\Values\Price\PriceQuery; +use Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\Product; $query = new PriceQuery( - new \Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\Product('ergo_desk') + new Product('ergo_desk') ); ``` diff --git a/docs/search/criteria_reference/productavailability_criterion.md b/docs/search/criteria_reference/productavailability_criterion.md index 89b76bdaa77..1c7537d9054 100644 --- a/docs/search/criteria_reference/productavailability_criterion.md +++ b/docs/search/criteria_reference/productavailability_criterion.md @@ -22,11 +22,11 @@ For more information, see [Availability and computed availability](products.md#a ``` php use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ProductAvailability; $query = new ProductQuery( null, - new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ProductAvailability(true) + new ProductAvailability(true) ); ``` diff --git a/docs/search/criteria_reference/productcategory_criterion.md b/docs/search/criteria_reference/productcategory_criterion.md index 8ca37ebc9c1..571d4bdda3b 100644 --- a/docs/search/criteria_reference/productcategory_criterion.md +++ b/docs/search/criteria_reference/productcategory_criterion.md @@ -16,11 +16,11 @@ The `ProductCategory` Search Criterion searches for products by the category the ``` php use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ProductCategory; $query = new ProductQuery( null, - new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ProductCategory([2, 3]) + new ProductCategory([2, 3]) ); ``` diff --git a/docs/search/criteria_reference/productcode_criterion.md b/docs/search/criteria_reference/productcode_criterion.md index 39d7e1b1afd..934e2d67ea8 100644 --- a/docs/search/criteria_reference/productcode_criterion.md +++ b/docs/search/criteria_reference/productcode_criterion.md @@ -16,11 +16,11 @@ The `ProductCode` Search Criterion searches for products by their codes. ``` php use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ProductCode; $query = new ProductQuery( null, - new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ProductCode(['ergo_desk', 'alter_desk']) + new ProductCode(['ergo_desk', 'alter_desk']) ); ``` diff --git a/docs/search/criteria_reference/productname_criterion.md b/docs/search/criteria_reference/productname_criterion.md index 5a3d9a18cf3..8601d2b6995 100644 --- a/docs/search/criteria_reference/productname_criterion.md +++ b/docs/search/criteria_reference/productname_criterion.md @@ -16,11 +16,11 @@ The `ProductName` Search Criterion searches for products by their names. ``` php use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ProductName; $query = new ProductQuery( null, - new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ProductName('sofa*') + new ProductName('sofa*') ); ``` diff --git a/docs/search/criteria_reference/producttype_criterion.md b/docs/search/criteria_reference/producttype_criterion.md index c98fbcdc09e..81ca92ed62f 100644 --- a/docs/search/criteria_reference/producttype_criterion.md +++ b/docs/search/criteria_reference/producttype_criterion.md @@ -16,11 +16,11 @@ The `ProductType` Search Criterion searches for products by their codes. ``` php use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ProductType; $query = new ProductQuery( null, - new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ProductType(['dress']) + new ProductType(['dress']) ); ``` diff --git a/docs/search/criteria_reference/rangemeasurementattributemaximum_criterion.md b/docs/search/criteria_reference/rangemeasurementattributemaximum_criterion.md index 7a5a71edaea..c903d79f69f 100644 --- a/docs/search/criteria_reference/rangemeasurementattributemaximum_criterion.md +++ b/docs/search/criteria_reference/rangemeasurementattributemaximum_criterion.md @@ -16,15 +16,16 @@ The `RangeMeasurementAttributeMaximum` Search Criterion searches for products by ### PHP ``` php +use Ibexa\Contracts\Measurement\MeasurementServiceInterface; +use Ibexa\Contracts\Measurement\Product\Query\Criterion\RangeMeasurementAttributeMaximum; use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; -/** @var \Ibexa\Contracts\Measurement\MeasurementServiceInterface $measurementService */ +/** @var MeasurementServiceInterface $measurementService */ $value = $measurementService->buildSimpleValue('length', 150, 'centimeter'); $query = new ProductQuery( null, - new \Ibexa\Contracts\Measurement\Product\Query\Criterion\RangeMeasurementAttributeMaximum( + new RangeMeasurementAttributeMaximum( 'length', $value ) diff --git a/docs/search/criteria_reference/rangemeasurementattributeminimum_criterion.md b/docs/search/criteria_reference/rangemeasurementattributeminimum_criterion.md index 7f103eee099..cbe4a621a7c 100644 --- a/docs/search/criteria_reference/rangemeasurementattributeminimum_criterion.md +++ b/docs/search/criteria_reference/rangemeasurementattributeminimum_criterion.md @@ -16,15 +16,16 @@ The `RangeMeasurementAttributeMinimum` Search Criterion searches for products by ### PHP ``` php +use Ibexa\Contracts\Measurement\MeasurementServiceInterface; +use Ibexa\Contracts\Measurement\Product\Query\Criterion\RangeMeasurementAttributeMinimum; use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; -/** @var \Ibexa\Contracts\Measurement\MeasurementServiceInterface $measurementService */ +/** @var MeasurementServiceInterface $measurementService */ $value = $measurementService->buildSimpleValue('length', 100, 'centimeter'); $query = new ProductQuery( null, - new \Ibexa\Contracts\Measurement\Product\Query\Criterion\RangeMeasurementAttributeMinimum( + new RangeMeasurementAttributeMinimum( 'length', $value ) diff --git a/docs/search/criteria_reference/selectionattribute_criterion.md b/docs/search/criteria_reference/selectionattribute_criterion.md index cbaf0be3648..6a7f12d22b0 100644 --- a/docs/search/criteria_reference/selectionattribute_criterion.md +++ b/docs/search/criteria_reference/selectionattribute_criterion.md @@ -17,11 +17,11 @@ The `SelectionAttribute` Search Criterion searches for products by the value of ``` php use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\SelectionAttribute; $query = new ProductQuery( null, - new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\SelectionAttribute( + new SelectionAttribute( 'fabric_type', ['cotton'] ) diff --git a/docs/search/criteria_reference/shipment_createdat_criterion.md b/docs/search/criteria_reference/shipment_createdat_criterion.md index e0574ebb9ae..2b8d6d3db6f 100644 --- a/docs/search/criteria_reference/shipment_createdat_criterion.md +++ b/docs/search/criteria_reference/shipment_createdat_criterion.md @@ -17,10 +17,10 @@ The `CreatedAt` Search Criterion searches for shipments based on the date when t ### PHP ``` php -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; +use Ibexa\Contracts\Shipping\Shipment\Query\Criterion\CreatedAt; use Ibexa\Contracts\Shipping\Shipment\ShipmentQuery; -$criteria = new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\CreatedAt( +$criteria = new CreatedAt( new DateTime('2023-03-01 14:07:02'), 'GTE' ); diff --git a/docs/search/criteria_reference/shipment_currency_criterion.md b/docs/search/criteria_reference/shipment_currency_criterion.md index 3081565e852..b9c23e6fc2d 100644 --- a/docs/search/criteria_reference/shipment_currency_criterion.md +++ b/docs/search/criteria_reference/shipment_currency_criterion.md @@ -16,10 +16,10 @@ The `Currency` Search Criterion searches for shipments based on the currency cod ### PHP ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Shipping\Shipment\Query\Criterion\Currency; use Ibexa\Contracts\Shipping\Shipment\ShipmentQuery; $query = new ShipmentQuery( - new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\Currency(['USD', 'CZK']) + new Currency(['USD', 'CZK']) ); ``` diff --git a/docs/search/criteria_reference/shipment_id_criterion.md b/docs/search/criteria_reference/shipment_id_criterion.md index 36a7fb04794..b7b4e7a8293 100644 --- a/docs/search/criteria_reference/shipment_id_criterion.md +++ b/docs/search/criteria_reference/shipment_id_criterion.md @@ -16,10 +16,10 @@ The `Id` Search Criterion searches for shipments based on the shipment ID. ### PHP ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Shipping\Shipment\Query\Criterion\Id; use Ibexa\Contracts\Shipping\Shipment\ShipmentQuery; $query = new ShipmentQuery( - new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\Id(2) + new Id(2) ); ``` diff --git a/docs/search/criteria_reference/shipment_identifier_criterion.md b/docs/search/criteria_reference/shipment_identifier_criterion.md index db55e3c6587..dbba9113fb4 100644 --- a/docs/search/criteria_reference/shipment_identifier_criterion.md +++ b/docs/search/criteria_reference/shipment_identifier_criterion.md @@ -16,10 +16,10 @@ The `Identifier` Search Criterion searches for shipments based on the shipment i ### PHP ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Shipping\Shipment\Query\Criterion\Identifier; use Ibexa\Contracts\Shipping\Shipment\ShipmentQuery; $query = new ShipmentQuery( - new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\Identifier('f1t7z-3rb3rt') + new Identifier('f1t7z-3rb3rt') ); ``` diff --git a/docs/search/criteria_reference/shipment_logicaland_criterion.md b/docs/search/criteria_reference/shipment_logicaland_criterion.md index 387e4c3bcf6..bf428123087 100644 --- a/docs/search/criteria_reference/shipment_logicaland_criterion.md +++ b/docs/search/criteria_reference/shipment_logicaland_criterion.md @@ -16,13 +16,17 @@ The `LogicalAnd` Search Criterion matches shipments if all provided Criteria mat ### PHP ``` php +use Ibexa\Contracts\Shipping\Shipment\Query\Criterion\CreatedAt; +use Ibexa\Contracts\Shipping\Shipment\Query\Criterion\LogicalAnd; +use Ibexa\Contracts\Shipping\Shipment\Query\Criterion\ShippingMethod; use Ibexa\Contracts\Shipping\Shipment\ShipmentQuery; +use Ibexa\Contracts\Shipping\Value\ShippingMethod\ShippingMethodInterface; -/** @var \Ibexa\Contracts\Shipping\Value\ShippingMethod\ShippingMethodInterface $shippingMethod */ +/** @var ShippingMethodInterface $shippingMethod */ $query = new ShipmentQuery( - new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\LogicalAnd( - new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\CreatedAt(new DateTime('2023-03-01')), - new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\ShippingMethod($shippingMethod) + new LogicalAnd( + new CreatedAt(new DateTime('2023-03-01')), + new ShippingMethod($shippingMethod) ) ); ``` diff --git a/docs/search/criteria_reference/shipment_logicalor_criterion.md b/docs/search/criteria_reference/shipment_logicalor_criterion.md index 16a07037ff1..48494cb49da 100644 --- a/docs/search/criteria_reference/shipment_logicalor_criterion.md +++ b/docs/search/criteria_reference/shipment_logicalor_criterion.md @@ -16,13 +16,17 @@ The `LogicalOr` Search Criterion matches shipments if at least one of the provid ### PHP ``` php +use Ibexa\Contracts\Shipping\Shipment\Query\Criterion\CreatedAt; +use Ibexa\Contracts\Shipping\Shipment\Query\Criterion\LogicalOr; +use Ibexa\Contracts\Shipping\Shipment\Query\Criterion\ShippingMethod; use Ibexa\Contracts\Shipping\Shipment\ShipmentQuery; +use Ibexa\Contracts\Shipping\Value\ShippingMethod\ShippingMethodInterface; -/** @var \Ibexa\Contracts\Shipping\Value\ShippingMethod\ShippingMethodInterface $shippingMethod */ +/** @var ShippingMethodInterface $shippingMethod */ $query = new ShipmentQuery( - new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\LogicalOr( - new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\CreatedAt(new DateTime('2023-03-01')), - new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\ShippingMethod($shippingMethod) + new LogicalOr( + new CreatedAt(new DateTime('2023-03-01')), + new ShippingMethod($shippingMethod) ) ); ``` diff --git a/docs/search/criteria_reference/shipment_owner_criterion.md b/docs/search/criteria_reference/shipment_owner_criterion.md index d836ff406d5..b7762a78560 100644 --- a/docs/search/criteria_reference/shipment_owner_criterion.md +++ b/docs/search/criteria_reference/shipment_owner_criterion.md @@ -14,12 +14,13 @@ The `Owner` Criterion searches for shipments based on the user reference. ## Example ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Shipping\Shipment\Query\Criterion\Owner; use Ibexa\Contracts\Shipping\Shipment\ShipmentQuery; +use Ibexa\Core\Repository\Values\User\UserReference; $query = new ShipmentQuery( - new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\Owner( - new \Ibexa\Core\Repository\Values\User\UserReference(14) + new Owner( + new UserReference(14) ) ); ``` @@ -27,18 +28,19 @@ $query = new ShipmentQuery( `Owner` Criterion accepts also multiple values: ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\UserService; +use Ibexa\Contracts\Shipping\Shipment\Query\Criterion\Owner; use Ibexa\Contracts\Shipping\Shipment\ShipmentQuery; -/** @var \Ibexa\Contracts\Core\Repository\UserService $userService */ +/** @var UserService $userService */ $user1 = $userService->loadUser(12345); $user2 = $userService->loadUserByLogin('user'); $query = new ShipmentQuery( - new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\Owner( + new Owner( [ - $user1, - $user2, + $user1, + $user2, ] ) ); diff --git a/docs/search/criteria_reference/shipment_shipping_method_criterion.md b/docs/search/criteria_reference/shipment_shipping_method_criterion.md index 447b71602be..20d1c529991 100644 --- a/docs/search/criteria_reference/shipment_shipping_method_criterion.md +++ b/docs/search/criteria_reference/shipment_shipping_method_criterion.md @@ -16,11 +16,12 @@ The `ShippingMethod` Search Criterion searches for shipments based on a shipping ### PHP ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Shipping\Shipment\Query\Criterion\ShippingMethod; use Ibexa\Contracts\Shipping\Shipment\ShipmentQuery; +use Ibexa\Contracts\Shipping\Value\ShippingMethod\ShippingMethodInterface; -/** @var \Ibexa\Contracts\Shipping\Value\ShippingMethod\ShippingMethodInterface $shippingMethod */ +/** @var ShippingMethodInterface $shippingMethod */ $query = new ShipmentQuery( - new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\ShippingMethod($shippingMethod) + new ShippingMethod($shippingMethod) ); ``` diff --git a/docs/search/criteria_reference/shipment_status_criterion.md b/docs/search/criteria_reference/shipment_status_criterion.md index 05b0ec1a51c..559ec0db4a4 100644 --- a/docs/search/criteria_reference/shipment_status_criterion.md +++ b/docs/search/criteria_reference/shipment_status_criterion.md @@ -16,10 +16,10 @@ The `Status` Search Criterion searches for shipments based on shipment status. ### PHP ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Shipping\Shipment\Query\Criterion\Status; use Ibexa\Contracts\Shipping\Shipment\ShipmentQuery; $query = new ShipmentQuery( - new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\Status('pending') + new Status('pending') ); ``` diff --git a/docs/search/criteria_reference/shipment_updatedat_criterion.md b/docs/search/criteria_reference/shipment_updatedat_criterion.md index 72763c3c488..e98469986b8 100644 --- a/docs/search/criteria_reference/shipment_updatedat_criterion.md +++ b/docs/search/criteria_reference/shipment_updatedat_criterion.md @@ -17,10 +17,10 @@ The `UpdatedAt` Search Criterion searches for shipments based on the date when t ### PHP ``` php -use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Shipping\Shipment\Query\Criterion\UpdatedAt; use Ibexa\Contracts\Shipping\Shipment\ShipmentQuery; -$criteria = new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\UpdatedAt( +$criteria = new UpdatedAt( new DateTime('2023-03-01'), 'GTE' ); diff --git a/docs/search/criteria_reference/sibling_criterion.md b/docs/search/criteria_reference/sibling_criterion.md index e1504c979c0..4a5b032950d 100644 --- a/docs/search/criteria_reference/sibling_criterion.md +++ b/docs/search/criteria_reference/sibling_criterion.md @@ -26,11 +26,12 @@ $query->query = new Criterion\Sibling(59, 2); You can also use the named constructor `Criterion\Sibling::fromLocation` and provide it with the location object: ``` php +use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\Values\Content\Query; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; $query = new Query(); -/** @var \Ibexa\Contracts\Core\Repository\LocationService $locationService */ +/** @var LocationService $locationService */ $location = $locationService->loadLocation(59); $query->query = Criterion\Sibling::fromLocation($location); ``` diff --git a/docs/search/criteria_reference/simplemeasurementattribute_criterion.md b/docs/search/criteria_reference/simplemeasurementattribute_criterion.md index 7cd56eb2c38..1dfae495fcf 100644 --- a/docs/search/criteria_reference/simplemeasurementattribute_criterion.md +++ b/docs/search/criteria_reference/simplemeasurementattribute_criterion.md @@ -16,15 +16,16 @@ The `SimpleMeasurementAttribute` Search Criterion searches for products by the v ### PHP ``` php +use Ibexa\Contracts\Measurement\MeasurementServiceInterface; +use Ibexa\Contracts\Measurement\Product\Query\Criterion\SimpleMeasurementAttribute; use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; -use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion; -/** @var \Ibexa\Contracts\Measurement\MeasurementServiceInterface $measurementService */ +/** @var MeasurementServiceInterface $measurementService */ $value = $measurementService->buildSimpleValue('length', 120, 'centimeter'); $query = new ProductQuery( null, - new \Ibexa\Contracts\Measurement\Product\Query\Criterion\SimpleMeasurementAttribute( + new SimpleMeasurementAttribute( 'width', $value ) diff --git a/docs/search/sort_clause_reference/baseprice_sort_clause.md b/docs/search/sort_clause_reference/baseprice_sort_clause.md index b19edc4e071..adf7a02fb06 100644 --- a/docs/search/sort_clause_reference/baseprice_sort_clause.md +++ b/docs/search/sort_clause_reference/baseprice_sort_clause.md @@ -20,10 +20,11 @@ The `BasePrice` Sort Clause isn't available in the Legacy Search engine. ``` php use Ibexa\Contracts\ProductCatalog\Values\CurrencyInterface; use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\SortClause\BasePrice; /** @var CurrencyInterface $currency */ $sortClauses = [ - new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\SortClause\BasePrice( + new BasePrice( $currency, ProductQuery::SORT_ASC ), diff --git a/docs/search/sort_clause_reference/createdat_sort_clause.md b/docs/search/sort_clause_reference/createdat_sort_clause.md index f68a4944fa7..6ce2ef2c789 100644 --- a/docs/search/sort_clause_reference/createdat_sort_clause.md +++ b/docs/search/sort_clause_reference/createdat_sort_clause.md @@ -14,13 +14,14 @@ The `CreatedAt` Sort Clause sorts search results by the date and time of the cre ``` php use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\SortClause\CreatedAt; $productQuery = new ProductQuery( null, null, [ - new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\SortClause\CreatedAt( - \Ibexa\Contracts\ProductCatalog\Values\Product\Query\SortClause\CreatedAt::SORT_ASC + new CreatedAt( + CreatedAt::SORT_ASC ), ] ); diff --git a/docs/search/sort_clause_reference/customprice_sort_clause.md b/docs/search/sort_clause_reference/customprice_sort_clause.md index 3d8fdc15f02..9c13f232692 100644 --- a/docs/search/sort_clause_reference/customprice_sort_clause.md +++ b/docs/search/sort_clause_reference/customprice_sort_clause.md @@ -23,13 +23,14 @@ The `CustomPrice` Sort Clause isn't available in the Legacy Search engine. use Ibexa\Contracts\ProductCatalog\Values\CurrencyInterface; use Ibexa\Contracts\ProductCatalog\Values\CustomerGroupInterface; use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\SortClause\CustomPrice; /** * @var CurrencyInterface $currency * @var CustomerGroupInterface $customerGroup */ $sortClauses = [ - new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\SortClause\CustomPrice( + new CustomPrice( $currency, ProductQuery::SORT_ASC, $customerGroup diff --git a/docs/search/sort_clause_reference/order_created_sort_clause.md b/docs/search/sort_clause_reference/order_created_sort_clause.md index 20a3a1f8c29..cbea2e7f73f 100644 --- a/docs/search/sort_clause_reference/order_created_sort_clause.md +++ b/docs/search/sort_clause_reference/order_created_sort_clause.md @@ -15,14 +15,15 @@ The `Created` Sort Clause sorts search results by the date and time when the ord ``` php use Ibexa\Contracts\OrderManagement\Value\Order\OrderQuery; +use Ibexa\Contracts\OrderManagement\Value\Order\Query\SortClause\Created; $criteria = null; $orderQuery = new OrderQuery( $criteria, [ - new \Ibexa\Contracts\OrderManagement\Value\Order\Query\SortClause\Created( - \Ibexa\Contracts\OrderManagement\Value\Order\Query\SortClause\Created::SORT_ASC + new Created( + Created::SORT_ASC ), ] ); diff --git a/docs/search/sort_clause_reference/order_id_sort_clause.md b/docs/search/sort_clause_reference/order_id_sort_clause.md index 74db82f0b95..8a31696723d 100644 --- a/docs/search/sort_clause_reference/order_id_sort_clause.md +++ b/docs/search/sort_clause_reference/order_id_sort_clause.md @@ -15,14 +15,15 @@ The `Id` Sort Clause sorts search results by order Id. ``` php use Ibexa\Contracts\OrderManagement\Value\Order\OrderQuery; +use Ibexa\Contracts\OrderManagement\Value\Order\Query\SortClause\Id; $criteria = null; $orderQuery = new OrderQuery( $criteria, [ - new \Ibexa\Contracts\OrderManagement\Value\Order\Query\SortClause\Id( - \Ibexa\Contracts\OrderManagement\Value\Order\Query\SortClause\Id::SORT_ASC + new Id( + Id::SORT_ASC ), ] ); diff --git a/docs/search/sort_clause_reference/order_status_sort_clause.md b/docs/search/sort_clause_reference/order_status_sort_clause.md index 3173d9bf18d..10af68250c7 100644 --- a/docs/search/sort_clause_reference/order_status_sort_clause.md +++ b/docs/search/sort_clause_reference/order_status_sort_clause.md @@ -15,14 +15,15 @@ The `Status` Sort Clause sorts search results by order status. ``` php use Ibexa\Contracts\OrderManagement\Value\Order\OrderQuery; +use Ibexa\Contracts\OrderManagement\Value\Order\Query\SortClause\Status; $criteria = null; $orderQuery = new OrderQuery( $criteria, [ - new \Ibexa\Contracts\OrderManagement\Value\Order\Query\SortClause\Status( - \Ibexa\Contracts\OrderManagement\Value\Order\Query\SortClause\Status::SORT_ASC + new Status( + Status::SORT_ASC ), ] ); diff --git a/docs/search/sort_clause_reference/order_updated_sort_clause.md b/docs/search/sort_clause_reference/order_updated_sort_clause.md index 87a3a63d8c7..16e9457db97 100644 --- a/docs/search/sort_clause_reference/order_updated_sort_clause.md +++ b/docs/search/sort_clause_reference/order_updated_sort_clause.md @@ -15,14 +15,15 @@ The `Updated` Sort Clause sorts search results by the date and time when order s ``` php use Ibexa\Contracts\OrderManagement\Value\Order\OrderQuery; +use Ibexa\Contracts\OrderManagement\Value\Order\Query\SortClause\Updated; $criteria = null; $orderQuery = new OrderQuery( $criteria, [ - new \Ibexa\Contracts\OrderManagement\Value\Order\Query\SortClause\Updated( - \Ibexa\Contracts\OrderManagement\Value\Order\Query\SortClause\Updated::SORT_ASC + new Updated( + Updated::SORT_ASC ), ] ); diff --git a/docs/search/sort_clause_reference/payment_createdat_sort_clause.md b/docs/search/sort_clause_reference/payment_createdat_sort_clause.md index 5c9c6572bc4..2cbc3156a91 100644 --- a/docs/search/sort_clause_reference/payment_createdat_sort_clause.md +++ b/docs/search/sort_clause_reference/payment_createdat_sort_clause.md @@ -15,14 +15,15 @@ The `CreatedAt` Sort Clause sorts search results by the date and time when the p ``` php use Ibexa\Contracts\Payment\Payment\PaymentQuery; +use Ibexa\Contracts\Payment\Payment\Query\SortClause\CreatedAt; $criteria = null; $paymentQuery = new PaymentQuery( $criteria, [ - new \Ibexa\Contracts\Payment\Payment\Query\SortClause\CreatedAt( - \Ibexa\Contracts\Payment\Payment\Query\SortClause\CreatedAt::SORT_ASC + new CreatedAt( + CreatedAt::SORT_ASC ), ] ); diff --git a/docs/search/sort_clause_reference/payment_id_sort_clause.md b/docs/search/sort_clause_reference/payment_id_sort_clause.md index b1ae85c22fc..f33f6476502 100644 --- a/docs/search/sort_clause_reference/payment_id_sort_clause.md +++ b/docs/search/sort_clause_reference/payment_id_sort_clause.md @@ -15,14 +15,15 @@ The `Id` Sort Clause sorts search results by payment ID. ``` php use Ibexa\Contracts\Payment\Payment\PaymentQuery; +use Ibexa\Contracts\Payment\Payment\Query\SortClause\Id; $criteria = null; $paymentQuery = new PaymentQuery( $criteria, [ - new \Ibexa\Contracts\Payment\Payment\Query\SortClause\Id( - \Ibexa\Contracts\Payment\Payment\Query\SortClause\Id::SORT_ASC + new Id( + Id::SORT_ASC ), ] ); diff --git a/docs/search/sort_clause_reference/payment_identifier_sort_clause.md b/docs/search/sort_clause_reference/payment_identifier_sort_clause.md index 9eb188771b3..4172ab5b13f 100644 --- a/docs/search/sort_clause_reference/payment_identifier_sort_clause.md +++ b/docs/search/sort_clause_reference/payment_identifier_sort_clause.md @@ -15,14 +15,15 @@ The `Identifier` Sort Clause sorts search results by payment identifier. ``` php use Ibexa\Contracts\Payment\Payment\PaymentQuery; +use Ibexa\Contracts\Payment\Payment\Query\SortClause\Identifier; $criteria = null; $paymentQuery = new PaymentQuery( $criteria, [ - new \Ibexa\Contracts\Payment\Payment\Query\SortClause\Identifier( - \Ibexa\Contracts\Payment\Payment\Query\SortClause\Identifier::SORT_ASC + new Identifier( + Identifier::SORT_ASC ), ] ); diff --git a/docs/search/sort_clause_reference/payment_method_createdat_sort_clause.md b/docs/search/sort_clause_reference/payment_method_createdat_sort_clause.md index e9b386d399f..f5abea53e77 100644 --- a/docs/search/sort_clause_reference/payment_method_createdat_sort_clause.md +++ b/docs/search/sort_clause_reference/payment_method_createdat_sort_clause.md @@ -15,14 +15,15 @@ The `CreatedAt` Sort Clause sorts search results by the date and time when the p ``` php use Ibexa\Contracts\Payment\PaymentMethod\PaymentMethodQuery; +use Ibexa\Contracts\Payment\PaymentMethod\Query\SortClause\CreatedAt; $criteria = null; $paymentMethodQuery = new PaymentMethodQuery( $criteria, [ - new \Ibexa\Contracts\Payment\PaymentMethod\Query\SortClause\CreatedAt( - \Ibexa\Contracts\Payment\PaymentMethod\Query\SortClause\CreatedAt::SORT_ASC + new CreatedAt( + CreatedAt::SORT_ASC ), ] ); diff --git a/docs/search/sort_clause_reference/payment_method_enabled_sort_clause.md b/docs/search/sort_clause_reference/payment_method_enabled_sort_clause.md index 85e7f6e3e33..f1271554e20 100644 --- a/docs/search/sort_clause_reference/payment_method_enabled_sort_clause.md +++ b/docs/search/sort_clause_reference/payment_method_enabled_sort_clause.md @@ -15,14 +15,15 @@ The `Enabled` Sort Clause sorts search results by payment method status. ``` php use Ibexa\Contracts\Payment\PaymentMethod\PaymentMethodQuery; +use Ibexa\Contracts\Payment\PaymentMethod\Query\SortClause\Enabled; $criteria = null; $paymentMethodQuery = new PaymentMethodQuery( $criteria, [ - new \Ibexa\Contracts\Payment\PaymentMethod\Query\SortClause\Enabled( - \Ibexa\Contracts\Payment\PaymentMethod\Query\SortClause\Enabled::SORT_DESC + new Enabled( + Enabled::SORT_DESC ), ] ); diff --git a/docs/search/sort_clause_reference/payment_method_id_sort_clause.md b/docs/search/sort_clause_reference/payment_method_id_sort_clause.md index 5173b48c3e4..ab151080f99 100644 --- a/docs/search/sort_clause_reference/payment_method_id_sort_clause.md +++ b/docs/search/sort_clause_reference/payment_method_id_sort_clause.md @@ -15,14 +15,15 @@ The `Id` Sort Clause sorts search results by payment method ID. ``` php use Ibexa\Contracts\Payment\PaymentMethod\PaymentMethodQuery; +use Ibexa\Contracts\Payment\PaymentMethod\Query\SortClause\Id; $criteria = null; $paymentMethodQuery = new PaymentMethodQuery( $criteria, [ - new \Ibexa\Contracts\Payment\PaymentMethod\Query\SortClause\Id( - \Ibexa\Contracts\Payment\PaymentMethod\Query\SortClause\Id::SORT_ASC + new Id( + Id::SORT_ASC ), ] ); diff --git a/docs/search/sort_clause_reference/payment_method_identifier_sort_clause.md b/docs/search/sort_clause_reference/payment_method_identifier_sort_clause.md index 8a70fd9bd2e..47ef3630059 100644 --- a/docs/search/sort_clause_reference/payment_method_identifier_sort_clause.md +++ b/docs/search/sort_clause_reference/payment_method_identifier_sort_clause.md @@ -15,14 +15,15 @@ The `Identifier` Sort Clause sorts search results by payment method identifier. ``` php use Ibexa\Contracts\Payment\PaymentMethod\PaymentMethodQuery; +use Ibexa\Contracts\Payment\PaymentMethod\Query\SortClause\Identifier; $criteria = null; $paymentMethodQuery = new PaymentMethodQuery( $criteria, [ - new \Ibexa\Contracts\Payment\PaymentMethod\Query\SortClause\Identifier( - \Ibexa\Contracts\Payment\PaymentMethod\Query\SortClause\Identifier::SORT_ASC + new Identifier( + Identifier::SORT_ASC ), ] ); diff --git a/docs/search/sort_clause_reference/payment_method_updatedat_sort_clause.md b/docs/search/sort_clause_reference/payment_method_updatedat_sort_clause.md index da117cf6c32..ebbbd3461e0 100644 --- a/docs/search/sort_clause_reference/payment_method_updatedat_sort_clause.md +++ b/docs/search/sort_clause_reference/payment_method_updatedat_sort_clause.md @@ -15,14 +15,15 @@ The `UpdatedAt` Sort Clause sorts search results by the date and time when payme ``` php use Ibexa\Contracts\Payment\PaymentMethod\PaymentMethodQuery; +use Ibexa\Contracts\Payment\PaymentMethod\Query\SortClause\UpdatedAt; $criteria = null; $paymentMethodQuery = new PaymentMethodQuery( $criteria, [ - new \Ibexa\Contracts\Payment\PaymentMethod\Query\SortClause\UpdatedAt( - \Ibexa\Contracts\Payment\PaymentMethod\Query\SortClause\UpdatedAt::SORT_DESC + new UpdatedAt( + UpdatedAt::SORT_DESC ), ] ); diff --git a/docs/search/sort_clause_reference/payment_status_sort_clause.md b/docs/search/sort_clause_reference/payment_status_sort_clause.md index d7f805f5241..957f6d024d0 100644 --- a/docs/search/sort_clause_reference/payment_status_sort_clause.md +++ b/docs/search/sort_clause_reference/payment_status_sort_clause.md @@ -15,14 +15,15 @@ The `Status` Sort Clause sorts search results by payment status. ``` php use Ibexa\Contracts\Payment\Payment\PaymentQuery; +use Ibexa\Contracts\Payment\Payment\Query\SortClause\Status; $criteria = null; $paymentQuery = new PaymentQuery( $criteria, [ - new \Ibexa\Contracts\Payment\Payment\Query\SortClause\Status( - \Ibexa\Contracts\Payment\Payment\Query\SortClause\Status::SORT_ASC + new Status( + Status::SORT_ASC ), ] ); diff --git a/docs/search/sort_clause_reference/payment_updatedat_sort_clause.md b/docs/search/sort_clause_reference/payment_updatedat_sort_clause.md index 344505ba417..e4fce6ea747 100644 --- a/docs/search/sort_clause_reference/payment_updatedat_sort_clause.md +++ b/docs/search/sort_clause_reference/payment_updatedat_sort_clause.md @@ -15,14 +15,15 @@ The `UpdatedAt` Sort Clause sorts search results by the date and time when payme ``` php use Ibexa\Contracts\Payment\Payment\PaymentQuery; +use Ibexa\Contracts\Payment\Payment\Query\SortClause\UpdatedAt; $criteria = null; $paymentQuery = new PaymentQuery( $criteria, [ - new \Ibexa\Contracts\Payment\Payment\Query\SortClause\UpdatedAt( - \Ibexa\Contracts\Payment\Payment\Query\SortClause\UpdatedAt::SORT_ASC + new UpdatedAt( + UpdatedAt::SORT_ASC ), ] ); diff --git a/docs/search/sort_clause_reference/productavailability_sort_clause.md b/docs/search/sort_clause_reference/productavailability_sort_clause.md index 9ef70c1406d..5decc32b9c8 100644 --- a/docs/search/sort_clause_reference/productavailability_sort_clause.md +++ b/docs/search/sort_clause_reference/productavailability_sort_clause.md @@ -14,12 +14,13 @@ The `ProductAvailability` Sort Clause sorts search results by whether they have ``` php use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\SortClause\ProductAvailability; $query = new ProductQuery( null, null, [ - new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\SortClause\ProductAvailability(), + new ProductAvailability(), ] ); ``` diff --git a/docs/search/sort_clause_reference/productcode_sort_clause.md b/docs/search/sort_clause_reference/productcode_sort_clause.md index 8b205822345..4a6dd5af0cf 100644 --- a/docs/search/sort_clause_reference/productcode_sort_clause.md +++ b/docs/search/sort_clause_reference/productcode_sort_clause.md @@ -14,12 +14,13 @@ The `ProductCode` Sort Clause sorts search results by the product code. ``` php use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\SortClause\ProductCode; $query = new ProductQuery( null, null, [ - new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\SortClause\ProductCode(), + new ProductCode(), ] ); ``` diff --git a/docs/search/sort_clause_reference/productname_sort_clause.md b/docs/search/sort_clause_reference/productname_sort_clause.md index a7f8b4c3cdc..20faab6a416 100644 --- a/docs/search/sort_clause_reference/productname_sort_clause.md +++ b/docs/search/sort_clause_reference/productname_sort_clause.md @@ -14,12 +14,13 @@ The `ProductName` Sort Clause sorts search results by the Product code. ``` php use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery; +use Ibexa\Contracts\ProductCatalog\Values\Product\Query\SortClause\ProductName; $query = new ProductQuery( null, null, [ - new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\SortClause\ProductName(), + new ProductName(), ] ); ``` diff --git a/docs/search/sort_clause_reference/shipment_createdat_sort_clause.md b/docs/search/sort_clause_reference/shipment_createdat_sort_clause.md index b8526a0aa28..10391911a71 100644 --- a/docs/search/sort_clause_reference/shipment_createdat_sort_clause.md +++ b/docs/search/sort_clause_reference/shipment_createdat_sort_clause.md @@ -14,14 +14,16 @@ The `CreatedAt` Sort Clause sorts search results by the date and time when the s ## Example ``` php +use Ibexa\Contracts\Shipping\Shipment\Query\CriterionInterface; +use Ibexa\Contracts\Shipping\Shipment\Query\SortClause\CreatedAt; use Ibexa\Contracts\Shipping\Shipment\ShipmentQuery; -/** @var \Ibexa\Contracts\Shipping\Shipment\Query\CriterionInterface $criteria */ +/** @var CriterionInterface $criteria */ $shipmentQuery = new ShipmentQuery( $criteria, [ - new \Ibexa\Contracts\Shipping\Shipment\Query\SortClause\CreatedAt( - \Ibexa\Contracts\Shipping\Shipment\Query\SortClause\CreatedAt::SORT_ASC + new CreatedAt( + CreatedAt::SORT_ASC ), ] ); diff --git a/docs/search/sort_clause_reference/shipment_id_sort_clause.md b/docs/search/sort_clause_reference/shipment_id_sort_clause.md index 55f63a65609..7f658407522 100644 --- a/docs/search/sort_clause_reference/shipment_id_sort_clause.md +++ b/docs/search/sort_clause_reference/shipment_id_sort_clause.md @@ -14,14 +14,16 @@ The `Id` Sort Clause sorts search results by shipment Id. ## Example ``` php +use Ibexa\Contracts\Shipping\Shipment\Query\CriterionInterface; +use Ibexa\Contracts\Shipping\Shipment\Query\SortClause\Id; use Ibexa\Contracts\Shipping\Shipment\ShipmentQuery; -/** @var \Ibexa\Contracts\Shipping\Shipment\Query\CriterionInterface $criteria */ +/** @var CriterionInterface $criteria */ $shipmentQuery = new ShipmentQuery( $criteria, [ - new \Ibexa\Contracts\Shipping\Shipment\Query\SortClause\Id( - \Ibexa\Contracts\Shipping\Shipment\Query\SortClause\Id::SORT_ASC + new Id( + Id::SORT_ASC ), ] ); diff --git a/docs/search/sort_clause_reference/shipment_identifier_sort_clause.md b/docs/search/sort_clause_reference/shipment_identifier_sort_clause.md index 18a93a034ea..f85d05d35b1 100644 --- a/docs/search/sort_clause_reference/shipment_identifier_sort_clause.md +++ b/docs/search/sort_clause_reference/shipment_identifier_sort_clause.md @@ -14,14 +14,16 @@ The `Identifier` Sort Clause sorts search results by shipment identifier. ## Example ``` php +use Ibexa\Contracts\Shipping\Shipment\Query\CriterionInterface; +use Ibexa\Contracts\Shipping\Shipment\Query\SortClause\Identifier; use Ibexa\Contracts\Shipping\Shipment\ShipmentQuery; -/** @var \Ibexa\Contracts\Shipping\Shipment\Query\CriterionInterface $criteria */ +/** @var CriterionInterface $criteria */ $shipmentQuery = new ShipmentQuery( $criteria, [ - new \Ibexa\Contracts\Shipping\Shipment\Query\SortClause\Identifier( - \Ibexa\Contracts\Shipping\Shipment\Query\SortClause\Identifier::SORT_ASC + new Identifier( + Identifier::SORT_ASC ), ] ); diff --git a/docs/search/sort_clause_reference/shipment_status_sort_clause.md b/docs/search/sort_clause_reference/shipment_status_sort_clause.md index f4a48e908ae..e6643ee292a 100644 --- a/docs/search/sort_clause_reference/shipment_status_sort_clause.md +++ b/docs/search/sort_clause_reference/shipment_status_sort_clause.md @@ -14,14 +14,16 @@ The `Status` Sort Clause sorts search results by shipment status. ## Example ``` php +use Ibexa\Contracts\Shipping\Shipment\Query\CriterionInterface; +use Ibexa\Contracts\Shipping\Shipment\Query\SortClause\Status; use Ibexa\Contracts\Shipping\Shipment\ShipmentQuery; -/** @var \Ibexa\Contracts\Shipping\Shipment\Query\CriterionInterface $criteria */ +/** @var CriterionInterface $criteria */ $shipmentQuery = new ShipmentQuery( $criteria, [ - new \Ibexa\Contracts\Shipping\Shipment\Query\SortClause\Status( - \Ibexa\Contracts\Shipping\Shipment\Query\SortClause\Status::SORT_ASC + new Status( + Status::SORT_ASC ), ] ); diff --git a/docs/search/sort_clause_reference/shipment_updatedat_sort_clause.md b/docs/search/sort_clause_reference/shipment_updatedat_sort_clause.md index 412a4521135..26cd6a0fc1b 100644 --- a/docs/search/sort_clause_reference/shipment_updatedat_sort_clause.md +++ b/docs/search/sort_clause_reference/shipment_updatedat_sort_clause.md @@ -14,14 +14,16 @@ The `UpdatedAt` Sort Clause sorts search results by the date and time when shipm ## Example ``` php +use Ibexa\Contracts\Shipping\Shipment\Query\CriterionInterface; +use Ibexa\Contracts\Shipping\Shipment\Query\SortClause\UpdatedAt; use Ibexa\Contracts\Shipping\Shipment\ShipmentQuery; -/** @var \Ibexa\Contracts\Shipping\Shipment\Query\CriterionInterface $criteria */ +/** @var CriterionInterface $criteria */ $shipmentQuery = new ShipmentQuery( $criteria, [ - new \Ibexa\Contracts\Shipping\Shipment\Query\SortClause\UpdatedAt( - \Ibexa\Contracts\Shipping\Shipment\Query\SortClause\UpdatedAt::SORT_ASC + new UpdatedAt( + UpdatedAt::SORT_ASC ), ] ); diff --git a/docs/templating/templates/template_configuration.md b/docs/templating/templates/template_configuration.md index bd4f4107542..1525978c947 100644 --- a/docs/templating/templates/template_configuration.md +++ b/docs/templating/templates/template_configuration.md @@ -95,7 +95,7 @@ In the example above, content which is either an article or a blog post is match When you use no matcher in a rule, this rule always match. Several values are available to declare no matcher: -``` yaml +``` yaml {skip-validation} match: ~ match: true match: [] diff --git a/docs/templating/twig_function_reference/recommendations_twig_functions.md b/docs/templating/twig_function_reference/recommendations_twig_functions.md index b2792122bad..1fd1e3fe497 100644 --- a/docs/templating/twig_function_reference/recommendations_twig_functions.md +++ b/docs/templating/twig_function_reference/recommendations_twig_functions.md @@ -118,8 +118,7 @@ final readonly class MyCrmWebsiteUserIdProvider implements WebsiteIdContextProvi public function __construct( private ConfigResolverInterface $configResolver, private PermissionResolver $permissionResolver, - ) { - } + ) {} public function getWebsiteId(): ?string { diff --git a/docs/templating/urls_and_routes/custom_breadcrumbs.md b/docs/templating/urls_and_routes/custom_breadcrumbs.md index 0c5254bc611..765a8443d6f 100644 --- a/docs/templating/urls_and_routes/custom_breadcrumbs.md +++ b/docs/templating/urls_and_routes/custom_breadcrumbs.md @@ -50,7 +50,7 @@ custom_blog_index: use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; - /** @var \Symfony\Component\HttpFoundation\Request $request */ + /** @var Request $request */ if ($request->getMethod() != Request::METHOD_POST) { throw new NotFoundHttpException(); } diff --git a/docs/tutorials/beginner_tutorial/5_display_a_list_of_content_items.md b/docs/tutorials/beginner_tutorial/5_display_a_list_of_content_items.md index 4f994a85c9f..40c4ee08eb5 100644 --- a/docs/tutorials/beginner_tutorial/5_display_a_list_of_content_items.md +++ b/docs/tutorials/beginner_tutorial/5_display_a_list_of_content_items.md @@ -74,7 +74,7 @@ class RideQueryType implements QueryType } /** @param array $parameters */ - public function getQuery(array $parameters = []): \Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery + public function getQuery(array $parameters = []): LocationQuery { return new LocationQuery([ 'filter' => new Criterion\LogicalAnd( @@ -86,6 +86,7 @@ class RideQueryType implements QueryType ]); } + /** @return array */ public function getSupportedParameters(): array { return []; diff --git a/docs/tutorials/beginner_tutorial/7_embed_content.md b/docs/tutorials/beginner_tutorial/7_embed_content.md index c9404e183b5..5c968835826 100644 --- a/docs/tutorials/beginner_tutorial/7_embed_content.md +++ b/docs/tutorials/beginner_tutorial/7_embed_content.md @@ -130,17 +130,17 @@ namespace App\Controller; use Ibexa\Bundle\Core\Controller; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Core\FieldType\RelationList\Value; use Ibexa\Core\MVC\Symfony\View\ContentView; class RideController extends Controller { - public function __construct(private readonly ContentService $contentService) - { - } + public function __construct(private readonly ContentService $contentService) {} public function viewRideWithLandmarksAction(ContentView $view): ContentView { $currentContent = $view->getContent(); + /** @var Value $landmarksListId */ $landmarksListId = $currentContent->getFieldValue('landmarks'); $landmarksList = []; diff --git a/docs/update_and_migration/from_4.6/update_from_4.6.md b/docs/update_and_migration/from_4.6/update_from_4.6.md index 2fd179a1fc8..7b774551a57 100644 --- a/docs/update_and_migration/from_4.6/update_from_4.6.md +++ b/docs/update_and_migration/from_4.6/update_from_4.6.md @@ -165,7 +165,7 @@ merge with your custom settings if needed, and commit them to Git. If the new bundle `ibexa/core-search` has not been added by the recipes, enable it by adding the following line in `config/bundles.php`: -``` php +``` php {skip-validation} return [ // ... Ibexa\Bundle\CoreSearch\IbexaCoreSearchBundle::class => ['all' => true], @@ -496,7 +496,7 @@ Update your configuration in `config/packages/ibexa_elasticsearch.yaml` as descr The `connection_pool` and `connection_selector` settings are ignored when using Elasticsearch 8. Replace them with appropriate `node_pool_selector` and `node_pool_resurrect` settings: -``` yaml +``` yaml {skip-validation} # Elasticsearch 7 configuration ibexa_elasticsearch: connections: @@ -520,7 +520,7 @@ For more information, see [Connection pool and node pool settings](https://doc.i The `trace` debugging option is no longer available in Elasticsearch 8: -``` yaml +``` yaml {skip-validation} # Elasticsearch 7 configuration ibexa_elasticsearch: connections: diff --git a/docs/update_and_migration/from_4.6/update_to_5.0.md b/docs/update_and_migration/from_4.6/update_to_5.0.md index 4e5502181f1..ef5141495f6 100644 --- a/docs/update_and_migration/from_4.6/update_to_5.0.md +++ b/docs/update_and_migration/from_4.6/update_to_5.0.md @@ -65,12 +65,12 @@ use Rector\Config\RectorConfig; return RectorConfig::configure() ->withPaths( [ - __DIR__ . '/src', + __DIR__ . '/src', ] ) ->withSets( [ - IbexaSetList::IBEXA_46->value, + IbexaSetList::IBEXA_46->value, ] ) ->withPhpSets(php83: true) diff --git a/docs/update_and_migration/from_5.0/update_from_5.0.md b/docs/update_and_migration/from_5.0/update_from_5.0.md index 027a850a738..3377690bd64 100644 --- a/docs/update_and_migration/from_5.0/update_from_5.0.md +++ b/docs/update_and_migration/from_5.0/update_from_5.0.md @@ -210,7 +210,7 @@ Update your configuration in `config/packages/ibexa_elasticsearch.yaml`. The deprecated `connection_pool` and `connection_selector` settings are now ignored and don't have any effect. Replace them with appropriate `node_pool_selector` and `node_pool_resurrect` settings: -``` yaml +``` yaml {skip-validation} # Old configuration (Elasticsearch 7 - deprecated) ibexa_elasticsearch: connections: @@ -234,7 +234,7 @@ For more information, see [Node pool settings](https://doc.ibexa.co/en/5.0/searc The `trace` debugging option is no longer available. -``` yaml +``` yaml {skip-validation} # Old configuration (Elasticsearch 7) ibexa_elasticsearch: connections: diff --git a/docs/users/oauth_server.md b/docs/users/oauth_server.md index d5f28f9d382..77f9a805f7d 100644 --- a/docs/users/oauth_server.md +++ b/docs/users/oauth_server.md @@ -20,13 +20,13 @@ composer require ibexa/oauth2-server --with-all-dependencies Then, in `config/bundles.php`, at the end of an array with a list of bundles, add the following two lines: -``` php +``` php {skip-validation} ['all' => true], - League\Bundle\OAuth2ServerBundle\LeagueOAuth2ServerBundle::class => ['all' => true], + IbexaOAuth2ServerBundle::class => ['all' => true], + LeagueOAuth2ServerBundle::class => ['all' => true], ]; ``` diff --git a/docs/users/user_authentication.md b/docs/users/user_authentication.md index 60039c3c00e..dde79f6e88b 100644 --- a/docs/users/user_authentication.md +++ b/docs/users/user_authentication.md @@ -53,8 +53,11 @@ security: # You will then be able to login with username "user" and password "userpass" user: { password: userpass, roles: [ 'ROLE_USER' ] } # The "in memory" provider requires an encoder for Symfony\Component\Security\Core\User\User - encoders: + password_hashers: Symfony\Component\Security\Core\User\User: plaintext + firewalls: + dev: + # … ``` ### Implement the listener diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index e5d912b591e..1a85a01c890 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -4,7 +4,7 @@ parameters: message: '#^Offset ''acme'' does not exist on array\{alias\: string, storage\: array\{engine\: string, connection\: string, config\?\: array\\}, search\: array\{engine\: string, connection\: string\}, fields_groups\: array\{default\: string, list\: array\\}, options\: array\\}\.$#' identifier: offsetAccess.notFound count: 1 - path: code_samples/_inline_php/administration/configuration/repository_configuration/ab545148cd13f7537467f6c43859d757ba15120b5df7d9933e6236336f1bf5e1.php + path: code_samples/_inline_php/administration/configuration/repository_configuration/408f0c553f7ef059d526b404da848746c08ba715b76f9cfeb3135a7680dcf558.php - message: '#^Instantiated class MyValue not found\.$#' @@ -24,17 +24,11 @@ parameters: count: 1 path: code_samples/_inline_php/commerce/transactional_emails/extend_transactional_emails/9512b966ae24a637ff0bba4d63a51f6418567d4c1245ea3d61272890838582a4.php - - - message: '#^Expression "\[\[''id'' \=\> 1, ''name'' \=\> ''Boba Fett'', ''email'' \=\> ''boba\.fett@example\.com''\], \[''id'' \=\> 2, ''name'' \=\> ''Darth Vader'', ''email'' \=\> ''darth\.vader@example\.com''\]\]" on a separate line does not do anything\.$#' - identifier: expr.resultUnused - count: 1 - path: code_samples/_inline_php/content_management/field_types/field_type_reference/authorfield/41087640467e69b96880fd3bcacebfab85a1983d922fd05e6f2aeffdadb77897.php - - message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Content\:\:\$fields is not writable\.$#' identifier: assign.propertyReadOnly count: 1 - path: code_samples/_inline_php/content_management/field_types/field_type_reference/countryfield/3cd88088ebfaab6dc8aab79fd8d9e380586a05e9a250f208935020a274d6a77f.php + path: code_samples/_inline_php/content_management/field_types/field_type_reference/countryfield/bacc5c1b898e5a27a6a344cf7175ed5500c6bc700dd298a67ff63d722df9a38b.php - message: '#^Expression "\[''JP'' \=\> \[''Name'' \=\> ''Japan'', ''Alpha2'' \=\> ''JP'', ''Alpha3'' \=\> ''JPN'', ''IDC'' \=\> 81\]\]" on a separate line does not do anything\.$#' @@ -48,12 +42,6 @@ parameters: count: 1 path: code_samples/_inline_php/content_management/field_types/field_type_reference/isbnfield/678db783359b1c65999e5fed725950d32aaab547ab82f6bda18afcafa3392e8b.php - - - message: '#^Expression "\[''StringLengthValidator'' \=\> \[''maxStringLength'' \=\> 60, ''minStringLength'' \=\> 1\]\]" on a separate line does not do anything\.$#' - identifier: expr.resultUnused - count: 1 - path: code_samples/_inline_php/content_management/field_types/field_type_reference/textlinefield/abeeb0a02156f9dd413b5f54292d97783f49043458623888d904267ffa60acde.php - - message: '#^Expression "\[''stringLength'' \=\> \[''minStringLength'' \=\> \[''type'' \=\> ''int'', ''default'' \=\> 0\], ''maxStringLength'' \=\> \[''type'' \=\> ''int'', ''default'' \=\> \\null\]\]\]" on a separate line does not do anything\.$#' identifier: expr.resultUnused @@ -72,42 +60,6 @@ parameters: count: 1 path: code_samples/_inline_php/infrastructure_and_maintenance/cache/persistence_cache/c27a2fe1c12bba3e9271acc67ae3a2e2d4596bf58f4d9b791aec4e564ae88259.php - - - message: '#^Property App\\MyService\:\:\$contentService is never read, only written\.$#' - identifier: property.onlyWritten - count: 1 - path: code_samples/_inline_php/multisite/siteaccess/injecting_siteaccess/ab06aaada31a753d4da4ac9c30d6588608ca390d67846d676de254308b9981e3.php - - - - message: '#^Property App\\MyService\:\:\$siteAccessService is never read, only written\.$#' - identifier: property.onlyWritten - count: 1 - path: code_samples/_inline_php/multisite/siteaccess/injecting_siteaccess/ab06aaada31a753d4da4ac9c30d6588608ca390d67846d676de254308b9981e3.php - - - - message: '#^Variable \$this might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: code_samples/_inline_php/search/criteria_reference/ancestor_criterion/4a5427b7ae43106059e9d543fcbf5e7b66602c10052ab6ff67750e041857c6ad.php - - - - message: '#^Variable \$this might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: code_samples/_inline_php/search/criteria_reference/parentlocationid_criterion/c85766351eda977c61c12ab7d00c11cba956bde544bbdff4cad24e0bbf7717d9.php - - - - message: '#^Method App\\QueryType\\RideQueryType\:\:getSupportedParameters\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: code_samples/_inline_php/tutorials/beginner_tutorial/5_display_a_list_of_content_items/ccb9d8424978af9df4ec24d732f91c6f7cab90b6879eecd0ea97fef21b833b3b.php - - - - message: '#^Cannot access property \$destinationContentIds on Ibexa\\Contracts\\Core\\FieldType\\Value\|null\.$#' - identifier: property.nonObject - count: 1 - path: code_samples/_inline_php/tutorials/beginner_tutorial/7_embed_content/d8ad5ae7972b67d11cb172c321b891e268d5a346d166f73c5570d61b9b372a7d.php - - message: '#^Class App\\Form\\Type\\TextToTextOptionsType extends generic class Symfony\\Component\\Form\\AbstractType but does not specify its types\: TData$#' identifier: missingType.generics @@ -696,6 +648,30 @@ parameters: count: 1 path: code_samples/page/page_listener/src/Block/Listener/MyBlockListener.php + - + message: '#^Access to an undefined static property App\\Command\\TestPriorityRangeAggregationCommand\:\:\$defaultName\.$#' + identifier: staticProperty.notFound + count: 1 + path: code_samples/search/custom/TestPriorityRangeAggregationCommand.php + + - + message: '#^PHPDoc tag @var for variable \$aggregationResult contains generic class Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Search\\AggregationResult\\RangeAggregationResult but does not specify its types\: TValue$#' + identifier: missingType.generics + count: 2 + path: code_samples/search/custom/TestPriorityRangeAggregationCommand.php + + - + message: '#^PHPDoc tag @var for variable \$entry contains generic class Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Search\\AggregationResult\\RangeAggregationResultEntry but does not specify its types\: TValue$#' + identifier: missingType.generics + count: 2 + path: code_samples/search/custom/TestPriorityRangeAggregationCommand.php + + - + message: '#^PHPDoc tag @var for variable \$key contains generic class Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Query\\Aggregation\\Range but does not specify its types\: TValue$#' + identifier: missingType.generics + count: 2 + path: code_samples/search/custom/TestPriorityRangeAggregationCommand.php + - message: '#^Parameter \#1 \$criteria of class Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Query\\Criterion\\LogicalAnd constructor expects array\, array\ given\.$#' identifier: argument.type diff --git a/tests/ConfigurationProvider.php b/tests/ConfigurationProvider.php index 99a509b25f7..2c94d1f8da7 100644 --- a/tests/ConfigurationProvider.php +++ b/tests/ConfigurationProvider.php @@ -72,8 +72,10 @@ public function resolveParameters(array $config): array return $result; } - private function resolveValue(ParameterBagInterface $bag, mixed $value): mixed - { + private function resolveValue( + ParameterBagInterface $bag, + mixed $value + ): mixed { if (is_array($value)) { return array_map(fn (mixed $v): mixed => $this->resolveValue($bag, $v), $value); } diff --git a/tests/InlineSamples/InlinePhpPipelineTest.php b/tests/InlineSamples/InlinePhpPipelineTest.php index e02405ca658..cca78548b7e 100644 --- a/tests/InlineSamples/InlinePhpPipelineTest.php +++ b/tests/InlineSamples/InlinePhpPipelineTest.php @@ -52,8 +52,10 @@ protected function setUp(): void * * @return string|null Updated Markdown, or null when the pipeline produced no change. */ - private function pipeline(string $md, array $fixerReplacements = []): ?string - { + private function pipeline( + string $md, + array $fixerReplacements = [] + ): ?string { $blocks = iterator_to_array($this->extractor->extract($md)); self::assertNotEmpty($blocks, 'No PHP blocks found in Markdown'); @@ -74,8 +76,10 @@ private function pipeline(string $md, array $fixerReplacements = []): ?string * * @param array $fixerReplacements */ - private function pipelineAll(string $md, array $fixerReplacements = []): string - { + private function pipelineAll( + string $md, + array $fixerReplacements = [] + ): string { $blocks = iterator_to_array($this->extractor->extract($md)); self::assertNotEmpty($blocks); @@ -211,8 +215,10 @@ public function testMultiLineChangePreservesStructure(): void * @param array $fixerReplacements */ #[DataProvider('provideIdempotencyCases')] - public function testPipelineIsIdempotent(string $md, array $fixerReplacements): void - { + public function testPipelineIsIdempotent( + string $md, + array $fixerReplacements + ): void { // First pass (may or may not change the Markdown). $updated = $this->pipeline($md, $fixerReplacements) ?? $md; diff --git a/tests/InlineSamples/InlinePhpSyncer.php b/tests/InlineSamples/InlinePhpSyncer.php index aaa484409f6..c2457954fbb 100644 --- a/tests/InlineSamples/InlinePhpSyncer.php +++ b/tests/InlineSamples/InlinePhpSyncer.php @@ -56,8 +56,10 @@ public function parseSourceLocation(string $phpFileContent): ?array * @return string|null Updated Markdown content, or null if nothing changed or the source * location cannot be mapped. */ - public function sync(string $phpFileContent, string $mdContent): ?string - { + public function sync( + string $phpFileContent, + string $mdContent + ): ?string { $location = $this->parseSourceLocation($phpFileContent); if ($location === null) { return null; @@ -117,8 +119,11 @@ private function extractBody(string $phpFileContent): string * without the writer->build($sourcePath, $bodyLine, $mdBody); } diff --git a/tests/InlineSamples/InlinePhpWriter.php b/tests/InlineSamples/InlinePhpWriter.php index af3cf40c878..abde24a286a 100644 --- a/tests/InlineSamples/InlinePhpWriter.php +++ b/tests/InlineSamples/InlinePhpWriter.php @@ -45,8 +45,11 @@ final class InlinePhpWriter * @param string $body Snippet body as returned by MarkdownExtractor::extract(): * admonition indentation already stripped, may start with writer->build($sourcePath, $line, $body)); } diff --git a/tests/InlineSamples/MarkdownExtractor.php b/tests/InlineSamples/MarkdownExtractor.php index 4f0bcdfbc99..50f908b0639 100644 --- a/tests/InlineSamples/MarkdownExtractor.php +++ b/tests/InlineSamples/MarkdownExtractor.php @@ -79,8 +79,10 @@ public function extract(string $content): iterable } } - private function stripIndentation(string $body, int $spaces): string - { + private function stripIndentation( + string $body, + int $spaces + ): string { $prefix = str_repeat(' ', $spaces); $lines = explode("\n", $body); $stripped = array_map( diff --git a/tests/InlineSamples/MarkdownExtractorTest.php b/tests/InlineSamples/MarkdownExtractorTest.php index 7cf6e312aaf..474fa0934cd 100644 --- a/tests/InlineSamples/MarkdownExtractorTest.php +++ b/tests/InlineSamples/MarkdownExtractorTest.php @@ -187,8 +187,10 @@ public function testSkipsOnlyMatchingBlocksWhenMixed(): void * @param array $expected */ #[DataProvider('provideMultilineBlocks')] - public function testExtractsMultilineBody(string $content, array $expected): void - { + public function testExtractsMultilineBody( + string $content, + array $expected + ): void { $blocks = iterator_to_array($this->extractor->extract($content)); self::assertCount(count($expected), $blocks); diff --git a/tests/Markdown/MarkdownYamlExtractor.php b/tests/Markdown/MarkdownYamlExtractor.php index 699c59853e4..b15900df487 100644 --- a/tests/Markdown/MarkdownYamlExtractor.php +++ b/tests/Markdown/MarkdownYamlExtractor.php @@ -62,8 +62,10 @@ public function extract(string $content): iterable } } - private function stripIndentation(string $body, int $spaces): string - { + private function stripIndentation( + string $body, + int $spaces + ): string { $prefix = str_repeat(' ', $spaces); $lines = explode("\n", $body); $stripped = array_map( diff --git a/tests/Markdown/MarkdownYamlExtractorTest.php b/tests/Markdown/MarkdownYamlExtractorTest.php index 0575ae51df7..0451edeb236 100644 --- a/tests/Markdown/MarkdownYamlExtractorTest.php +++ b/tests/Markdown/MarkdownYamlExtractorTest.php @@ -187,8 +187,10 @@ public function testSkipsOnlyMatchingBlocksWhenMixed(): void * @param array $expected */ #[DataProvider('provideMultilineBlocks')] - public function testExtractsMultilineBody(string $content, array $expected): void - { + public function testExtractsMultilineBody( + string $content, + array $expected + ): void { $blocks = iterator_to_array($this->extractor->extract($content)); self::assertCount(count($expected), $blocks); diff --git a/tests/ValidationBaseline.php b/tests/ValidationBaseline.php index 223669e8a1e..53422e93e09 100644 --- a/tests/ValidationBaseline.php +++ b/tests/ValidationBaseline.php @@ -8,6 +8,8 @@ namespace Ibexa\Tests\Documentation; +use Symfony\Component\Yaml\Yaml; + /** * Reads yaml-validation-baseline.yaml and answers whether a given failure is * a known, expected one that should be suppressed rather than reported. @@ -26,11 +28,13 @@ final class ValidationBaseline public function __construct( private readonly string $baselineFile, private readonly string $repoRoot, - ) { - } + ) {} - public function isInBaseline(string $relativePath, ?string $bodyHash, string $errorMessage): bool - { + public function isInBaseline( + string $relativePath, + ?string $bodyHash, + string $errorMessage + ): bool { foreach ($this->getEntries() as $entry) { $entryPath = $entry['path'] ?? ''; @@ -68,7 +72,7 @@ private function getEntries(): array return $this->entries = []; } - $parsed = \Symfony\Component\Yaml\Yaml::parseFile($this->baselineFile); + $parsed = Yaml::parseFile($this->baselineFile); return $this->entries = $parsed['ignoreErrors'] ?? []; } diff --git a/tests/Yaml/YamlTest.php b/tests/Yaml/YamlTest.php index e6dc396127e..16a0d9c9944 100644 --- a/tests/Yaml/YamlTest.php +++ b/tests/Yaml/YamlTest.php @@ -24,8 +24,12 @@ final class YamlTest extends TestCase private const string BASELINE_FILE = __DIR__ . '/../yaml-validation-baseline.yaml'; #[DataProvider('provideYamlSources')] - public function testYamlIsSyntacticallyValid(string $filePath, int $line, string $body, string $bodyHash): void - { + public function testYamlIsSyntacticallyValid( + string $filePath, + int $line, + string $body, + string $bodyHash + ): void { $filePath = self::relativePath($filePath); try { @@ -157,8 +161,10 @@ private static function baseline(): ValidationBaseline return $baseline ??= new ValidationBaseline(self::BASELINE_FILE, realpath(self::REPO_ROOT)); } - private static function makeLabel(string $absolutePath, int $lineNumber): string - { + private static function makeLabel( + string $absolutePath, + int $lineNumber + ): string { return ltrim(str_replace(realpath(self::REPO_ROOT), '', $absolutePath), '/') . ':' . $lineNumber; } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 9374e6f3a2f..00cd6610cce 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -8,7 +8,7 @@ use Composer\Autoload\ClassLoader; -/** @var \Composer\Autoload\ClassLoader $loader */ +/** @var ClassLoader $loader */ $loader = require __DIR__ . '/../vendor/autoload.php'; /** diff --git a/tests/generate-yaml-baseline.php b/tests/generate-yaml-baseline.php index 51c816dee48..19c74e4e969 100644 --- a/tests/generate-yaml-baseline.php +++ b/tests/generate-yaml-baseline.php @@ -55,7 +55,7 @@ $entries = []; // Collect all failures/errors at any nesting depth using XPath -/** @var \SimpleXMLElement[] $testcases */ +/** @var SimpleXMLElement[] $testcases */ $testcases = $xml->xpath('//testcase[failure or error]') ?: []; foreach ($testcases as $testcase) { diff --git a/tools/php-cs-fixer/composer.json b/tools/php-cs-fixer/composer.json index 49fdb98ae6c..e563c01f300 100644 --- a/tools/php-cs-fixer/composer.json +++ b/tools/php-cs-fixer/composer.json @@ -1,5 +1,5 @@ { "require-dev": { - "ibexa/code-style": "~2.0.0" + "ibexa/code-style": "~2.0" } }