Skip to content

Commit 2ba7fdf

Browse files
authored
[CI] Fixed PHPStan issues (#654)
1 parent 024b97d commit 2ba7fdf

File tree

4 files changed

+105
-7
lines changed

4 files changed

+105
-7
lines changed

phpstan-baseline.neon

Lines changed: 78 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8316,6 +8316,12 @@ parameters:
83168316
count: 1
83178317
path: src/contracts/Repository/Values/Content/Location.php
83188318

8319+
-
8320+
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location\:\:\$pathString \(string\) on left side of \?\? is not nullable\.$#'
8321+
identifier: nullCoalesce.property
8322+
count: 1
8323+
path: src/contracts/Repository/Values/Content/Location.php
8324+
83198325
-
83208326
message: '#^Class Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\LocationList implements generic interface IteratorAggregate but does not specify its types\: TKey, TValue$#'
83218327
identifier: missingType.generics
@@ -24414,6 +24420,18 @@ parameters:
2441424420
count: 1
2441524421
path: src/lib/Repository/LocationService.php
2441624422

24423+
-
24424+
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentType\:\:\$defaultSortField \(int\) on left side of \?\? is not nullable\.$#'
24425+
identifier: nullCoalesce.property
24426+
count: 1
24427+
path: src/lib/Repository/LocationService.php
24428+
24429+
-
24430+
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentType\:\:\$defaultSortOrder \(int\) on left side of \?\? is not nullable\.$#'
24431+
identifier: nullCoalesce.property
24432+
count: 1
24433+
path: src/lib/Repository/LocationService.php
24434+
2441724435
-
2441824436
message: '#^Property Ibexa\\Core\\Repository\\LocationService\:\:\$repository \(Ibexa\\Core\\Repository\\Repository\) does not accept Ibexa\\Contracts\\Core\\Repository\\Repository\.$#'
2441924437
identifier: assign.propertyType
@@ -25884,12 +25902,6 @@ parameters:
2588425902
count: 1
2588525903
path: src/lib/Repository/Values/Content/Content.php
2588625904

25887-
-
25888-
message: '#^Cannot access offset mixed on Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Field\.$#'
25889-
identifier: offsetAccess.nonOffsetAccessible
25890-
count: 1
25891-
path: src/lib/Repository/Values/Content/Content.php
25892-
2589325905
-
2589425906
message: '#^Method Ibexa\\Core\\Repository\\Values\\Content\\Content\:\:__construct\(\) has parameter \$data with no value type specified in iterable type array\.$#'
2589525907
identifier: missingType.iterableValue
@@ -74178,12 +74190,24 @@ parameters:
7417874190
count: 1
7417974191
path: tests/lib/Repository/Values/Content/LocationTest.php
7418074192

74193+
-
74194+
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) with true will always evaluate to true\.$#'
74195+
identifier: staticMethod.alreadyNarrowedType
74196+
count: 1
74197+
path: tests/lib/Repository/Values/Content/LocationTest.php
74198+
7418174199
-
7418274200
message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\Content\\LocationTest\:\:assertPropertiesCorrect\(\) has no return type specified\.$#'
7418374201
identifier: missingType.return
7418474202
count: 1
7418574203
path: tests/lib/Repository/Values/Content/LocationTest.php
7418674204

74205+
-
74206+
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location\:\:\$id \(int\) in isset\(\) is not nullable\.$#'
74207+
identifier: isset.property
74208+
count: 1
74209+
path: tests/lib/Repository/Values/Content/LocationTest.php
74210+
7418774211
-
7418874212
message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\Content\\Query\\Aggregation\\RangeTest\:\:dataProviderForTestToString\(\) return type has no value type specified in iterable type iterable\.$#'
7418974213
identifier: missingType.iterableValue
@@ -74244,6 +74268,12 @@ parameters:
7424474268
count: 1
7424574269
path: tests/lib/Repository/Values/Content/TrashItemTest.php
7424674270

74271+
-
74272+
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) with true will always evaluate to true\.$#'
74273+
identifier: staticMethod.alreadyNarrowedType
74274+
count: 1
74275+
path: tests/lib/Repository/Values/Content/TrashItemTest.php
74276+
7424774277
-
7424874278
message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\Content\\TrashItemTest\:\:assertPropertiesCorrect\(\) has no return type specified\.$#'
7424974279
identifier: missingType.return
@@ -74280,6 +74310,12 @@ parameters:
7428074310
count: 1
7428174311
path: tests/lib/Repository/Values/Content/TrashItemTest.php
7428274312

74313+
-
74314+
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location\:\:\$id \(int\) in isset\(\) is not nullable\.$#'
74315+
identifier: isset.property
74316+
count: 1
74317+
path: tests/lib/Repository/Values/Content/TrashItemTest.php
74318+
7428374319
-
7428474320
message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\ContentType\\ContentTypeDraftTest\:\:testObjectProperties\(\) has no return type specified\.$#'
7428574321
identifier: missingType.return
@@ -74358,6 +74394,12 @@ parameters:
7435874394
count: 1
7435974395
path: tests/lib/Repository/Values/ObjectState/ObjectStateGroupTest.php
7436074396

74397+
-
74398+
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) with true will always evaluate to true\.$#'
74399+
identifier: staticMethod.alreadyNarrowedType
74400+
count: 1
74401+
path: tests/lib/Repository/Values/ObjectState/ObjectStateGroupTest.php
74402+
7436174403
-
7436274404
message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\ObjectState\\ObjectStateGroupTest\:\:assertPropertiesCorrect\(\) has no return type specified\.$#'
7436374405
identifier: missingType.return
@@ -74418,6 +74460,12 @@ parameters:
7441874460
count: 1
7441974461
path: tests/lib/Repository/Values/ObjectState/ObjectStateGroupTest.php
7442074462

74463+
-
74464+
message: '#^Property Ibexa\\Core\\Repository\\Values\\ObjectState\\ObjectStateGroup\:\:\$defaultLanguageCode \(string\) in isset\(\) is not nullable\.$#'
74465+
identifier: isset.property
74466+
count: 1
74467+
path: tests/lib/Repository/Values/ObjectState/ObjectStateGroupTest.php
74468+
7442174469
-
7442274470
message: '#^Access to an undefined property Ibexa\\Core\\Repository\\Values\\ObjectState\\ObjectState\:\:\$notDefined\.$#'
7442374471
identifier: property.notFound
@@ -74532,6 +74580,12 @@ parameters:
7453274580
count: 1
7453374581
path: tests/lib/Repository/Values/User/RoleTest.php
7453474582

74583+
-
74584+
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) with true will always evaluate to true\.$#'
74585+
identifier: staticMethod.alreadyNarrowedType
74586+
count: 1
74587+
path: tests/lib/Repository/Values/User/RoleTest.php
74588+
7453574589
-
7453674590
message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\User\\RoleTest\:\:assertPropertiesCorrect\(\) has no return type specified\.$#'
7453774591
identifier: missingType.return
@@ -74568,6 +74622,12 @@ parameters:
7456874622
count: 1
7456974623
path: tests/lib/Repository/Values/User/RoleTest.php
7457074624

74625+
-
74626+
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\User\\Role\:\:\$id \(int\) in isset\(\) is not nullable\.$#'
74627+
identifier: isset.property
74628+
count: 1
74629+
path: tests/lib/Repository/Values/User/RoleTest.php
74630+
7457174631
-
7457274632
message: '#^Access to an undefined property Ibexa\\Core\\Repository\\Values\\User\\UserGroup\:\:\$notDefined\.$#'
7457374633
identifier: property.notFound
@@ -74628,6 +74688,12 @@ parameters:
7462874688
count: 1
7462974689
path: tests/lib/Repository/Values/User/UserTest.php
7463074690

74691+
-
74692+
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) with true will always evaluate to true\.$#'
74693+
identifier: staticMethod.alreadyNarrowedType
74694+
count: 1
74695+
path: tests/lib/Repository/Values/User/UserTest.php
74696+
7463174697
-
7463274698
message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\User\\UserTest\:\:assertPropertiesCorrect\(\) has no return type specified\.$#'
7463374699
identifier: missingType.return
@@ -74676,6 +74742,12 @@ parameters:
7467674742
count: 1
7467774743
path: tests/lib/Repository/Values/User/UserTest.php
7467874744

74745+
-
74746+
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\User\\User\:\:\$login \(string\) in isset\(\) is not nullable\.$#'
74747+
identifier: isset.property
74748+
count: 1
74749+
path: tests/lib/Repository/Values/User/UserTest.php
74750+
7467974751
-
7468074752
message: '#^Method Ibexa\\Tests\\Core\\Search\\Common\\FieldValueMapper\\RemoteIdentifierMapperTest\:\:getDataForTestCanMap\(\) return type has no value type specified in iterable type iterable\.$#'
7468174753
identifier: missingType.iterableValue

src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/SiteAccessGroupConfigResolver.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Ibexa\Core\MVC\Exception\ParameterNotFoundException;
1212
use Ibexa\Core\MVC\Symfony\SiteAccess;
1313
use Ibexa\Core\MVC\Symfony\SiteAccessGroup;
14+
use LogicException;
1415
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
1516

1617
/**
@@ -58,6 +59,10 @@ final public function getParameter(string $paramName, ?string $namespace = null,
5859

5960
protected function resolverHasParameter(SiteAccess $siteAccess, string $paramName, string $namespace): bool
6061
{
62+
if ($this->container === null) {
63+
throw new LogicException('Container is not set.');
64+
}
65+
6166
foreach ($siteAccess->groups as $group) {
6267
$groupScopeParamName = $this->resolveScopeRelativeParamName($paramName, $namespace, $group->getName());
6368
if ($this->container->hasParameter($groupScopeParamName)) {
@@ -70,13 +75,21 @@ protected function resolverHasParameter(SiteAccess $siteAccess, string $paramNam
7075

7176
protected function resolverHasParameterForGroup(SiteAccessGroup $siteAccessGroup, string $paramName, string $namespace): bool
7277
{
78+
if ($this->container === null) {
79+
throw new LogicException('Container is not set.');
80+
}
81+
7382
$groupScopeParamName = $this->resolveScopeRelativeParamName($paramName, $namespace, $siteAccessGroup->getName());
7483

7584
return $this->container->hasParameter($groupScopeParamName);
7685
}
7786

7887
protected function getParameterFromResolver(SiteAccess $siteAccess, string $paramName, string $namespace)
7988
{
89+
if ($this->container === null) {
90+
throw new LogicException('Container is not set.');
91+
}
92+
8093
$triedScopes = [];
8194

8295
foreach ($siteAccess->groups as $group) {
@@ -93,6 +106,10 @@ protected function getParameterFromResolver(SiteAccess $siteAccess, string $para
93106

94107
protected function getParameterFromResolverForGroup(SiteAccessGroup $siteAccessGroup, string $paramName, string $namespace)
95108
{
109+
if ($this->container === null) {
110+
throw new LogicException('Container is not set.');
111+
}
112+
96113
$groupScopeParamName = $this->resolveScopeRelativeParamName($paramName, $namespace, $siteAccessGroup->getName());
97114

98115
if (!$this->container->hasParameter($groupScopeParamName)) {

src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/StaticSiteAccessConfigResolver.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Ibexa\Core\MVC\Exception\ParameterNotFoundException;
1212
use Ibexa\Core\MVC\Symfony\SiteAccess;
1313
use Ibexa\Core\MVC\Symfony\SiteAccess\Provider\StaticSiteAccessProvider;
14+
use LogicException;
1415
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
1516

1617
/**
@@ -24,13 +25,21 @@ class StaticSiteAccessConfigResolver extends SiteAccessConfigResolver
2425

2526
protected function resolverHasParameter(SiteAccess $siteAccess, string $paramName, string $namespace): bool
2627
{
28+
if ($this->container === null) {
29+
throw new LogicException('Container is not set.');
30+
}
31+
2732
return $this->container->hasParameter(
2833
$this->resolveScopeRelativeParamName($paramName, $namespace, $siteAccess->name)
2934
);
3035
}
3136

3237
protected function getParameterFromResolver(SiteAccess $siteAccess, string $paramName, string $namespace)
3338
{
39+
if ($this->container === null) {
40+
throw new LogicException('Container is not set.');
41+
}
42+
3443
$scopeRelativeParamName = $this->getScopeRelativeParamName($paramName, $namespace, $siteAccess->name);
3544
if ($this->container->hasParameter($scopeRelativeParamName)) {
3645
return $this->container->getParameter($scopeRelativeParamName);

src/lib/FieldType/BinaryBase/Value.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Base value for binary field types.
1313
*
1414
* @property string $path Used for BC with 5.0 (EZP-20948). Equivalent to $id.
15-
* @property-read string $id Unique file ID, set by storage. Read only since 5.3 (EZP-22808).
15+
* @property-read string|null $id Unique file ID, set by storage. Read only since 5.3 (EZP-22808).
1616
*/
1717
abstract class Value extends BaseValue
1818
{

0 commit comments

Comments
 (0)