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
182 changes: 1 addition & 181 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,6 @@ parameters:
count: 1
path: src/bundle/Core/ApiLoader/CacheFactory.php

-
message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\ApiLoader\\\\RepositoryConfigurationProvider\\:\\:__construct\\(\\) has parameter \\$repositories with no value type specified in iterable type array\\.$#"
count: 1
path: src/bundle/Core/ApiLoader/RepositoryConfigurationProvider.php

-
message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\ApiLoader\\\\RepositoryConfigurationProvider\\:\\:getDefaultRepositoryAlias\\(\\) should return string\\|null but returns int\\|string\\|null\\.$#"
count: 1
path: src/bundle/Core/ApiLoader/RepositoryConfigurationProvider.php

-
message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\ApiLoader\\\\RepositoryConfigurationProvider\\:\\:getRepositoryConfig\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/bundle/Core/ApiLoader/RepositoryConfigurationProvider.php

-
message: "#^Property Ibexa\\\\Bundle\\\\Core\\\\ApiLoader\\\\RepositoryConfigurationProvider\\:\\:\\$repositories type has no value type specified in iterable type array\\.$#"
count: 1
path: src/bundle/Core/ApiLoader/RepositoryConfigurationProvider.php

-
message: "#^Cannot call method get\\(\\) on Symfony\\\\Component\\\\DependencyInjection\\\\ContainerInterface\\|null\\.$#"
count: 1
path: src/bundle/Core/ApiLoader/RepositoryFactory.php

-
message: "#^Cannot call method getRepositoryConfig\\(\\) on object\\|null\\.$#"
count: 1
path: src/bundle/Core/ApiLoader/RepositoryFactory.php

-
message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\ApiLoader\\\\RepositoryFactory\\:\\:__construct\\(\\) has parameter \\$policyMap with no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -65,36 +35,6 @@ parameters:
count: 1
path: src/bundle/Core/ApiLoader/SearchEngineIndexerFactory.php

-
message: "#^Cannot call method get\\(\\) on Symfony\\\\Component\\\\DependencyInjection\\\\ContainerInterface\\|null\\.$#"
count: 1
path: src/bundle/Core/ApiLoader/StorageConnectionFactory.php

-
message: "#^Cannot call method getParameter\\(\\) on Symfony\\\\Component\\\\DependencyInjection\\\\ContainerInterface\\|null\\.$#"
count: 1
path: src/bundle/Core/ApiLoader/StorageConnectionFactory.php

-
message: "#^Cannot call method has\\(\\) on Symfony\\\\Component\\\\DependencyInjection\\\\ContainerInterface\\|null\\.$#"
count: 1
path: src/bundle/Core/ApiLoader/StorageConnectionFactory.php

-
message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\ApiLoader\\\\StorageConnectionFactory\\:\\:getConnection\\(\\) should return Doctrine\\\\DBAL\\\\Connection but returns object\\|null\\.$#"
count: 1
path: src/bundle/Core/ApiLoader/StorageConnectionFactory.php

-
message: "#^Parameter \\#1 \\$array of function array_keys expects array, array\\|bool\\|float\\|int\\|string\\|null given\\.$#"
count: 1
path: src/bundle/Core/ApiLoader/StorageConnectionFactory.php

-
message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\ApiLoader\\\\StorageEngineFactory\\:\\:registerStorageEngine\\(\\) has no return type specified\\.$#"
count: 1
path: src/bundle/Core/ApiLoader/StorageEngineFactory.php

-
message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\Cache\\\\Warmer\\\\ProxyCacheWarmer\\:\\:warmUp\\(\\) has parameter \\$cacheDir with no type specified\\.$#"
count: 1
Expand All @@ -110,11 +50,6 @@ parameters:
count: 1
path: src/bundle/Core/Command/CheckURLsCommand.php

-
message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Driver\\\\Connection\\:\\:createQueryBuilder\\(\\)\\.$#"
count: 1
path: src/bundle/Core/Command/CleanupVersionsCommand.php

-
message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\Command\\\\CleanupVersionsCommand\\:\\:configure\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -10840,11 +10775,6 @@ parameters:
count: 1
path: src/lib/Helper/FieldsGroups/FieldsGroupsList.php

-
message: "#^Method Ibexa\\\\Core\\\\Helper\\\\FieldsGroups\\\\RepositoryConfigFieldsGroupsListFactory\\:\\:build\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Helper/FieldsGroups/RepositoryConfigFieldsGroupsListFactory.php

-
message: "#^Method Ibexa\\\\Core\\\\Helper\\\\TranslationHelper\\:\\:__construct\\(\\) has parameter \\$siteAccessesByLanguage with no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -19721,7 +19651,7 @@ parameters:
path: src/lib/Persistence/Utf8Converter.php

-
message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Utf8Converter\\:\\:toUnicodeCodepoint\\(\\) should return int but returns int\\<0, max\\>\\|false\\.$#"
message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Utf8Converter\\:\\:toUnicodeCodepoint\\(\\) should return int but returns int\\<0, 2147483647\\>\\|false\\.$#"
count: 1
path: src/lib/Persistence/Utf8Converter.php

Expand Down Expand Up @@ -23200,96 +23130,6 @@ parameters:
count: 1
path: tests/bundle/Core/ApiLoader/CacheFactoryTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\ApiLoader\\\\RepositoryConfigurationProviderTest\\:\\:providerForRepositories\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: tests/bundle/Core/ApiLoader/RepositoryConfigurationProviderTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\ApiLoader\\\\RepositoryConfigurationProviderTest\\:\\:testGetCurrentRepositoryAlias\\(\\) has parameter \\$repositories with no value type specified in iterable type array\\.$#"
count: 1
path: tests/bundle/Core/ApiLoader/RepositoryConfigurationProviderTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\ApiLoader\\\\RepositoryConfigurationProviderTest\\:\\:testGetDefaultRepositoryAlias\\(\\) has parameter \\$repositories with no value type specified in iterable type array\\.$#"
count: 1
path: tests/bundle/Core/ApiLoader/RepositoryConfigurationProviderTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\ApiLoader\\\\RepositoryConfigurationProviderTest\\:\\:testGetRepositoryConfigNotSpecifiedRepository\\(\\) has no return type specified\\.$#"
count: 1
path: tests/bundle/Core/ApiLoader/RepositoryConfigurationProviderTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\ApiLoader\\\\RepositoryConfigurationProviderTest\\:\\:testGetRepositoryConfigSpecifiedRepository\\(\\) has no return type specified\\.$#"
count: 1
path: tests/bundle/Core/ApiLoader/RepositoryConfigurationProviderTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\ApiLoader\\\\RepositoryConfigurationProviderTest\\:\\:testGetRepositoryConfigUndefinedRepository\\(\\) has parameter \\$repositories with no value type specified in iterable type array\\.$#"
count: 1
path: tests/bundle/Core/ApiLoader/RepositoryConfigurationProviderTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\ApiLoader\\\\StorageConnectionFactoryTest\\:\\:getConfigResolverMock\\(\\) has no return type specified\\.$#"
count: 1
path: tests/bundle/Core/ApiLoader/StorageConnectionFactoryTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\ApiLoader\\\\StorageConnectionFactoryTest\\:\\:getConnectionProvider\\(\\) has no return type specified\\.$#"
count: 1
path: tests/bundle/Core/ApiLoader/StorageConnectionFactoryTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\ApiLoader\\\\StorageConnectionFactoryTest\\:\\:getContainerMock\\(\\) has no return type specified\\.$#"
count: 1
path: tests/bundle/Core/ApiLoader/StorageConnectionFactoryTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\ApiLoader\\\\StorageConnectionFactoryTest\\:\\:testGetConnection\\(\\) has no return type specified\\.$#"
count: 1
path: tests/bundle/Core/ApiLoader/StorageConnectionFactoryTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\ApiLoader\\\\StorageConnectionFactoryTest\\:\\:testGetConnection\\(\\) has parameter \\$doctrineConnection with no type specified\\.$#"
count: 1
path: tests/bundle/Core/ApiLoader/StorageConnectionFactoryTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\ApiLoader\\\\StorageConnectionFactoryTest\\:\\:testGetConnection\\(\\) has parameter \\$repositoryAlias with no type specified\\.$#"
count: 1
path: tests/bundle/Core/ApiLoader/StorageConnectionFactoryTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\ApiLoader\\\\StorageConnectionFactoryTest\\:\\:testGetConnectionInvalidConnection\\(\\) has no return type specified\\.$#"
count: 1
path: tests/bundle/Core/ApiLoader/StorageConnectionFactoryTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\ApiLoader\\\\StorageConnectionFactoryTest\\:\\:testGetConnectionInvalidRepository\\(\\) has no return type specified\\.$#"
count: 1
path: tests/bundle/Core/ApiLoader/StorageConnectionFactoryTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\ApiLoader\\\\StorageEngineFactoryTest\\:\\:getPersistenceHandlerMock\\(\\) has no return type specified\\.$#"
count: 1
path: tests/bundle/Core/ApiLoader/StorageEngineFactoryTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\ApiLoader\\\\StorageEngineFactoryTest\\:\\:testBuildInvalidStorageEngine\\(\\) has no return type specified\\.$#"
count: 1
path: tests/bundle/Core/ApiLoader/StorageEngineFactoryTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\ApiLoader\\\\StorageEngineFactoryTest\\:\\:testBuildStorageEngine\\(\\) has no return type specified\\.$#"
count: 1
path: tests/bundle/Core/ApiLoader/StorageEngineFactoryTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\ApiLoader\\\\StorageEngineFactoryTest\\:\\:testRegisterStorageEngine\\(\\) has no return type specified\\.$#"
count: 1
path: tests/bundle/Core/ApiLoader/StorageEngineFactoryTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\ChainConfigResolverTest\\:\\:buildMock\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -24720,11 +24560,6 @@ parameters:
count: 1
path: tests/bundle/Core/DependencyInjection/Stub/StubYamlPolicyProvider.php

-
message: "#^Call to an undefined method Ibexa\\\\Bundle\\\\Core\\\\ApiLoader\\\\RepositoryConfigurationProvider\\:\\:method\\(\\)\\.$#"
count: 3
path: tests/bundle/Core/Entity/EntityManagerFactoryTest.php

-
message: "#^Property Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\Entity\\\\EntityManagerFactoryTest\\:\\:\\$serviceLocator is never read, only written\\.$#"
count: 1
Expand Down Expand Up @@ -44595,21 +44430,6 @@ parameters:
count: 1
path: tests/lib/Helper/FieldsGroups/ArrayTranslatorFieldsGroupsListTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Helper\\\\FieldsGroups\\\\RepositoryConfigFieldsGroupsListFactoryTest\\:\\:testBuild\\(\\) has no return type specified\\.$#"
count: 1
path: tests/lib/Helper/FieldsGroups/RepositoryConfigFieldsGroupsListFactoryTest.php

-
message: "#^Property Ibexa\\\\Tests\\\\Core\\\\Helper\\\\FieldsGroups\\\\RepositoryConfigFieldsGroupsListFactoryTest\\:\\:\\$repositoryConfigMock has no type specified\\.$#"
count: 1
path: tests/lib/Helper/FieldsGroups/RepositoryConfigFieldsGroupsListFactoryTest.php

-
message: "#^Property Ibexa\\\\Tests\\\\Core\\\\Helper\\\\FieldsGroups\\\\RepositoryConfigFieldsGroupsListFactoryTest\\:\\:\\$translatorMock has no type specified\\.$#"
count: 1
path: tests/lib/Helper/FieldsGroups/RepositoryConfigFieldsGroupsListFactoryTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Helper\\\\PreviewLocationProviderTest\\:\\:testGetPreviewLocation\\(\\) has no return type specified\\.$#"
count: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
* @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 Ibexa\Bundle\Core\ApiLoader\Exception;

use InvalidArgumentException;
use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException;

class InvalidRepositoryException extends InvalidArgumentException
final class InvalidRepositoryException extends InvalidArgumentException
{
}
5 changes: 3 additions & 2 deletions src/bundle/Core/ApiLoader/Exception/InvalidSearchEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
* @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 Ibexa\Bundle\Core\ApiLoader\Exception;

use InvalidArgumentException;
use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException;

class InvalidSearchEngine extends InvalidArgumentException
final class InvalidSearchEngine extends InvalidArgumentException
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
* @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 Ibexa\Bundle\Core\ApiLoader\Exception;

use InvalidArgumentException;
use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException;

class InvalidSearchEngineIndexer extends InvalidArgumentException
final class InvalidSearchEngineIndexer extends InvalidArgumentException
{
}
5 changes: 3 additions & 2 deletions src/bundle/Core/ApiLoader/Exception/InvalidStorageEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
* @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 Ibexa\Bundle\Core\ApiLoader\Exception;

use InvalidArgumentException;
use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException;

class InvalidStorageEngine extends InvalidArgumentException
final class InvalidStorageEngine extends InvalidArgumentException
{
}
55 changes: 11 additions & 44 deletions src/bundle/Core/ApiLoader/RepositoryConfigurationProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,72 +4,39 @@
* @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 Ibexa\Bundle\Core\ApiLoader;

use Ibexa\Bundle\Core\ApiLoader\Exception\InvalidRepositoryException;
use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface;
use Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface;

/**
* The repository configuration provider.
* @deprecated 5.0.0 The "\Ibexa\Bundle\Core\ApiLoader\RepositoryConfigurationProvider" class is deprecated, will be removed in 6.0.0.
* Inject {@see \Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface} from Dependency Injection Container instead.
*/
class RepositoryConfigurationProvider
final readonly class RepositoryConfigurationProvider implements RepositoryConfigurationProviderInterface
{
private const REPOSITORY_STORAGE = 'storage';
private const REPOSITORY_CONNECTION = 'connection';
private const DEFAULT_CONNECTION_NAME = 'default';

/** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */
private $configResolver;

/** @var array */
private $repositories;

public function __construct(ConfigResolverInterface $configResolver, array $repositories)
public function __construct(private RepositoryConfigurationProviderInterface $configurationProvider)
{
$this->configResolver = $configResolver;
$this->repositories = $repositories;
}

/**
* @return array
*
* @throws \Ibexa\Bundle\Core\ApiLoader\Exception\InvalidRepositoryException
*/
public function getRepositoryConfig()
public function getRepositoryConfig(): array
{
// Takes configured repository as the reference, if it exists.
// If not, the first configured repository is considered instead.
$repositoryAlias = $this->configResolver->getParameter('repository');
$repositoryAlias = $repositoryAlias ?: $this->getDefaultRepositoryAlias();

if (empty($repositoryAlias) || !isset($this->repositories[$repositoryAlias])) {
throw new InvalidRepositoryException(
"Undefined Repository '$repositoryAlias'. Check if the Repository is configured in your project's ibexa.yaml."
);
}

return ['alias' => $repositoryAlias] + $this->repositories[$repositoryAlias];
return $this->configurationProvider->getRepositoryConfig();
}

public function getCurrentRepositoryAlias(): string
{
return $this->getRepositoryConfig()['alias'];
return $this->configurationProvider->getCurrentRepositoryAlias();
}

public function getDefaultRepositoryAlias(): ?string
{
$aliases = array_keys($this->repositories);

return array_shift($aliases);
return $this->configurationProvider->getDefaultRepositoryAlias();
}

public function getStorageConnectionName(): string
{
$repositoryConfig = $this->getRepositoryConfig();

return $repositoryConfig[self::REPOSITORY_STORAGE][self::REPOSITORY_CONNECTION]
? $repositoryConfig[self::REPOSITORY_STORAGE][self::REPOSITORY_CONNECTION]
: self::DEFAULT_CONNECTION_NAME;
return $this->configurationProvider->getStorageConnectionName();
}
}
Loading