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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

use Ibexa\Contracts\Rector\Sets\IbexaSetList;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\SetList;
use Rector\Symfony\Set\SymfonySetList;

return RectorConfig::configure()
Expand All @@ -16,6 +17,7 @@
__DIR__ . '/tests',
])
->withSets([
SetList::TYPE_DECLARATION,
IbexaSetList::IBEXA_50->value,
SymfonySetList::SYMFONY_60,
SymfonySetList::SYMFONY_61,
Expand Down
18 changes: 3 additions & 15 deletions src/bundle/Controller/ContentEditController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,11 @@

class ContentEditController extends Controller
{
/** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */
private $contentTypeService;

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

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

public function __construct(
ContentTypeService $contentTypeService,
ContentService $contentService,
ActionDispatcherInterface $contentActionDispatcher
private ContentTypeService $contentTypeService,
private ContentService $contentService,
private ActionDispatcherInterface $contentActionDispatcher
Comment on lines +27 to +29
Copy link
Contributor

Choose a reason for hiding this comment

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

Could those be readonly as well?

) {
$this->contentTypeService = $contentTypeService;
$this->contentService = $contentService;
$this->contentActionDispatcher = $contentActionDispatcher;
}

/**
Expand Down
53 changes: 9 additions & 44 deletions src/bundle/Controller/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,52 +30,17 @@

class UserController extends Controller
{
/** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */
private $contentTypeService;

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

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

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

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

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

/** @var \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface */
private $userLanguagePreferenceProvider;

/** @var \Ibexa\Contracts\ContentForms\Content\Form\Provider\GroupedContentFormFieldsProviderInterface */
private $groupedContentFormFieldsProvider;

private ContentService $contentService;

public function __construct(
ContentTypeService $contentTypeService,
UserService $userService,
LocationService $locationService,
LanguageService $languageService,
ActionDispatcherInterface $userActionDispatcher,
PermissionResolver $permissionResolver,
UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider,
GroupedContentFormFieldsProviderInterface $groupedContentFormFieldsProvider,
ContentService $contentService
private ContentTypeService $contentTypeService,
private UserService $userService,
private LocationService $locationService,
private LanguageService $languageService,
private ActionDispatcherInterface $userActionDispatcher,
private PermissionResolver $permissionResolver,
private UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider,
private GroupedContentFormFieldsProviderInterface $groupedContentFormFieldsProvider,
private ContentService $contentService
Comment on lines +34 to +42
Copy link
Contributor

Choose a reason for hiding this comment

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

Could those be readonly as well?

) {
$this->contentTypeService = $contentTypeService;
$this->userService = $userService;
$this->locationService = $locationService;
$this->languageService = $languageService;
$this->userActionDispatcher = $userActionDispatcher;
$this->permissionResolver = $permissionResolver;
$this->userLanguagePreferenceProvider = $userLanguagePreferenceProvider;
$this->groupedContentFormFieldsProvider = $groupedContentFormFieldsProvider;
$this->contentService = $contentService;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use Ibexa\ContentForms\FieldType\FieldTypeFormMapperDispatcher;
use LogicException;
use Override;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
Expand All @@ -22,6 +23,7 @@ class FieldTypeFormMapperDispatcherPass implements CompilerPassInterface
public const string FIELD_TYPE_FORM_MAPPER_DISPATCHER = FieldTypeFormMapperDispatcher::class;
public const string FIELD_TYPE_FORM_MAPPER_VALUE_SERVICE_TAG = 'ibexa.admin_ui.field_type.form.mapper.value';

#[Override]
public function process(ContainerBuilder $container): void
{
if (!$container->hasDefinition(self::FIELD_TYPE_FORM_MAPPER_DISPATCHER)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use Ibexa\Bundle\Core\DependencyInjection\Configuration\AbstractParser;
use Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface;
use Override;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class ContentEdit extends AbstractParser
Expand All @@ -19,7 +20,8 @@ class ContentEdit extends AbstractParser
*
* @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system.<siteaccess>
*/
public function addSemanticConfig(NodeBuilder $nodeBuilder)
#[Override]
public function addSemanticConfig(NodeBuilder $nodeBuilder): void
{
$nodeBuilder
->arrayNode('content_edit')
Expand Down Expand Up @@ -48,7 +50,8 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder)
->end();
}

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

use Ibexa\Bundle\Core\DependencyInjection\Configuration\AbstractParser;
use Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface;
use Override;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class UserEdit extends AbstractParser
Expand All @@ -19,7 +20,8 @@ class UserEdit extends AbstractParser
*
* @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system.<siteaccess>
*/
public function addSemanticConfig(NodeBuilder $nodeBuilder)
#[Override]
public function addSemanticConfig(NodeBuilder $nodeBuilder): void
{
$nodeBuilder
->arrayNode('user_edit')
Expand All @@ -40,7 +42,8 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder)
->end();
}

public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
#[Override]
public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void
{
if (empty($scopeSettings['user_edit'])) {
return;
Expand Down
3 changes: 3 additions & 0 deletions src/bundle/DependencyInjection/IbexaContentFormsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace Ibexa\Bundle\ContentForms\DependencyInjection;

use Override;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
Expand All @@ -19,6 +20,7 @@ class IbexaContentFormsExtension extends Extension implements PrependExtensionIn
/**
* @throws \Exception
*/
#[Override]
public function load(array $configs, ContainerBuilder $container): void
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
Expand All @@ -29,6 +31,7 @@ public function load(array $configs, ContainerBuilder $container): void
}
}

#[Override]
public function prepend(ContainerBuilder $container): void
{
$this->prependJMSTranslation($container);
Expand Down
2 changes: 2 additions & 0 deletions src/bundle/IbexaContentFormsBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
use Ibexa\Bundle\ContentForms\DependencyInjection\Configuration\Parser\ContentEdit;
use Ibexa\Bundle\ContentForms\DependencyInjection\Configuration\Parser\ContentEditView;
use Ibexa\Bundle\ContentForms\DependencyInjection\Configuration\Parser\UserEdit;
use Override;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class IbexaContentFormsBundle extends Bundle
{
#[Override]
public function build(ContainerBuilder $container): void
{
parent::build($container);
Expand Down
40 changes: 17 additions & 23 deletions src/lib/Behat/Context/ContentEditContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,25 @@
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use Behat\MinkExtension\Context\MinkContext;
use Exception;
use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionCreateStruct;

final class ContentEditContext extends MinkContext implements Context, SnippetAcceptingContext
{
/**
* Name of the content that was created using the edit form. Used to validate that the content was created.
*
* @var string
*/
private $createdContentName;
private ?string $createdContentName = null;

/**
* @var \Ibexa\ContentForms\Behat\Context\ContentTypeContext
*/
private $contentTypeContext;
private ContentTypeContext $contentTypeContext;

/**
* Identifier of the FieldDefinition used to cover validation.
*
* @var string
*/
private static $constrainedFieldIdentifier = 'constrained_field';
private static string $constrainedFieldIdentifier = 'constrained_field';

/** @BeforeScenario */
public function gatherContexts(BeforeScenarioScope $scope)
public function gatherContexts(BeforeScenarioScope $scope): void
{
$environment = $scope->getEnvironment();

Expand All @@ -47,18 +41,18 @@ public function gatherContexts(BeforeScenarioScope $scope)
* @Then /^I should see a folder content edit form$/
* @Then /^I should see a content edit form$/
*/
public function iShouldSeeAContentEditForm()
public function iShouldSeeAContentEditForm(): void
{
$this->assertSession()->elementExists('css', 'form[name=ezplatform_content_forms_content_edit]');
}

/**
* @Then /^I am on the View of the Content that was published$/
*/
public function iAmOnTheViewOfTheContentThatWasPublished()
public function iAmOnTheViewOfTheContentThatWasPublished(): void
{
if (!isset($this->createdContentName)) {
throw new \Exception('No created content name set');
throw new Exception('No created content name set');
}

$this->assertElementOnPage('span.ezstring-field');
Expand All @@ -68,7 +62,7 @@ public function iAmOnTheViewOfTheContentThatWasPublished()
/**
* @When /^I fill in the folder edit form$/
*/
public function iFillInTheFolderEditForm()
public function iFillInTheFolderEditForm(): void
{
// will only work for single value fields
$this->createdContentName = 'Behat content edit @' . microtime(true);
Expand All @@ -78,7 +72,7 @@ public function iFillInTheFolderEditForm()
/**
* @Given /^that I have permission to create folders$/
*/
public function thatIHavePermissionToCreateFolders()
public function thatIHavePermissionToCreateFolders(): void
{
$this->visit('/login');
$this->fillField('_username', 'admin');
Expand All @@ -89,15 +83,15 @@ public function thatIHavePermissionToCreateFolders()
/**
* @Given /^that I have permission to create content of this type$/
*/
public function thatIHavePermissionToCreateContentOfThisType()
public function thatIHavePermissionToCreateContentOfThisType(): void
{
$this->thatIHavePermissionToCreateFolders();
}

/**
* @When /^I go to the content creation page for this type$/
*/
public function iGoToTheContentCreationPageForThisType()
public function iGoToTheContentCreationPageForThisType(): void
{
$uri = sprintf(
'/content/create/nodraft/%s/eng-GB/2',
Expand All @@ -110,7 +104,7 @@ public function iGoToTheContentCreationPageForThisType()
/**
* @Given /^I fill in the constrained field with an invalid value$/
*/
public function iFillInTheConstrainedFieldWithAnInvalidValue()
public function iFillInTheConstrainedFieldWithAnInvalidValue(): void
{
$this->fillField(
sprintf(
Expand All @@ -132,7 +126,7 @@ public function iFillInTheConstrainedFieldWithAnInvalidValue()
/**
* @Then /^I am shown the content creation form$/
*/
public function iAmShownTheContentCreationForm()
public function iAmShownTheContentCreationForm(): void
{
$uri = sprintf(
'/content/create/nodraft/%s/eng-GB/2',
Expand All @@ -151,7 +145,7 @@ public function iAmShownTheContentCreationForm()
/**
* @Given /^there is a relevant error message linked to the invalid field$/
*/
public function thereIsARelevantErrorMessageLinkedToTheInvalidField()
public function thereIsARelevantErrorMessageLinkedToTheInvalidField(): void
{
$selector = sprintf(
'#ezplatform_content_forms_content_edit_fieldsData_%s div ul li',
Expand All @@ -165,7 +159,7 @@ public function thereIsARelevantErrorMessageLinkedToTheInvalidField()
/**
* @Given /^that there is a content type with any kind of constraints on a Field Definition$/
*/
public function thereIsAContentTypeWithAnyKindOfConstraintsOnAFieldDefinition()
public function thereIsAContentTypeWithAnyKindOfConstraintsOnAFieldDefinition(): void
{
$contentTypeCreateStruct = $this->contentTypeContext->newContentTypeCreateStruct();

Expand All @@ -188,7 +182,7 @@ public function thereIsAContentTypeWithAnyKindOfConstraintsOnAFieldDefinition()
/**
* @When /^a content creation form is displayed$/
*/
public function aContentCreationFormIsDisplayed()
public function aContentCreationFormIsDisplayed(): void
{
$this->visit('/content/create/nodraft/folder/eng-GB/2');
}
Expand Down
Loading
Loading