Skip to content

Commit

Permalink
IBX-8470: Upgraded codebase to Symfony 6 (#76)
Browse files Browse the repository at this point in the history
* IBX-8470: Upgraded dependencies to symfony6 + compatible with it
* IBX-8470: Fixed phpstan issues after upgrade
* Removed deprecated resolver_maps configuration option usage
* Replaced deprecated resolver expression function usage

---------

Co-authored-by: Adam Wójs <[email protected]>
  • Loading branch information
ViniTou and adamwojs authored Feb 4, 2025
1 parent 3c51f45 commit eb1ec22
Show file tree
Hide file tree
Showing 39 changed files with 225 additions and 313 deletions.
23 changes: 10 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
"ibexa/fieldtype-richtext": "~5.0.x-dev",
"ibexa/rest": "~5.0.x-dev",
"lexik/jwt-authentication-bundle": "^2.8",
"overblog/graphql-bundle": "^0.14.2",
"symfony/config": "^5.0",
"symfony/console": "^5.0",
"symfony/dependency-injection": "^5.0",
"symfony/filesystem": "^5.0",
"symfony/http-foundation": "^5.0",
"symfony/http-kernel": "^5.0",
"symfony/serializer": "^5.0",
"symfony/yaml": "^5.0"
"overblog/graphql-bundle": "^1.6.0",
"symfony/config": "^6.4",
"symfony/console": "^6.4",
"symfony/dependency-injection": "^6.4",
"symfony/filesystem": "^6.4",
"symfony/http-foundation": "^6.4",
"symfony/http-kernel": "^6.4",
"symfony/serializer": "^6.4",
"symfony/yaml": "^6.4"
},
"require-dev": {
"ibexa/code-style": "~2.0.0",
Expand All @@ -42,7 +42,7 @@
"ibexa/search": "~5.0.x-dev",
"ibexa/user": "~5.0.x-dev",
"mikey179/vfsstream": "^1.6",
"overblog/graphiql-bundle": "^0.2",
"overblog/graphiql-bundle": "^1.0",
"phpspec/phpspec": "^7.1",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3",
Expand All @@ -65,9 +65,6 @@
"spec\\EzSystems\\EzPlatformGraphQL\\": "spec/EzSystems/EzPlatformGraphQL"
}
},
"conflict": {
"webonyx/graphql-php": ">= 15.0.0"
},
"extra": {
"branch-alias": {
"dev-main": "5.0.x-dev"
Expand Down
119 changes: 2 additions & 117 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,6 @@ parameters:
count: 1
path: src/bundle/Command/GeneratePlatformSchemaCommand.php

-
message: "#^Method Ibexa\\\\Bundle\\\\GraphQL\\\\Command\\\\GeneratePlatformSchemaCommand\\:\\:configure\\(\\) has no return type specified\\.$#"
count: 1
path: src/bundle/Command/GeneratePlatformSchemaCommand.php

-
message: "#^Method Ibexa\\\\Bundle\\\\GraphQL\\\\DependencyInjection\\\\Compiler\\\\FieldInputHandlersPass\\:\\:process\\(\\) has no return type specified\\.$#"
count: 1
path: src/bundle/DependencyInjection/Compiler/FieldInputHandlersPass.php

-
message: "#^Method Ibexa\\\\Bundle\\\\GraphQL\\\\DependencyInjection\\\\Compiler\\\\RichTextInputConvertersPass\\:\\:process\\(\\) has no return type specified\\.$#"
count: 1
path: src/bundle/DependencyInjection/Compiler/RichTextInputConvertersPass.php

-
message: "#^Method Ibexa\\\\Bundle\\\\GraphQL\\\\DependencyInjection\\\\Compiler\\\\SchemaDomainIteratorsPass\\:\\:process\\(\\) has no return type specified\\.$#"
count: 1
path: src/bundle/DependencyInjection/Compiler/SchemaDomainIteratorsPass.php

-
message: "#^Method Ibexa\\\\Bundle\\\\GraphQL\\\\DependencyInjection\\\\Compiler\\\\SchemaWorkersPass\\:\\:process\\(\\) has no return type specified\\.$#"
count: 1
path: src/bundle/DependencyInjection/Compiler/SchemaWorkersPass.php

-
message: "#^Method Ibexa\\\\Bundle\\\\GraphQL\\\\DependencyInjection\\\\GraphQL\\\\SchemaProvider\\:\\:getSchemaConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -100,11 +75,6 @@ parameters:
count: 1
path: src/bundle/DependencyInjection/IbexaGraphQLExtension.php

-
message: "#^Method Ibexa\\\\Bundle\\\\GraphQL\\\\DependencyInjection\\\\IbexaGraphQLExtension\\:\\:prepend\\(\\) has no return type specified\\.$#"
count: 1
path: src/bundle/DependencyInjection/IbexaGraphQLExtension.php

-
message: "#^Parameter \\#1 \\$configDir of method Ibexa\\\\Bundle\\\\GraphQL\\\\DependencyInjection\\\\IbexaGraphQLExtension\\:\\:getGraphQLConfig\\(\\) expects string, array\\|bool\\|float\\|int\\|string\\|null given\\.$#"
count: 1
Expand All @@ -115,11 +85,6 @@ parameters:
count: 1
path: src/bundle/DependencyInjection/IbexaGraphQLExtension.php

-
message: "#^Method Ibexa\\\\Bundle\\\\GraphQL\\\\IbexaGraphQLBundle\\:\\:build\\(\\) has no return type specified\\.$#"
count: 1
path: src/bundle/IbexaGraphQLBundle.php

-
message: "#^Method Ibexa\\\\Contracts\\\\GraphQL\\\\Mutation\\\\InputHandler\\\\FieldType\\\\RichText\\\\RichTextInputConverter\\:\\:convertToXml\\(\\) has parameter \\$text with no type specified\\.$#"
count: 1
Expand Down Expand Up @@ -181,12 +146,7 @@ parameters:
path: src/lib/DataLoader/RepositoryContentTypeLoader.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\DataLoader\\\\SearchContentLoader\\:\\:count\\(\\) should return int but returns int\\|null\\.$#"
count: 1
path: src/lib/DataLoader/SearchContentLoader.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\DataLoader\\\\SearchContentLoader\\:\\:find\\(\\) should return array\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Content\\> but returns array\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ValueObject\\>\\.$#"
message: "#^Method Ibexa\\\\GraphQL\\\\DataLoader\\\\SearchContentLoader\\:\\:count\\(\\) should return int but returns int\\<0, max\\>\\|null\\.$#"
count: 1
path: src/lib/DataLoader/SearchContentLoader.php

Expand All @@ -196,12 +156,7 @@ parameters:
path: src/lib/DataLoader/SearchLocationLoader.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\DataLoader\\\\SearchLocationLoader\\:\\:count\\(\\) should return int but returns int\\|null\\.$#"
count: 1
path: src/lib/DataLoader/SearchLocationLoader.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\DataLoader\\\\SearchLocationLoader\\:\\:find\\(\\) should return array\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Location\\> but returns array\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ValueObject\\>\\.$#"
message: "#^Method Ibexa\\\\GraphQL\\\\DataLoader\\\\SearchLocationLoader\\:\\:count\\(\\) should return int but returns int\\<0, max\\>\\|null\\.$#"
count: 1
path: src/lib/DataLoader/SearchLocationLoader.php

Expand Down Expand Up @@ -540,56 +495,11 @@ parameters:
count: 1
path: src/lib/Relay/NodeResolver.php

-
message: "#^Access to protected property Overblog\\\\GraphQLBundle\\\\Relay\\\\Connection\\\\Output\\\\Connection\\:\\:\\$edges\\.$#"
count: 1
path: src/lib/Relay/PageAwareConnection.php

-
message: "#^Access to protected property Overblog\\\\GraphQLBundle\\\\Relay\\\\Connection\\\\Output\\\\Connection\\:\\:\\$pageInfo\\.$#"
count: 1
path: src/lib/Relay/PageAwareConnection.php

-
message: "#^Access to protected property Overblog\\\\GraphQLBundle\\\\Relay\\\\Connection\\\\Output\\\\Connection\\:\\:\\$totalCount\\.$#"
count: 1
path: src/lib/Relay/PageAwareConnection.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Relay\\\\PageAwareConnection\\:\\:__construct\\(\\) has parameter \\$edges with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Relay/PageAwareConnection.php

-
message: "#^Parameter \\#2 \\$pageInfo of class Ibexa\\\\GraphQL\\\\Relay\\\\PageAwareConnection constructor expects Overblog\\\\GraphQLBundle\\\\Relay\\\\Connection\\\\PageInfoInterface, Overblog\\\\GraphQLBundle\\\\Relay\\\\Connection\\\\PageInfoInterface\\|null given\\.$#"
count: 1
path: src/lib/Relay/PageAwareConnection.php

-
message: "#^Property Ibexa\\\\GraphQL\\\\Relay\\\\PageAwareConnection\\:\\:\\$totalCount \\(int\\) does not accept GraphQL\\\\Executor\\\\Promise\\\\Promise\\|int\\|null\\.$#"
count: 1
path: src/lib/Relay/PageAwareConnection.php

-
message: "#^Access to an undefined property Overblog\\\\GraphQLBundle\\\\Relay\\\\Connection\\\\ConnectionInterface\\:\\:\\$sliceSize\\.$#"
count: 1
path: src/lib/Relay/SearchResolver.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Relay\\\\SearchResolver\\:\\:searchContent\\(\\) has parameter \\$args with no type specified\\.$#"
count: 1
path: src/lib/Relay/SearchResolver.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Relay\\\\SearchResolver\\:\\:searchContent\\(\\) should return Overblog\\\\GraphQLBundle\\\\Relay\\\\Connection\\\\Output\\\\Connection but returns Overblog\\\\GraphQLBundle\\\\Relay\\\\Connection\\\\ConnectionInterface\\.$#"
count: 1
path: src/lib/Relay/SearchResolver.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Relay\\\\SearchResolver\\:\\:searchContent\\(\\) should return Overblog\\\\GraphQLBundle\\\\Relay\\\\Connection\\\\Output\\\\Connection but returns null\\.$#"
count: 1
path: src/lib/Relay/SearchResolver.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Resolver\\\\ContentResolver\\:\\:findContentByType\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -980,21 +890,6 @@ parameters:
count: 1
path: src/lib/Resolver/ItemResolver.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Resolver\\\\ItemResolver\\:\\:resolveItemsOfTypeAsConnection\\(\\) should return Overblog\\\\GraphQLBundle\\\\Relay\\\\Connection\\\\Output\\\\Connection but returns GraphQL\\\\Executor\\\\Promise\\\\Promise\\|Overblog\\\\GraphQLBundle\\\\Relay\\\\Connection\\\\Output\\\\Connection\\.$#"
count: 1
path: src/lib/Resolver/ItemResolver.php

-
message: "#^Property Ibexa\\\\GraphQL\\\\Resolver\\\\ItemResolver\\:\\:\\$contentTypeLoader is never read, only written\\.$#"
count: 1
path: src/lib/Resolver/ItemResolver.php

-
message: "#^Parameter \\#1 \\$location of method Ibexa\\\\GraphQL\\\\Resolver\\\\LocationGuesser\\\\ObjectStorageLocationList\\:\\:addLocation\\(\\) expects Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Location, Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ValueObject given\\.$#"
count: 1
path: src/lib/Resolver/LocationGuesser/CurrentSiteLocationProvider.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Resolver\\\\LocationGuesser\\\\FilterLocationGuesser\\:\\:__construct\\(\\) has parameter \\$filters with no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -1065,16 +960,6 @@ parameters:
count: 1
path: src/lib/Resolver/LocationResolver.php

-
message: "#^PHPDoc tag @return with type Overblog\\\\GraphQLBundle\\\\Relay\\\\Connection\\\\Output\\\\Connection is incompatible with native type Ibexa\\\\GraphQL\\\\Relay\\\\PageAwareConnection\\.$#"
count: 1
path: src/lib/Resolver/LocationResolver.php

-
message: "#^Parameter \\#1 \\$connection of static method Ibexa\\\\GraphQL\\\\Relay\\\\PageAwareConnection\\:\\:fromConnection\\(\\) expects Overblog\\\\GraphQLBundle\\\\Relay\\\\Connection\\\\Output\\\\Connection, GraphQL\\\\Executor\\\\Promise\\\\Promise\\|Overblog\\\\GraphQLBundle\\\\Relay\\\\Connection\\\\Output\\\\Connection given\\.$#"
count: 1
path: src/lib/Resolver/LocationResolver.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Resolver\\\\ObjectStateGroupResolver\\:\\:resolveObjectStateGroups\\(\\) should return array\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ObjectState\\\\ObjectStateGroup\\> but returns iterable\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ObjectState\\\\ObjectStateGroup\\>\\.$#"
count: 1
Expand Down
4 changes: 2 additions & 2 deletions spec/Schema/Builder/SchemaBuilderSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ public function it_adds_a_field_to_an_existing_type(NameValidator $nameValidator
$this->addType($this->inputType());
$this->addFieldToType(
self::TYPE,
$this->inputField('Description', '@=resolver("myresolver")')
$this->inputField('Description', '@=query("myresolver")')
);

$schema = $this->getSchema();
$schema->shouldHaveGraphQLType();
$schema->shouldHaveGraphQLTypeField();
$schema->shouldHaveGraphQLTypeFieldWithDescription('Description');
$schema->shouldHaveGraphQLTypeFieldWithResolve('@=resolver("myresolver")');
$schema->shouldHaveGraphQLTypeFieldWithResolve('@=query("myresolver")');
}

public function it_adds_an_argument_to_an_existing_type_field(NameValidator $nameValidator)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ function it_delegates_the_field_definition_type_to_the_inner_mapper(FieldDefinit
function it_maps_multi_selection_to_resolve_multiple()
{
$fieldDefinition = $this->createFieldDefinition(self::DEF_LIMIT_MULTI);
$this->mapToFieldValueResolver($fieldDefinition)->shouldReturn('@=resolver("RelationFieldValue", [field, true])');
$this->mapToFieldValueResolver($fieldDefinition)->shouldReturn('@=query("RelationFieldValue", field, true)');
}

function it_maps_single_selection_to_resolve_single()
{
$fieldDefinition = $this->createFieldDefinition(self::DEF_LIMIT_SINGLE);
$this->mapToFieldValueResolver($fieldDefinition)->shouldReturn('@=resolver("RelationFieldValue", [field, false])');
$this->mapToFieldValueResolver($fieldDefinition)->shouldReturn('@=query("RelationFieldValue", field, false)');
}

private function createFieldDefinition($selectionLimit = 0, $selectionContentTypes = [])
Expand Down
3 changes: 0 additions & 3 deletions src/bundle/DependencyInjection/GraphQL/YamlSchemaProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

namespace Ibexa\Bundle\GraphQL\DependencyInjection\GraphQL;

use Ibexa\GraphQL\Resolver\Map\UploadMap;

/**
* Provides schema definitions.
*/
Expand Down Expand Up @@ -37,7 +35,6 @@ public function getSchemaConfiguration()
return [
'query' => $this->getQuerySchema(),
'mutation' => $this->getMutationSchema(),
'resolver_maps' => [UploadMap::class],
'types' => ['UntypedContent'],
];
}
Expand Down
2 changes: 1 addition & 1 deletion src/bundle/Resources/config/default_settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ parameters:
input_type: ImageFieldInput
ezimageasset:
value_type: ImageFieldValue
value_resolver: 'resolver("DomainImageAssetFieldValue", [field])'
value_resolver: 'query("DomainImageAssetFieldValue", field)'
ezinteger:
definition_type: IntegerFieldDefinition
value_type: Int
Expand Down
2 changes: 1 addition & 1 deletion src/bundle/Resources/config/graphql/Base.types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ DateTime:
format:
type: String
description: "Date formatted with a date() format"
resolve: "@=resolver('DateTimeFormat', [value, args])"
resolve: "@=query('DateTimeFormat', value, args)"
args:
pattern:
type: "String"
Expand Down
20 changes: 10 additions & 10 deletions src/bundle/Resources/config/graphql/Content.types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ Content:
contentType:
type: "ContentType"
description: "The content type of the Content item."
resolve: "@=resolver('ContentTypeById', [value.contentTypeId])"
resolve: "@=query('ContentTypeById', value.contentTypeId)"
name:
type: "String"
description: "The computed name (via name schema) in the main language of the Content item."
section:
type: "Section"
description: "The section to which the Content object is assigned."
resolve: "@=resolver('SectionById', [value.sectionId])"
resolve: "@=query('SectionById', value.sectionId)"
currentVersionNo:
type: "Int"
description: "Version number of the published version, or 1 for a newly created draft."
currentVersion:
type: "Version"
description: "The currently published version"
resolve: "@=resolver('CurrentVersion', [value])"
resolve: "@=query('CurrentVersion', value)"
versions:
type: "[Version]"
description: "All content versions."
resolve: "@=resolver('ContentVersions', [value.id])"
resolve: "@=query('ContentVersions', value.id)"
published:
type: "Boolean"
description: "If the Content item has a published version."
Expand All @@ -40,7 +40,7 @@ Content:
owner:
type: "User"
description: "The owner user of the Content object"
resolve: "@=resolver('UserById', [value.ownerId])"
resolve: "@=query('UserById', value.ownerId)"
modificationDate:
type: DateTime
description: "Date the Content item was last modified on."
Expand All @@ -62,23 +62,23 @@ Content:
mainLocation:
type: "Location"
description: "Content item's main location."
resolve: "@=resolver('LocationById', [value.mainLocationId])"
resolve: "@=query('LocationById', value.mainLocationId)"
locations:
type: "[Location]"
description: "All the locations of the Content item"
resolve: "@=resolver('LocationsByContentId', [value.id])"
resolve: "@=query('LocationsByContentId', value.id)"
relations:
type: "[ContentRelation]"
description: "Relations from this Content"
resolve: "@=resolver('ContentRelations', [value])"
resolve: "@=query('ContentRelations', value)"
reverseRelations:
type: "[ContentRelation]"
description: "Relations to this Content"
resolve: "@=resolver('ContentReverseRelations', [value])"
resolve: "@=query('ContentReverseRelations', value)"
states:
type: "[ObjectState]"
description: "Content States."
resolve: "@=resolver('ObjectStateByContentInfo', [value])"
resolve: "@=query('ObjectStateByContentInfo', value)"

ContentRelation:
type: "object"
Expand Down
8 changes: 4 additions & 4 deletions src/bundle/Resources/config/graphql/ContentType.types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ ContentType:
creator:
type: "User"
description: "The user who created this content type."
resolve: "@=resolver('UserById', [value.creatorId])"
resolve: "@=query('UserById', value.creatorId)"
modifierId:
type: "Int"
description: "The user id of the user which has last modified this content type"
modifier:
type: "User"
description: "The user which has last modified this content type"
resolve: "@=resolver('UserById', [value.modifierId])"
resolve: "@=query('UserById', value.modifierId)"
remoteId:
type: "String"
description: "A global unique id of the content type."
Expand Down Expand Up @@ -99,12 +99,12 @@ ContentTypeGroup:
type: "Int"
creator:
type: "User"
resolve: "@=resolver('UserById', [value.creatorId])"
resolve: "@=query('UserById', value.creatorId)"
modifierId:
type: "Int"
modifier:
type: "User"
resolve: "@=resolver('UserById', [value.modifierId])"
resolve: "@=query('UserById', value.modifierId)"
contentTypes:
type: "[ContentType]"
resolve: "@=query('ContentTypesFromGroup', {'groupId': value.id})"
Expand Down
Loading

0 comments on commit eb1ec22

Please sign in to comment.