Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 3 additions & 4 deletions .php-cs-fixer-factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@

use Ibexa\CodeStyle\PhpCsFixer\InternalConfigFactory;

$configFactory = new InternalConfigFactory();
$configFactory->withRules([
$commonRules = [
'header_comment' => false,
]);
];

return $configFactory;
return [new InternalConfigFactory(), $commonRules];
9 changes: 4 additions & 5 deletions .php-cs-fixer-inline.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@
/**
* PHP-CS-Fixer configuration for auto-generated inline snippets in code_samples/_inline_php/.
*
* Builds on top of the main .php-cs-fixer.php configuration with additional
* rule overrides:
* Builds on top of the shared factory with additional rule overrides:
* - psr_autoloading is disabled: snippet files are named line_N.php and do not
* correspond to any class, so the filename≠class-name rule does not apply.
*/
$configFactory = require __DIR__ . '/.php-cs-fixer-factory.php';
[$configFactory, $commonRules] = require __DIR__ . '/.php-cs-fixer-factory.php';

$configFactory->withRules([
$configFactory->withRules(array_merge($commonRules, [
'psr_autoloading' => false,
'AdamWojs/phpdoc_force_fqcn_fixer' => false,
]);
]));

return $configFactory
->buildConfig()
Expand Down
4 changes: 3 additions & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
*/
declare(strict_types=1);

$configFactory = require __DIR__ . '/.php-cs-fixer-factory.php';
[$configFactory, $commonRules] = require __DIR__ . '/.php-cs-fixer-factory.php';

$configFactory->withRules($commonRules);

return $configFactory
->buildConfig()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ protected function getFieldTypeIdentifier(): string
return 'my_field_type';
}

#[\Override]
public function mapToFieldValueInputType(ContentType $contentType, FieldDefinition $fieldDefinition): ?string
{
if (!$this->canMap($fieldDefinition)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
: 'The user is not assigned to the segment.'
));

$this->segmentationService->removeSegmentGroup($segmentGroup);

return self::SUCCESS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;

/**
* @implements \Symfony\Component\Form\DataTransformerInterface<
* \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ProductName,
* \Ibexa\Bundle\ProductCatalog\Form\Data\Catalog\CatalogFilterPriceData
* >
*/
final class ProductNameCriterionTransformer implements DataTransformerInterface
{
public function transform($value): ?string
Expand Down
28 changes: 27 additions & 1 deletion deptrac.baseline.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
deptrac:
skip_violations:
AcmeFeatureBundle:
- Ibexa\Bundle\Core\DependencyInjection\IbexaCoreExtension
App\AutomatedTranslation\ImageFieldEncoder:
- Ibexa\Core\FieldType\Image\Value
App\Block\Listener\MyBlockListener:
Expand Down Expand Up @@ -92,6 +94,9 @@ deptrac:
- Ibexa\Core\MVC\Symfony\View\View
App\Controller\RelationController:
- Ibexa\Core\MVC\Symfony\View\View
App\Controller\RideController:
- Ibexa\Bundle\Core\Controller
- Ibexa\Core\MVC\Symfony\View\ContentView
App\Controller\SvgController:
- Ibexa\Core\Helper\TranslationHelper
- Ibexa\Core\IO\IOServiceInterface
Expand All @@ -117,6 +122,9 @@ deptrac:
- Ibexa\Discounts\Repository\DiscountRule\DiscountRuleFactoryInterface
App\Dispatcher\SomeClassThatSchedulesExecutionInTheBackground:
- Ibexa\Bundle\Messenger\Stamp\DeduplicateStamp
App\EventListener\InteractiveLoginListener:
- Ibexa\Core\MVC\Symfony\MVCEvents
- eIbexa\Core\MVC\Symfony\Event\InteractiveLoginEvent
App\EventListener\TextAnchorMenuTabListener:
- Ibexa\AdminUi\Menu\ContentEditAnchorMenuBuilder
- Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent
Expand All @@ -128,13 +136,19 @@ deptrac:
- Ibexa\FormBuilder\Event\FormEvents
App\EventSubscriber\HelpMenuSubscriber:
- Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent
App\EventSubscriber\LoginFormViewSubscriber:
- Ibexa\Core\MVC\Symfony\Event\PreContentViewEvent
- Ibexa\Core\MVC\Symfony\MVCEvents
- Ibexa\Core\MVC\Symfony\View\LoginFormView
App\EventSubscriber\MyMenuSubscriber:
- Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent
- Ibexa\AdminUi\Menu\MainMenuBuilder
App\EventSubscriber\NotificationScenarioSubscriber:
- Ibexa\IntegratedHelp\ProductTour\Block\LinkBlock
- Ibexa\IntegratedHelp\ProductTour\Block\TextBlock
- Ibexa\IntegratedHelp\ProductTour\ProductTourStep
App\EventSubscriber\ResolveCampaginEventSubscriber:
- Ibexa\ConnectorActito\Campaign\Campaign
App\Event\RandomBlockListener:
- Ibexa\FieldTypePage\FieldType\Page\Block\Renderer\BlockRenderEvents
- Ibexa\FieldTypePage\FieldType\Page\Block\Renderer\Event\PreRenderEvent
Expand Down Expand Up @@ -174,7 +188,7 @@ deptrac:
- Ibexa\Bundle\Checkout\Form\Type\AddressType
- Ibexa\Bundle\Payment\Form\Type\PaymentMethodChoiceType
- Ibexa\Bundle\Shipping\Form\Type\ShippingMethodChoiceType
App\GraphQL\Schema\MyCustomFieldDefinitionMapper:
App\GraphQL\Schema\MyFieldDefinitionMapper:
- Ibexa\GraphQL\Schema\Domain\Content\Mapper\FieldDefinition\DecoratingFieldDefinitionMapper
App\Migrations\Action\AssignSection:
- Ibexa\Migration\ValueObject\Step\Action
Expand All @@ -192,6 +206,8 @@ deptrac:
- Ibexa\Migration\ValueObject\Step\StepInterface
App\Migrations\Step\ReplaceNameStepNormalizer:
- Ibexa\Migration\ValueObject\Step\StepInterface
App\MyService:
- Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessServiceInterface
App\Notification\ListRenderer:
- Ibexa\Core\Notification\Renderer\NotificationRenderer
- Ibexa\Core\Notification\Renderer\TypedNotificationRendererInterface
Expand All @@ -207,6 +223,8 @@ deptrac:
App\QueryType\OptionsBasedLatestContentQueryType:
- Ibexa\Core\QueryType\OptionsResolverBasedQueryType
- Ibexa\Core\QueryType\QueryType
App\QueryType\RideQueryType:
- Ibexa\Core\QueryType\QueryType
App\Search\Model\Suggestion\ProductSuggestion:
- Ibexa\ProductCatalog\Local\Repository\Values\Product
App\Security\FormPolicyProvider:
Expand All @@ -231,6 +249,8 @@ deptrac:
- Ibexa\AdminUi\Limitation\LimitationValueMapperInterface
App\Security\MyPolicyProvider:
- Ibexa\Bundle\Core\DependencyInjection\Security\PolicyProvider\YamlPolicyProvider
App\Service\MyService:
- Ibexa\User\UserSetting\DateTimeFormat\FormatterInterface
App\Setting\Group\MyGroup:
- Ibexa\User\UserSetting\Group\AbstractGroup
App\Setting\Unit:
Expand All @@ -249,3 +269,9 @@ deptrac:
- Ibexa\Core\MVC\Symfony\View\View
AttributeTypeExtension:
- Ibexa\PageBuilder\Form\Type\Attribute\AttributeType
CustomRepositoryConfigParser:
- Ibexa\Bundle\Core\DependencyInjection\Configuration\RepositoryConfigParserInterface
JohnDoeCanSelectMore:
- Ibexa\AdminUi\UniversalDiscovery\Event\ConfigResolveEvent
MyMapper:
- Ibexa\ContentForms\Form\Type\FieldType\CheckboxFieldType
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,16 @@ It enables you to add a thumbnail URL in the text field.

Add `FieldValueUrl.php` in `src/Thumbnails`.

```php {skip-validation}
```php
<?php

declare(strict_types=1);

namespace App\Thumbnails;

use Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\Field\FieldTypeBasedThumbnailStrategy;
use Ibexa\Contracts\Core\Repository\Values\Content\Field;
use Ibexa\Contracts\Core\Repository\Values\Content\Thumbnail;
use Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\Field\FieldTypeBasedThumbnailStrategy;
use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo;

class FieldValueUrl implements FieldTypeBasedThumbnailStrategy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ You can format date and time by using the following services:

To use them, create an `src/Service/MyService.php` file containing:

``` php {skip-validation}
``` php
<?php

namespace App\Service;
Expand All @@ -28,19 +28,12 @@ use Ibexa\User\UserSetting\DateTimeFormat\FormatterInterface;

class MyService
{
/** @var \Ibexa\User\UserSetting\DateTimeFormat\FormatterInterface */
private $shortDateTimeFormatter;

public function __construct(FormatterInterface $shortDateTimeFormatter)
public function __construct(private readonly FormatterInterface $shortDateTimeFormatter)
{
// your code

$this->shortDateTimeFormatter = $shortDateTimeFormatter;

// your code
}

public function foo()
public function foo(): void
{
// your code

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ 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 {skip-validation}
``` php
/** @var \Knp\Menu\ItemInterface $menu */
$menu->addChild(
'all_content_list',
[
Expand All @@ -105,7 +106,8 @@ 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 {skip-validation}
``` php
/** @var \Knp\Menu\ItemInterface $menu */
$menu->addChild(
'all_content_list',
[
Expand Down
32 changes: 17 additions & 15 deletions docs/administration/back_office/browser/browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,40 +146,42 @@ If an event listener catches additional parameters passed with context, it uses

In the example below, the `johndoe` parameter enables the user to choose multiple items from a **Browser window** by changing `multiple: false` from `my_custom_udw` configuration to `multiple: true`.

```php {skip-validation} hl_lines="29 30 31"
```php hl_lines="31-34"
<?php

use Ibexa\AdminUi\UniversalDiscovery\Event\ConfigResolveEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class JohnDoeCanSelectMore implements EventSubscriberInterface
{
private const CONFIGURATION_NAME = 'my_custom_udw';
private const string CONFIGURATION_NAME = 'my_custom_udw';

/**
* Returns an array of event names this subscriber wants to listen to.
*
* @return array The event names to listen to
* @return array<string, string> The event names to listen to
*/
public static function getSubscribedEvents()
public static function getSubscribedEvents(): array
{
return [
ConfigResolveEvent::NAME => 'onUdwConfigResolve',
];
}

/**
* @param \Ibexa\AdminUi\UniversalDiscovery\Event $event
*/
public function onUdwConfigResolve(ConfigResolveEvent $event)
public function onUdwConfigResolve(ConfigResolveEvent $event): void
{
if ($event->getConfigName() !== self::CONFIGURATION_NAME) {
return;
}
return;
}

$config = $event->getConfig();
$context = $event->getContext();
$context = $event->getContext();

if (isset($context['some_contextual_parameter'])) {
if ($context['some_contextual_parameter'] === 'johndoe') {
$config['multiple'] = true;
}
}
if ($context['some_contextual_parameter'] === 'johndoe') {
$config['multiple'] = true;
}
}

$event->setConfig($config);
}
Expand Down
11 changes: 8 additions & 3 deletions docs/administration/back_office/customize_calendar.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,16 @@ To add an in-memory collection as an event source, create `src/Calendar/Holidays

For example:

``` php {skip-validation}
``` php
use App\Calendar\Holidays\Event;
use Ibexa\Contracts\Calendar\EventCollection;

/** @var \App\Calendar\Holidays\EventType $eventType */
$collection = new EventCollection([
$this->createEvent("Event 1", new DateTime("2024-01-01")),
$this->createEvent("Event 2", new DateTime("2024-01-02")),
new Event('Event 1', new DateTime('2024-01-01'), $eventType),
new Event('Event 2', new DateTime('2024-01-02'), $eventType),
// ...
]);
```

Next, register the event source as a service:
Expand Down
5 changes: 3 additions & 2 deletions docs/administration/back_office/notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,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 {skip-validation}
$this->notificationHandler->info(
``` php
/** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface $notificationHandler */
$notificationHandler->info(
/** @Desc("Notification text") */
'example.notification.text',
[],
Expand Down
5 changes: 3 additions & 2 deletions docs/administration/configuration/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ parameters:
an_array: [apple, banana, pear]
```

``` php {skip-validation}
``` php
// Usage inside a controller
$myParameter = $this->container->getParameter( 'myapp.parameter.name' );
/** @var \Symfony\Component\DependencyInjection\ContainerInterface $container */
$myParameter = $container->getParameter('myapp.parameter.name');
```

## Configuration settings
Expand Down
18 changes: 6 additions & 12 deletions docs/administration/configuration/dynamic_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ parameters:
myapp.default.my_param: Default value
```

Inside a controller, in `site_group` SiteAccess, you can use the parameters in the following way (the same applies for `hasParameter()`):
Inside a controller extending the `Ibexa\Core\MVC\Symfony\Controller\Controller` class, in `site_group` SiteAccess, you can use the parameters in the following way (the same applies for `hasParameter()`):

``` php {skip-validation}
$configResolver = $this->getConfigResolver();
 

// ibexa.site_access.config is the default namespace, so no need to specify it
// The following will resolve ibexa.site_access.config.<siteaccessName>.content.default_ttl
// In the case of site_group, it will return 3600.
Expand Down Expand Up @@ -77,24 +77,18 @@ For more information about dependency injection, see [Service container](php_api
Don't store the retrieved config value unless you know what you're doing.
SiteAccess can change during code execution, which means you might work on the wrong value.

``` php {skip-validation}
``` php
namespace App;

use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface;
 

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

public function __construct( ConfigResolverInterface $configResolver )
public function __construct(private readonly ConfigResolverInterface $configResolver)
{
$this->configResolver = $configResolver;
}

public function someMethodThatNeedConfig()
public function someMethodThatNeedConfig(): void
{
$configValue = $this->configResolver->getParameter('my_param', 'myapp');
}
Expand Down
Loading
Loading