diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index a49ab96840..6b08a18e76 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -8316,6 +8316,12 @@ parameters: count: 1 path: src/contracts/Repository/Values/Content/Location.php + - + message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location\:\:\$pathString \(string\) on left side of \?\? is not nullable\.$#' + identifier: nullCoalesce.property + count: 1 + path: src/contracts/Repository/Values/Content/Location.php + - message: '#^Class Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\LocationList implements generic interface IteratorAggregate but does not specify its types\: TKey, TValue$#' identifier: missingType.generics @@ -24414,6 +24420,18 @@ parameters: count: 1 path: src/lib/Repository/LocationService.php + - + message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentType\:\:\$defaultSortField \(int\) on left side of \?\? is not nullable\.$#' + identifier: nullCoalesce.property + count: 1 + path: src/lib/Repository/LocationService.php + + - + message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentType\:\:\$defaultSortOrder \(int\) on left side of \?\? is not nullable\.$#' + identifier: nullCoalesce.property + count: 1 + path: src/lib/Repository/LocationService.php + - message: '#^Property Ibexa\\Core\\Repository\\LocationService\:\:\$repository \(Ibexa\\Core\\Repository\\Repository\) does not accept Ibexa\\Contracts\\Core\\Repository\\Repository\.$#' identifier: assign.propertyType @@ -25884,12 +25902,6 @@ parameters: count: 1 path: src/lib/Repository/Values/Content/Content.php - - - message: '#^Cannot access offset mixed on Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Field\.$#' - identifier: offsetAccess.nonOffsetAccessible - count: 1 - path: src/lib/Repository/Values/Content/Content.php - - message: '#^Method Ibexa\\Core\\Repository\\Values\\Content\\Content\:\:__construct\(\) has parameter \$data with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -74178,12 +74190,24 @@ parameters: count: 1 path: tests/lib/Repository/Values/Content/LocationTest.php + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) with true will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: tests/lib/Repository/Values/Content/LocationTest.php + - message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\Content\\LocationTest\:\:assertPropertiesCorrect\(\) has no return type specified\.$#' identifier: missingType.return count: 1 path: tests/lib/Repository/Values/Content/LocationTest.php + - + message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location\:\:\$id \(int\) in isset\(\) is not nullable\.$#' + identifier: isset.property + count: 1 + path: tests/lib/Repository/Values/Content/LocationTest.php + - message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\Content\\Query\\Aggregation\\RangeTest\:\:dataProviderForTestToString\(\) return type has no value type specified in iterable type iterable\.$#' identifier: missingType.iterableValue @@ -74244,6 +74268,12 @@ parameters: count: 1 path: tests/lib/Repository/Values/Content/TrashItemTest.php + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) with true will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: tests/lib/Repository/Values/Content/TrashItemTest.php + - message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\Content\\TrashItemTest\:\:assertPropertiesCorrect\(\) has no return type specified\.$#' identifier: missingType.return @@ -74280,6 +74310,12 @@ parameters: count: 1 path: tests/lib/Repository/Values/Content/TrashItemTest.php + - + message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Location\:\:\$id \(int\) in isset\(\) is not nullable\.$#' + identifier: isset.property + count: 1 + path: tests/lib/Repository/Values/Content/TrashItemTest.php + - message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\ContentType\\ContentTypeDraftTest\:\:testObjectProperties\(\) has no return type specified\.$#' identifier: missingType.return @@ -74358,6 +74394,12 @@ parameters: count: 1 path: tests/lib/Repository/Values/ObjectState/ObjectStateGroupTest.php + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) with true will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: tests/lib/Repository/Values/ObjectState/ObjectStateGroupTest.php + - message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\ObjectState\\ObjectStateGroupTest\:\:assertPropertiesCorrect\(\) has no return type specified\.$#' identifier: missingType.return @@ -74418,6 +74460,12 @@ parameters: count: 1 path: tests/lib/Repository/Values/ObjectState/ObjectStateGroupTest.php + - + message: '#^Property Ibexa\\Core\\Repository\\Values\\ObjectState\\ObjectStateGroup\:\:\$defaultLanguageCode \(string\) in isset\(\) is not nullable\.$#' + identifier: isset.property + count: 1 + path: tests/lib/Repository/Values/ObjectState/ObjectStateGroupTest.php + - message: '#^Access to an undefined property Ibexa\\Core\\Repository\\Values\\ObjectState\\ObjectState\:\:\$notDefined\.$#' identifier: property.notFound @@ -74532,6 +74580,12 @@ parameters: count: 1 path: tests/lib/Repository/Values/User/RoleTest.php + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) with true will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: tests/lib/Repository/Values/User/RoleTest.php + - message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\User\\RoleTest\:\:assertPropertiesCorrect\(\) has no return type specified\.$#' identifier: missingType.return @@ -74568,6 +74622,12 @@ parameters: count: 1 path: tests/lib/Repository/Values/User/RoleTest.php + - + message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\User\\Role\:\:\$id \(int\) in isset\(\) is not nullable\.$#' + identifier: isset.property + count: 1 + path: tests/lib/Repository/Values/User/RoleTest.php + - message: '#^Access to an undefined property Ibexa\\Core\\Repository\\Values\\User\\UserGroup\:\:\$notDefined\.$#' identifier: property.notFound @@ -74628,6 +74688,12 @@ parameters: count: 1 path: tests/lib/Repository/Values/User/UserTest.php + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) with true will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: tests/lib/Repository/Values/User/UserTest.php + - message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\User\\UserTest\:\:assertPropertiesCorrect\(\) has no return type specified\.$#' identifier: missingType.return @@ -74676,6 +74742,12 @@ parameters: count: 1 path: tests/lib/Repository/Values/User/UserTest.php + - + message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\User\\User\:\:\$login \(string\) in isset\(\) is not nullable\.$#' + identifier: isset.property + count: 1 + path: tests/lib/Repository/Values/User/UserTest.php + - message: '#^Method Ibexa\\Tests\\Core\\Search\\Common\\FieldValueMapper\\RemoteIdentifierMapperTest\:\:getDataForTestCanMap\(\) return type has no value type specified in iterable type iterable\.$#' identifier: missingType.iterableValue diff --git a/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/SiteAccessGroupConfigResolver.php b/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/SiteAccessGroupConfigResolver.php index f763914a19..bb481f7eca 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/SiteAccessGroupConfigResolver.php +++ b/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/SiteAccessGroupConfigResolver.php @@ -11,6 +11,7 @@ use Ibexa\Core\MVC\Exception\ParameterNotFoundException; use Ibexa\Core\MVC\Symfony\SiteAccess; use Ibexa\Core\MVC\Symfony\SiteAccessGroup; +use LogicException; use Symfony\Component\DependencyInjection\ContainerAwareTrait; /** @@ -58,6 +59,10 @@ final public function getParameter(string $paramName, ?string $namespace = null, protected function resolverHasParameter(SiteAccess $siteAccess, string $paramName, string $namespace): bool { + if ($this->container === null) { + throw new LogicException('Container is not set.'); + } + foreach ($siteAccess->groups as $group) { $groupScopeParamName = $this->resolveScopeRelativeParamName($paramName, $namespace, $group->getName()); if ($this->container->hasParameter($groupScopeParamName)) { @@ -70,6 +75,10 @@ protected function resolverHasParameter(SiteAccess $siteAccess, string $paramNam protected function resolverHasParameterForGroup(SiteAccessGroup $siteAccessGroup, string $paramName, string $namespace): bool { + if ($this->container === null) { + throw new LogicException('Container is not set.'); + } + $groupScopeParamName = $this->resolveScopeRelativeParamName($paramName, $namespace, $siteAccessGroup->getName()); return $this->container->hasParameter($groupScopeParamName); @@ -77,6 +86,10 @@ protected function resolverHasParameterForGroup(SiteAccessGroup $siteAccessGroup protected function getParameterFromResolver(SiteAccess $siteAccess, string $paramName, string $namespace) { + if ($this->container === null) { + throw new LogicException('Container is not set.'); + } + $triedScopes = []; foreach ($siteAccess->groups as $group) { @@ -93,6 +106,10 @@ protected function getParameterFromResolver(SiteAccess $siteAccess, string $para protected function getParameterFromResolverForGroup(SiteAccessGroup $siteAccessGroup, string $paramName, string $namespace) { + if ($this->container === null) { + throw new LogicException('Container is not set.'); + } + $groupScopeParamName = $this->resolveScopeRelativeParamName($paramName, $namespace, $siteAccessGroup->getName()); if (!$this->container->hasParameter($groupScopeParamName)) { diff --git a/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/StaticSiteAccessConfigResolver.php b/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/StaticSiteAccessConfigResolver.php index ea39515a54..95cb51c281 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/StaticSiteAccessConfigResolver.php +++ b/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/StaticSiteAccessConfigResolver.php @@ -11,6 +11,7 @@ use Ibexa\Core\MVC\Exception\ParameterNotFoundException; use Ibexa\Core\MVC\Symfony\SiteAccess; use Ibexa\Core\MVC\Symfony\SiteAccess\Provider\StaticSiteAccessProvider; +use LogicException; use Symfony\Component\DependencyInjection\ContainerAwareTrait; /** @@ -24,6 +25,10 @@ class StaticSiteAccessConfigResolver extends SiteAccessConfigResolver protected function resolverHasParameter(SiteAccess $siteAccess, string $paramName, string $namespace): bool { + if ($this->container === null) { + throw new LogicException('Container is not set.'); + } + return $this->container->hasParameter( $this->resolveScopeRelativeParamName($paramName, $namespace, $siteAccess->name) ); @@ -31,6 +36,10 @@ protected function resolverHasParameter(SiteAccess $siteAccess, string $paramNam protected function getParameterFromResolver(SiteAccess $siteAccess, string $paramName, string $namespace) { + if ($this->container === null) { + throw new LogicException('Container is not set.'); + } + $scopeRelativeParamName = $this->getScopeRelativeParamName($paramName, $namespace, $siteAccess->name); if ($this->container->hasParameter($scopeRelativeParamName)) { return $this->container->getParameter($scopeRelativeParamName); diff --git a/src/lib/FieldType/BinaryBase/Value.php b/src/lib/FieldType/BinaryBase/Value.php index e3b1608e9f..f3a1a69b6b 100644 --- a/src/lib/FieldType/BinaryBase/Value.php +++ b/src/lib/FieldType/BinaryBase/Value.php @@ -12,7 +12,7 @@ * Base value for binary field types. * * @property string $path Used for BC with 5.0 (EZP-20948). Equivalent to $id. - * @property-read string $id Unique file ID, set by storage. Read only since 5.3 (EZP-22808). + * @property-read string|null $id Unique file ID, set by storage. Read only since 5.3 (EZP-22808). */ abstract class Value extends BaseValue {