Skip to content

Commit acedc98

Browse files
committed
IBX-9727: Added type-hints and adapted codebase to PHP8+ within contracts
1 parent 361c060 commit acedc98

File tree

4 files changed

+25
-31
lines changed

4 files changed

+25
-31
lines changed

dependencies.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

phpstan-baseline.neon

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,18 +1086,6 @@ parameters:
10861086
count: 1
10871087
path: src/bundle/Controller/URLWildcardController.php
10881088

1089-
-
1090-
message: '#^Parameter \#1 \$locationIds of method Ibexa\\Contracts\\AdminUi\\UniversalDiscovery\\Provider\:\:getLocations\(\) expects array\<int\>, list\<string\> given\.$#'
1091-
identifier: argument.type
1092-
count: 1
1093-
path: src/bundle/Controller/UniversalDiscoveryController.php
1094-
1095-
-
1096-
message: '#^Parameter \#1 \$locationList of class Ibexa\\AdminUi\\REST\\Value\\UniversalDiscovery\\LocationListData constructor expects array\<array\{location\: Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location, permissions\: array\{create\: array\{hasAccess\: bool, restrictedContentTypeIds\: array\<int\>, restrictedLanguageCodes\: array\<string\>\}, edit\: array\{hasAccess\: bool, restrictedContentTypeIds\: array\<int\>, restrictedLanguageCodes\: array\<string\>\}\}\}\>, array\<Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location\> given\.$#'
1097-
identifier: argument.type
1098-
count: 1
1099-
path: src/bundle/Controller/UniversalDiscoveryController.php
1100-
11011089
-
11021090
message: '#^Cannot access property \$languageCode on Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Language\|null\.$#'
11031091
identifier: property.nonObject
@@ -8707,7 +8695,7 @@ parameters:
87078695
path: src/lib/UniversalDiscovery/UniversalDiscoveryProvider.php
87088696

87098697
-
8710-
message: '#^Method Ibexa\\AdminUi\\UniversalDiscovery\\UniversalDiscoveryProvider\:\:getLocations\(\) should return array\<Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location\> but returns list\<array\<string, array\<string, mixed\>\|Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location\>\>\.$#'
8698+
message: '#^Method Ibexa\\AdminUi\\UniversalDiscovery\\UniversalDiscoveryProvider\:\:getLocations\(\) should return array\<array\{location\: Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location, permissions\: array\{create\: array\{hasAccess\: bool, restrictedContentTypeIds\: array\<int\>, restrictedLanguageCodes\: array\<string\>\}, edit\: array\{hasAccess\: bool, restrictedContentTypeIds\: array\<int\>, restrictedLanguageCodes\: array\<string\>\}\}\}\> but returns list\<array\{location\: Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location, permissions\: array\<string, mixed\>\}\>\.$#'
87118699
identifier: return.type
87128700
count: 1
87138701
path: src/lib/UniversalDiscovery/UniversalDiscoveryProvider.php
@@ -8760,6 +8748,12 @@ parameters:
87608748
count: 1
87618749
path: src/lib/UniversalDiscovery/UniversalDiscoveryProvider.php
87628750

8751+
-
8752+
message: '#^Parameter \#1 \$value of class Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Query\\Criterion\\LocationId constructor expects array\<int\>\|int, list\<string\> given\.$#'
8753+
identifier: argument.type
8754+
count: 1
8755+
path: src/lib/UniversalDiscovery/UniversalDiscoveryProvider.php
8756+
87638757
-
87648758
message: '#^Parameter \#2 \$locations of method Ibexa\\AdminUi\\UniversalDiscovery\\UniversalDiscoveryProvider\:\:moveSelectedLocationOnTop\(\) expects array, Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location given\.$#'
87658759
identifier: argument.type

src/bundle/Controller/UniversalDiscoveryController.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@
1616
use Ibexa\Rest\Server\Controller;
1717
use Symfony\Component\HttpFoundation\Request;
1818

19-
class UniversalDiscoveryController extends Controller
19+
final class UniversalDiscoveryController extends Controller
2020
{
21-
private Provider $provider;
22-
2321
public function __construct(
24-
Provider $provider
22+
private readonly Provider $provider
2523
) {
26-
$this->provider = $provider;
2724
}
2825

2926
public function locationsAction(Request $request): LocationListData

src/contracts/UniversalDiscovery/Provider.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,23 @@ public function getLocationGridViewData(
8383
): array;
8484

8585
/**
86-
* @param int[] $locationIds
86+
* @param list<string> $locationIds
8787
*
88-
* @return \Ibexa\Contracts\Core\Repository\Values\Content\Location[]
88+
* @return array<array{
89+
* location: \Ibexa\Contracts\Core\Repository\Values\Content\Location,
90+
* permissions: array{
91+
* create: array{
92+
* hasAccess: bool,
93+
* restrictedContentTypeIds: array<int>,
94+
* restrictedLanguageCodes: array<string>
95+
* },
96+
* edit: array{
97+
* hasAccess: bool,
98+
* restrictedContentTypeIds: array<int>,
99+
* restrictedLanguageCodes: array<string>
100+
* }
101+
* }
102+
* }>
89103
*/
90104
public function getLocations(array $locationIds): array;
91105

0 commit comments

Comments
 (0)