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
92 changes: 91 additions & 1 deletion phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3216,6 +3216,24 @@ parameters:
count: 1
path: src/bundle/Core/Features/Context/FieldTypeContext.php

-
message: '#^Method Ibexa\\Bundle\\Core\\Features\\Context\\FieldTypeContext\:\:createAndPublishContent\(\) has no return type specified\.$#'
identifier: missingType.return
count: 1
path: src/bundle/Core/Features/Context/FieldTypeContext.php

-
message: '#^Method Ibexa\\Bundle\\Core\\Features\\Context\\FieldTypeContext\:\:createAndPublishContent\(\) has parameter \$field with no type specified\.$#'
identifier: missingType.parameter
count: 1
path: src/bundle/Core/Features/Context/FieldTypeContext.php

-
message: '#^Method Ibexa\\Bundle\\Core\\Features\\Context\\FieldTypeContext\:\:createAndPublishContent\(\) has parameter \$value with no type specified\.$#'
identifier: missingType.parameter
count: 1
path: src/bundle/Core/Features/Context/FieldTypeContext.php

-
message: '#^Method Ibexa\\Bundle\\Core\\Features\\Context\\FieldTypeContext\:\:createContent\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down Expand Up @@ -3330,6 +3348,18 @@ parameters:
count: 1
path: src/bundle/Core/Features/Context/FieldTypeContext.php

-
message: '#^PHPDoc tag @param has invalid value \(mixed The field value\)\: Unexpected token "The", expected variable at offset 173 on line 6$#'
identifier: phpDoc.parseError
count: 1
path: src/bundle/Core/Features/Context/FieldTypeContext.php

-
message: '#^PHPDoc tag @param has invalid value \(string The field name\)\: Unexpected token "The", expected variable at offset 138 on line 5$#'
identifier: phpDoc.parseError
count: 1
path: src/bundle/Core/Features/Context/FieldTypeContext.php

-
message: '#^Parameter \#1 \$parentLocationId of method Ibexa\\Contracts\\Core\\Repository\\LocationService\:\:newLocationCreateStruct\(\) expects int, string given\.$#'
identifier: argument.type
Expand Down Expand Up @@ -5190,12 +5220,24 @@ parameters:
count: 2
path: src/bundle/IO/DependencyInjection/Compiler/IOConfigurationPass.php

-
message: '#^Property Ibexa\\Bundle\\IO\\DependencyInjection\\Compiler\\IOConfigurationPass\:\:\$binarydataHandlerFactories \(ArrayObject&iterable\<Ibexa\\Bundle\\IO\\DependencyInjection\\ConfigurationFactory\>\) does not accept ArrayObject\|null\.$#'
identifier: assign.propertyType
count: 1
path: src/bundle/IO/DependencyInjection/Compiler/IOConfigurationPass.php

-
message: '#^Property Ibexa\\Bundle\\IO\\DependencyInjection\\Compiler\\IOConfigurationPass\:\:\$binarydataHandlerFactories with generic class ArrayObject does not specify its types\: TKey, TValue$#'
identifier: missingType.generics
count: 1
path: src/bundle/IO/DependencyInjection/Compiler/IOConfigurationPass.php

-
message: '#^Property Ibexa\\Bundle\\IO\\DependencyInjection\\Compiler\\IOConfigurationPass\:\:\$metadataHandlerFactories \(ArrayObject&iterable\<Ibexa\\Bundle\\IO\\DependencyInjection\\ConfigurationFactory\>\) does not accept ArrayObject\|null\.$#'
identifier: assign.propertyType
count: 1
path: src/bundle/IO/DependencyInjection/Compiler/IOConfigurationPass.php

-
message: '#^Property Ibexa\\Bundle\\IO\\DependencyInjection\\Compiler\\IOConfigurationPass\:\:\$metadataHandlerFactories with generic class ArrayObject does not specify its types\: TKey, TValue$#'
identifier: missingType.generics
Expand Down Expand Up @@ -14124,6 +14166,12 @@ parameters:
count: 1
path: src/lib/MVC/Symfony/Locale/UserLanguagePreferenceProvider.php

-
message: '#^PHPDoc tag @param has invalid value \(\\Symfony\\Component\\HttpFoundation\\Request request to retrieve information from, use current if null\)\: Unexpected token "request", expected variable at offset 162 on line 4$#'
identifier: phpDoc.parseError
count: 1
path: src/lib/MVC/Symfony/Locale/UserLanguagePreferenceProviderInterface.php

-
message: '#^Method Ibexa\\Core\\MVC\\Symfony\\Matcher\\ClassNameMatcherFactory\:\:__construct\(\) has parameter \$matchConfig with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -14886,6 +14934,12 @@ parameters:
count: 1
path: src/lib/MVC/Symfony/Security/HttpUtils.php

-
message: '#^Property Ibexa\\Core\\MVC\\Symfony\\Security\\HttpUtils\:\:\$siteAccess \(Ibexa\\Core\\MVC\\Symfony\\SiteAccess\) does not accept Ibexa\\Core\\MVC\\Symfony\\SiteAccess\|null\.$#'
identifier: assign.propertyType
count: 1
path: src/lib/MVC/Symfony/Security/HttpUtils.php

-
message: '#^Method Ibexa\\Core\\MVC\\Symfony\\Security\\InteractiveLoginToken\:\:__construct\(\) has parameter \$credentials with no type specified\.$#'
identifier: missingType.parameter
Expand Down Expand Up @@ -24210,6 +24264,12 @@ parameters:
count: 1
path: src/lib/Repository/ContentService.php

-
message: '#^PHPDoc tag @param has invalid value \(\\Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Language\|null if not set the draft is created with the initialLanguage code of the source version or if not present with the main language\.\)\: Unexpected token "if", expected variable at offset 565 on line 9$#'
identifier: phpDoc.parseError
count: 1
path: src/lib/Repository/ContentService.php

-
message: '#^PHPDoc tag @var has invalid value \(\$content \\Ibexa\\Core\\Repository\\Values\\Content\\Content\)\: Unexpected token "\$content", expected type at offset 9 on line 1$#'
identifier: phpDoc.parseError
Expand Down Expand Up @@ -41335,7 +41395,7 @@ parameters:
path: tests/integration/Core/Repository/LanguageServiceAuthorizationTest.php

-
message: '#^Comparison operation "\<" between int\<70400, 80599\> and 50400 is always false\.$#'
message: '#^Comparison operation "\<" between int\<70400, 80499\> and 50400 is always false\.$#'
identifier: smaller.alwaysFalse
count: 1
path: tests/integration/Core/Repository/LanguageServiceMaximumSupportedLanguagesTest.php
Expand Down Expand Up @@ -47268,6 +47328,12 @@ parameters:
count: 1
path: tests/integration/Core/Repository/URLAliasServiceTest.php

-
message: '#^Method Ibexa\\Tests\\Integration\\Core\\Repository\\URLAliasServiceTest\:\:testCreateGlobalUrlAliasForLocationPropertyValues\(\) has parameter \$testData with no type specified\.$#'
identifier: missingType.parameter
count: 1
path: tests/integration/Core/Repository/URLAliasServiceTest.php

-
message: '#^Method Ibexa\\Tests\\Integration\\Core\\Repository\\URLAliasServiceTest\:\:testCreateGlobalUrlAliasForLocationVariation\(\) has no return type specified\.$#'
identifier: missingType.return
Expand All @@ -47280,6 +47346,12 @@ parameters:
count: 1
path: tests/integration/Core/Repository/URLAliasServiceTest.php

-
message: '#^Method Ibexa\\Tests\\Integration\\Core\\Repository\\URLAliasServiceTest\:\:testCreateGlobalUrlAliasForLocationVariationPropertyValues\(\) has parameter \$testData with no type specified\.$#'
identifier: missingType.parameter
count: 1
path: tests/integration/Core/Repository/URLAliasServiceTest.php

-
message: '#^Method Ibexa\\Tests\\Integration\\Core\\Repository\\URLAliasServiceTest\:\:testCreateGlobalUrlAliasPropertyValues\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down Expand Up @@ -47538,6 +47610,12 @@ parameters:
count: 1
path: tests/integration/Core/Repository/URLAliasServiceTest.php

-
message: '#^PHPDoc tag @param has invalid value \(\\Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\URLAlias\)\: Unexpected token "\\n \*", expected variable at offset 74 on line 2$#'
identifier: phpDoc.parseError
count: 5
path: tests/integration/Core/Repository/URLAliasServiceTest.php

-
message: '#^Parameter \#1 \$aliasList of method Ibexa\\Contracts\\Core\\Repository\\URLAliasService\:\:removeAliases\(\) expects array\<Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\URLAlias\>, iterable\<Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\URLAlias\> given\.$#'
identifier: argument.type
Expand Down Expand Up @@ -69912,6 +69990,18 @@ parameters:
count: 2
path: tests/lib/Repository/Mapper/ContentLocationMapper/DecoratedLocationServiceTest.php

-
message: '#^Method Ibexa\\Tests\\Core\\Repository\\PHPUnitConstraint\\AllValidationErrorsOccur\:\:extractTranslatable\(\) has parameter \$fieldErrors with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: tests/lib/Repository/PHPUnitConstraint/AllValidationErrorsOccur.php

-
message: '#^PHPDoc tag @param has invalid value \(array\<int, \<string, array\<\\Ibexa\\Contracts\\Core\\FieldType\\ValidationError\>\>\> \$fieldErrors\)\: Unexpected token "\<", expected type at offset 29 on line 2$#'
identifier: phpDoc.parseError
count: 1
path: tests/lib/Repository/PHPUnitConstraint/AllValidationErrorsOccur.php

-
message: '#^Method Ibexa\\Tests\\Core\\Repository\\PHPUnitConstraint\\ContentItemEquals\:\:compareArrays\(\) has parameter \$actual with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\Contracts\Core\Persistence\Content\Type;

use Doctrine\DBAL\Query\QueryBuilder;
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\CriterionInterface;
use Ibexa\Core\Persistence\Legacy\Content\Type\Gateway\CriterionVisitor\CriterionVisitor;

/**
* @template TCriterion of \Ibexa\Contracts\Core\Repository\Values\ContentType\Query\CriterionInterface
*/
interface CriterionHandlerInterface
{
/**
* @param TCriterion $criterion
*/
public function supports(CriterionInterface $criterion): bool;

/**
* @param TCriterion $criterion
*
* @return string|\Doctrine\DBAL\Query\Expression\CompositeExpression
*/
public function apply(
CriterionVisitor $criterionVisitor,
QueryBuilder $qb,
CriterionInterface $criterion
);
}
6 changes: 6 additions & 0 deletions src/contracts/Persistence/Content/Type/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Ibexa\Contracts\Core\Persistence\Content\Type;
use Ibexa\Contracts\Core\Persistence\Content\Type\Group\CreateStruct as GroupCreateStruct;
use Ibexa\Contracts\Core\Persistence\Content\Type\Group\UpdateStruct as GroupUpdateStruct;
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\ContentTypeQuery;

interface Handler
{
Expand Down Expand Up @@ -91,6 +92,11 @@ public function loadContentTypes($groupId, $status = Type::STATUS_DEFINED);
*/
public function loadContentTypeList(array $contentTypeIds): array;

/**
* @return array{count: int, items: array<string, mixed>}
*/
public function findContentTypes(?ContentTypeQuery $query = null): array;

/**
* @return \Ibexa\Contracts\Core\Persistence\Content\Type[]
*/
Expand Down
14 changes: 14 additions & 0 deletions src/contracts/Repository/ContentTypeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition;
use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionCreateStruct;
use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionUpdateStruct;
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\ContentTypeQuery;
use Ibexa\Contracts\Core\Repository\Values\ContentType\SearchResult;
use Ibexa\Contracts\Core\Repository\Values\User\User;

interface ContentTypeService
Expand Down Expand Up @@ -173,6 +175,11 @@ public function loadContentTypeDraft(int $contentTypeId, bool $ignoreOwnership =
*/
public function loadContentTypeList(array $contentTypeIds, array $prioritizedLanguages = []): iterable;

/**
* @param list<string> $prioritizedLanguages Used as prioritized language code on translated properties of returned object.
*/
public function findContentTypes(?ContentTypeQuery $query = null, array $prioritizedLanguages = []): SearchResult;

/**
* Get content type objects which belong to the given content type group.
*
Expand Down Expand Up @@ -263,6 +270,13 @@ public function assignContentTypeGroup(ContentType $contentType, ContentTypeGrou
*/
public function unassignContentTypeGroup(ContentType $contentType, ContentTypeGroup $contentTypeGroup): void;

/**
* @param string[] $prioritizedLanguages Used as prioritized language code on translated properties of returned object.
*
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException If field definition with the given id and status DEFINED cannot be found
*/
public function loadFieldDefinition(int $fieldDefinitionId, array $prioritizedLanguages): FieldDefinition;

/**
* Adds a new field definition to an existing content type.
*
Expand Down
12 changes: 12 additions & 0 deletions src/contracts/Repository/Decorator/ContentTypeServiceDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition;
use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionCreateStruct;
use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionUpdateStruct;
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\ContentTypeQuery;
use Ibexa\Contracts\Core\Repository\Values\ContentType\SearchResult;
use Ibexa\Contracts\Core\Repository\Values\User\User;

abstract class ContentTypeServiceDecorator implements ContentTypeService
Expand Down Expand Up @@ -107,6 +109,11 @@ public function loadContentTypeList(
return $this->innerService->loadContentTypeList($contentTypeIds, $prioritizedLanguages);
}

public function findContentTypes(?ContentTypeQuery $query = null, array $prioritizedLanguages = []): SearchResult
{
return $this->innerService->findContentTypes($query, $prioritizedLanguages);
}

public function loadContentTypes(
ContentTypeGroup $contentTypeGroup,
array $prioritizedLanguages = []
Expand Down Expand Up @@ -152,6 +159,11 @@ public function unassignContentTypeGroup(
$this->innerService->unassignContentTypeGroup($contentType, $contentTypeGroup);
}

public function loadFieldDefinition(int $fieldDefinitionId, array $prioritizedLanguages): FieldDefinition
{
return $this->innerService->loadFieldDefinition($fieldDefinitionId, $prioritizedLanguages);
}

public function addFieldDefinition(
ContentTypeDraft $contentTypeDraft,
FieldDefinitionCreateStruct $fieldDefinitionCreateStruct
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\Contracts\Core\Repository\Values\ContentType\Query;

final class ContentTypeQuery
{
public const DEFAULT_LIMIT = 25;

private ?CriterionInterface $criterion;

/** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\Query\SortClause[] */
private array $sortClauses;

private int $offset;

private int $limit;

/**
* @param \Ibexa\Contracts\Core\Repository\Values\ContentType\Query\SortClause[] $sortClauses
*/
public function __construct(
?CriterionInterface $criterion = null,
array $sortClauses = [],
int $offset = 0,
int $limit = self::DEFAULT_LIMIT
) {
$this->criterion = $criterion;
$this->sortClauses = $sortClauses;
$this->offset = $offset;
$this->limit = $limit;
}

public function getCriterion(): ?CriterionInterface
{
return $this->criterion;
}

public function setCriterion(?CriterionInterface $criterion): void
{
$this->criterion = $criterion;
}

public function addSortClause(SortClause $sortClause): void
{
$this->sortClauses[] = $sortClause;
}

/**
* @return \Ibexa\Contracts\Core\Repository\Values\ContentType\Query\SortClause[]
*/
public function getSortClauses(): array
{
return $this->sortClauses;
}

public function getOffset(): int
{
return $this->offset;
}

public function setOffset(int $offset): void
{
$this->offset = $offset;
}

public function getLimit(): int
{
return $this->limit;
}

public function setLimit(int $limit): void
{
$this->limit = $limit;
}
}
Loading
Loading