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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 3 additions & 75 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,31 +1,19 @@
parameters:
ignoreErrors:
-
message: '#^Parameter \#1 \$locationId of method Ibexa\\Contracts\\Core\\Repository\\LocationService\:\:loadLocation\(\) expects int, int\|null given\.$#'
identifier: argument.type
count: 1
path: src/bundle/Controller/QueryFieldRestController.php

-
message: '#^Parameter \#1 \$uri of method Ibexa\\Contracts\\Rest\\UriParser\\UriParserInterface\:\:getAttributeFromUri\(\) expects string, string\|null given\.$#'
identifier: argument.type
count: 1
path: src/bundle/Controller/QueryFieldRestController.php

-
message: '#^Argument of an invalid type array\|bool\|float\|int\|string\|null supplied for foreach, only iterables are supported\.$#'
message: '#^Argument of an invalid type array\|bool\|float\|int\|string supplied for foreach, only iterables are supported\.$#'
identifier: foreach.nonIterable
count: 1
path: src/bundle/DependencyInjection/Compiler/FieldDefinitionIdentifierViewMatcherPass.php

-
message: '#^Cannot access offset \(int\|string\) on non\-empty\-array\|bool\|float\|int\|string\|null\.$#'
message: '#^Cannot access offset \(int\|string\) on non\-empty\-array\|bool\|float\|int\|string\.$#'
identifier: offsetAccess.nonOffsetAccessible
count: 1
path: src/bundle/DependencyInjection/Compiler/FieldDefinitionIdentifierViewMatcherPass.php

-
message: '#^Parameter \#2 \$callback of function array_filter expects \(callable\(int\|string\)\: bool\)\|null, Closure\(mixed\)\: \(0\|1\|false\) given\.$#'
message: '#^Parameter \#2 \$callback of function array_filter expects \(callable\(int\|string\)\: bool\)\|null, Closure\(string\)\: \(0\|1\|false\) given\.$#'
identifier: argument.type
count: 1
path: src/bundle/DependencyInjection/Compiler/FieldDefinitionIdentifierViewMatcherPass.php
Expand All @@ -36,36 +24,6 @@ parameters:
count: 1
path: src/bundle/DependencyInjection/Compiler/QueryTypesListPass.php

-
message: '#^Parameter \#1 \$input of static method Symfony\\Component\\Yaml\\Yaml\:\:parse\(\) expects string, string\|false given\.$#'
identifier: argument.type
count: 1
path: src/bundle/DependencyInjection/IbexaFieldTypeQueryExtension.php

-
message: '#^Method Ibexa\\FieldTypeQuery\\ContentView\\QueryResultsInjector\:\:__construct\(\) has parameter \$views with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/lib/ContentView/QueryResultsInjector.php

-
message: '#^Property Ibexa\\FieldTypeQuery\\ContentView\\QueryResultsInjector\:\:\$queryFieldService \(Ibexa\\Contracts\\FieldTypeQuery\\QueryFieldLocationService&Ibexa\\Contracts\\FieldTypeQuery\\QueryFieldServiceInterface\) does not accept Ibexa\\Contracts\\FieldTypeQuery\\QueryFieldServiceInterface\.$#'
identifier: assign.propertyType
count: 1
path: src/lib/ContentView/QueryResultsInjector.php

-
message: '#^Property Ibexa\\FieldTypeQuery\\ContentView\\QueryResultsInjector\:\:\$views type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/lib/ContentView/QueryResultsInjector.php

-
message: '#^Property Ibexa\\FieldTypeQuery\\ExceptionSafeQueryFieldService\:\:\$inner \(Ibexa\\Contracts\\FieldTypeQuery\\QueryFieldLocationService&Ibexa\\Contracts\\FieldTypeQuery\\QueryFieldServiceInterface\) does not accept Ibexa\\Contracts\\FieldTypeQuery\\QueryFieldServiceInterface\.$#'
identifier: assign.propertyType
count: 1
path: src/lib/ExceptionSafeQueryFieldService.php

-
message: '#^Generator expects key type string, string\|null given\.$#'
identifier: generator.keyType
Expand All @@ -78,38 +36,8 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/QueryConverter.php

-
message: '#^Method Ibexa\\FieldTypeQuery\\QueryFieldService\:\:isExpression\(\) has parameter \$expression with no type specified\.$#'
identifier: missingType.parameter
count: 1
path: src/lib/QueryFieldService.php

-
message: '#^Method Ibexa\\FieldTypeQuery\\QueryFieldService\:\:prepareQuery\(\) has parameter \$extraParameters with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/lib/QueryFieldService.php

-
message: '#^Method Ibexa\\FieldTypeQuery\\QueryFieldService\:\:resolveExpression\(\) has parameter \$variables with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/lib/QueryFieldService.php

-
message: '#^Method Ibexa\\FieldTypeQuery\\QueryFieldService\:\:resolveParameters\(\) has parameter \$expressions with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/lib/QueryFieldService.php

-
message: '#^Method Ibexa\\FieldTypeQuery\\QueryFieldService\:\:resolveParameters\(\) has parameter \$variables with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/lib/QueryFieldService.php

-
message: '#^Method Ibexa\\FieldTypeQuery\\QueryFieldService\:\:resolveParameters\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/lib/QueryFieldService.php
21 changes: 14 additions & 7 deletions spec/ContentView/FieldDefinitionIdentifierMatcherSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @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 spec\Ibexa\FieldTypeQuery\ContentView;

Expand All @@ -20,15 +21,15 @@
use Ibexa\FieldTypeQuery\ContentView\FieldDefinitionIdentifierMatcher;
use PhpSpec\ObjectBehavior;

class FieldDefinitionIdentifierMatcherSpec extends ObjectBehavior
final class FieldDefinitionIdentifierMatcherSpec extends ObjectBehavior
{
private const CONTENT_TYPE_ID_WITHOUT_FIELD_DEFINITION = 2;
private const CONTENT_TYPE_IDENTIFIER_WITHOUT_FIELD_DEFINITION = 'type_matching_without_field_def';
private const int CONTENT_TYPE_ID_WITHOUT_FIELD_DEFINITION = 2;
private const string CONTENT_TYPE_IDENTIFIER_WITHOUT_FIELD_DEFINITION = 'type_matching_without_field_def';

private const CONTENT_TYPE_ID_WITH_FIELD_DEFINITION = 3;
private const CONTENT_TYPE_IDENTIFIER_WITH_FIELD_DEFINITION = 'type_matching_with_field_def';
private const int CONTENT_TYPE_ID_WITH_FIELD_DEFINITION = 3;
private const string CONTENT_TYPE_IDENTIFIER_WITH_FIELD_DEFINITION = 'type_matching_with_field_def';

public const FIELD_DEFINITION_IDENTIFIER = 'field_definition';
public const string FIELD_DEFINITION_IDENTIFIER = 'field_definition';

public function it_is_initializable(): void
{
Expand Down Expand Up @@ -71,7 +72,13 @@ private function buildView(int $contentTypeId): ContentView
$view->setContent(
new Content([
'versionInfo' => new VersionInfo([
'contentInfo' => new ContentInfo(['contentTypeId' => $contentTypeId]),
'contentInfo' => new ContentInfo([
'contentTypeId' => $contentTypeId,
'contentType' => new ContentType([
'id' => $contentTypeId,
'identifier' => 'foo_content_type',
]),
]),
]),
])
);
Expand Down
33 changes: 19 additions & 14 deletions spec/ContentView/QueryResultsInjectorSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @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 spec\Ibexa\FieldTypeQuery\ContentView;

Expand All @@ -12,21 +13,20 @@
use Ibexa\Core\MVC\Symfony\View\Event\FilterViewParametersEvent;
use Ibexa\Core\MVC\Symfony\View\ViewEvents;
use Ibexa\Core\Repository\Values\Content\Content;
use Ibexa\FieldTypeQuery\ContentView\QueryResultsInjector;
use Pagerfanta\Pagerfanta;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Webmozart\Assert\Assert;

class QueryResultsInjectorSpec extends ObjectBehavior
final class QueryResultsInjectorSpec extends ObjectBehavior
{
public const FIELD_VIEW = 'content_query_field';
public const OTHER_VIEW = 'anything_else';
public const ITEM_VIEW = 'line';
public const VIEWS = ['field' => self::FIELD_VIEW, 'item' => self::ITEM_VIEW];
public const FIELD_DEFINITION_IDENTIFIER = 'query_field';
public const string FIELD_VIEW = 'content_query_field';
public const string OTHER_VIEW = 'anything_else';
public const string ITEM_VIEW = 'line';
public const array VIEWS = ['field' => self::FIELD_VIEW, 'item' => self::ITEM_VIEW];
public const string FIELD_DEFINITION_IDENTIFIER = 'query_field';

private ContentView $view;

Expand All @@ -50,11 +50,6 @@ public function __construct()
);
}

public function it_is_initializable(): void
{
$this->shouldHaveType(QueryResultsInjector::class);
}

public function let(
QueryFieldServiceInterface $queryFieldService,
FilterViewParametersEvent $event,
Expand Down Expand Up @@ -104,8 +99,9 @@ public function it_does_nothing_for_non_field_views(QueryFieldServiceInterface $
$queryFieldService->getPaginationConfiguration(Argument::any())->shouldNotHaveBeenCalled();
}

public function it_adds_the_query_results_for_the_field_view_without_pagination(QueryFieldServiceInterface $queryFieldService): void
{
public function it_adds_the_query_results_for_the_field_view_without_pagination(
QueryFieldServiceInterface $queryFieldService
): void {
$content = $this->createContentItem();

$queryFieldService
Expand All @@ -128,6 +124,9 @@ public function it_adds_the_query_results_for_the_field_view_without_pagination(
Assert::eq($parameters->get('items'), $this->getResults());
}

/**
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException
*/
public function it_adds_the_query_results_for_the_field_view_with_pagination(
FilterViewParametersEvent $event,
QueryFieldServiceInterface $queryFieldService
Expand Down Expand Up @@ -156,6 +155,9 @@ public function it_adds_the_query_results_for_the_field_view_with_pagination(
Assert::isInstanceOf($parameters->get('items'), Pagerfanta::class);
}

/**
* @return array<string, callable>
*/
public function getMatchers(): array
{
return [
Expand All @@ -170,6 +172,9 @@ private function createContentItem(): Content
return new Content();
}

/**
* @return \Ibexa\Core\Repository\Values\Content\Content[]
*/
private function getResults(): array
{
return [
Expand Down
3 changes: 2 additions & 1 deletion spec/ExceptionSafeQueryFieldServiceSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @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 spec\Ibexa\FieldTypeQuery;

Expand All @@ -13,7 +14,7 @@
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class ExceptionSafeQueryFieldServiceSpec extends ObjectBehavior
final class ExceptionSafeQueryFieldServiceSpec extends ObjectBehavior
{
public function let(QueryFieldServiceInterface $queryFieldService): void
{
Expand Down
19 changes: 6 additions & 13 deletions spec/GraphQL/ContentQueryFieldDefinitionMapperSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @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 spec\Ibexa\FieldTypeQuery\GraphQL;

Expand All @@ -15,12 +16,12 @@
use Ibexa\GraphQL\Schema\Domain\Content\NameHelper;
use PhpSpec\ObjectBehavior;

class ContentQueryFieldDefinitionMapperSpec extends ObjectBehavior
final class ContentQueryFieldDefinitionMapperSpec extends ObjectBehavior
{
public const FIELD_IDENTIFIER = 'test';
public const FIELD_TYPE_IDENTIFIER = 'ibexa_content_query';
public const RETURNED_CONTENT_TYPE_IDENTIFIER = 'folder';
public const GRAPHQL_TYPE = 'FolderContent';
public const string FIELD_IDENTIFIER = 'test';
public const string FIELD_TYPE_IDENTIFIER = 'ibexa_content_query';
public const string RETURNED_CONTENT_TYPE_IDENTIFIER = 'folder';
public const string GRAPHQL_TYPE = 'FolderContent';

public function let(
FieldDefinitionMapper $innerMapper,
Expand Down Expand Up @@ -100,11 +101,6 @@ public function it_maps_the_field_value_when_pagination_is_enabled(FieldDefiniti
->shouldBe('@=resolver("QueryFieldValueConnection", [args, field, content])');
}

/**
* @param bool $enablePagination
*
* @return \Ibexa\Core\Repository\Values\ContentType\FieldDefinition
*/
private function fieldDefinition(bool $enablePagination = false): FieldDefinition
{
return new FieldDefinition([
Expand All @@ -117,9 +113,6 @@ private function fieldDefinition(bool $enablePagination = false): FieldDefinitio
]);
}

/**
* @return \Ibexa\Core\Repository\Values\ContentType\FieldDefinition
*/
protected function getLambdaFieldDefinition(): FieldDefinition
{
return new FieldDefinition(['fieldTypeIdentifier' => 'lambda']);
Expand Down
5 changes: 3 additions & 2 deletions spec/GraphQL/QueryFieldResolverSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @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 spec\Ibexa\FieldTypeQuery\GraphQL;

Expand All @@ -13,9 +14,9 @@
use Ibexa\GraphQL\Value\Field;
use PhpSpec\ObjectBehavior;

class QueryFieldResolverSpec extends ObjectBehavior
final class QueryFieldResolverSpec extends ObjectBehavior
{
public const FIELD_DEFINITION_IDENTIFIER = 'test';
public const string FIELD_DEFINITION_IDENTIFIER = 'test';

public function let(QueryFieldServiceInterface $queryFieldService): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @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 spec\Ibexa\FieldTypeQuery\Persistence\Legacy\Content\FieldValue\Converter;

Expand All @@ -13,13 +14,13 @@
use PhpSpec\ObjectBehavior;
use Webmozart\Assert\Assert;

class QueryConverterSpec extends ObjectBehavior
final class QueryConverterSpec extends ObjectBehavior
{
public const PARAMETERS = ['param1' => 'value1', 'param2' => 'value2'];
public const QUERY_TYPE = 'SomeQueryType';
public const RETURNED_TYPE = 'folder';
public const ENABLE_PAGINATION = true;
public const ITEMS_PER_PAGE = 10;
public const array PARAMETERS = ['param1' => 'value1', 'param2' => 'value2'];
public const string QUERY_TYPE = 'SomeQueryType';
public const string RETURNED_TYPE = 'folder';
public const bool ENABLE_PAGINATION = true;
public const int ITEMS_PER_PAGE = 10;

public function it_is_initializable(): void
{
Expand Down
Loading
Loading