Skip to content

IBX-9727: Added missing type hints #516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion src/bundle/Core/ApiLoader/CacheFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class CacheFactory implements ContainerAwareInterface
*
* @return \Symfony\Component\Cache\Adapter\TagAwareAdapterInterface
*/
public function getCachePool(ConfigResolverInterface $configResolver)
public function getCachePool(ConfigResolverInterface $configResolver): TagAwareAdapterInterface|TagAwareAdapter
{
/** @var \Symfony\Component\Cache\Adapter\AdapterInterface $cacheService */
$cacheService = $this->container->get($configResolver->getParameter('cache_service_name'));
Expand Down
13 changes: 4 additions & 9 deletions src/bundle/Core/ApiLoader/RepositoryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,16 @@
*/
class RepositoryFactory
{
/** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */
private $configResolver;
private ConfigResolverInterface $configResolver;

/**
* Map of system configured policies.
*
* @var array
*/
private $policyMap;
private array $policyMap;

/** @var \Psr\Log\LoggerInterface */
private $logger;
private LoggerInterface $logger;

/** @var \Ibexa\Contracts\Core\Repository\LanguageResolver */
private $languageResolver;
private LanguageResolver $languageResolver;

public function __construct(
ConfigResolverInterface $configResolver,
Expand Down
2 changes: 1 addition & 1 deletion src/bundle/Core/ApiLoader/SearchEngineFactory.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

Check failure on line 1 in src/bundle/Core/ApiLoader/SearchEngineFactory.php

View workflow job for this annotation

GitHub Actions / Unit tests & SQLite integration tests (8.3)

Ignored error pattern #^Method Ibexa\\Bundle\\Core\\ApiLoader\\SearchEngineFactory\:\:registerSearchEngine\(\) has no return type specified\.$# (missingType.return) in path /home/runner/work/core/core/src/bundle/Core/ApiLoader/SearchEngineFactory.php was not matched in reported errors.

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
Expand Down Expand Up @@ -37,7 +37,7 @@
* @param \Ibexa\Contracts\Core\Search\Handler $searchHandler
* @param string $searchEngineIdentifier
*/
public function registerSearchEngine(SearchHandler $searchHandler, $searchEngineIdentifier)
public function registerSearchEngine(SearchHandler $searchHandler, $searchEngineIdentifier): void
{
$this->searchEngines[$searchEngineIdentifier] = $searchHandler;
}
Expand Down
2 changes: 1 addition & 1 deletion src/bundle/Core/ApiLoader/SearchEngineIndexerFactory.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

Check failure on line 1 in src/bundle/Core/ApiLoader/SearchEngineIndexerFactory.php

View workflow job for this annotation

GitHub Actions / Unit tests & SQLite integration tests (8.3)

Ignored error pattern #^Method Ibexa\\Bundle\\Core\\ApiLoader\\SearchEngineIndexerFactory\:\:registerSearchEngineIndexer\(\) has no return type specified\.$# (missingType.return) in path /home/runner/work/core/core/src/bundle/Core/ApiLoader/SearchEngineIndexerFactory.php was not matched in reported errors.

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
Expand Down Expand Up @@ -38,7 +38,7 @@
* @param \Ibexa\Core\Search\Common\Indexer $searchEngineIndexer
* @param string $searchEngineIdentifier
*/
public function registerSearchEngineIndexer(SearchEngineIndexer $searchEngineIndexer, $searchEngineIdentifier)
public function registerSearchEngineIndexer(SearchEngineIndexer $searchEngineIndexer, $searchEngineIdentifier): void
{
$this->searchEngineIndexers[$searchEngineIdentifier] = $searchEngineIndexer;
}
Expand Down
3 changes: 1 addition & 2 deletions src/bundle/Core/Cache/Warmer/ProxyCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ final class ProxyCacheWarmer implements CacheWarmerInterface
Thumbnail::class,
];

/** @var \Ibexa\Core\Repository\ProxyFactory\ProxyGeneratorInterface */
private $proxyGenerator;
private ProxyGeneratorInterface $proxyGenerator;

public function __construct(ProxyGeneratorInterface $proxyGenerator)
{
Expand Down
12 changes: 4 additions & 8 deletions src/bundle/Core/Command/CheckURLsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,13 @@ class CheckURLsCommand extends Command
private const DEFAULT_ITERATION_COUNT = 50;
private const DEFAULT_REPOSITORY_USER = 'admin';

/** @var \Ibexa\Contracts\Core\Repository\UserService */
private $userService;
private UserService $userService;

/** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */
private $permissionResolver;
private PermissionResolver $permissionResolver;

/** @var \Ibexa\Contracts\Core\Repository\URLService */
private $urlService;
private URLService $urlService;

/** @var \Ibexa\Bundle\Core\URLChecker\URLCheckerInterface */
private $urlChecker;
private URLCheckerInterface $urlChecker;

public function __construct(
UserService $userService,
Expand Down
4 changes: 2 additions & 2 deletions src/bundle/Core/Command/CleanupVersionsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
*
* @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException
*/
protected function getObjectsIds($keep, $status, $excludedContentTypes = [])
protected function getObjectsIds($keep, $status, $excludedContentTypes = []): array
{
$query = $this->connection->createQueryBuilder()
->select('c.id')
Expand Down Expand Up @@ -286,7 +286,7 @@ protected function getObjectsIds($keep, $status, $excludedContentTypes = [])
*
* @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException
*/
private function mapStatusToVersionInfoStatus($status)
private function mapStatusToVersionInfoStatus($status): int
{
if (array_key_exists($status, self::VERSION_STATUS)) {
return self::VERSION_STATUS[$status];
Expand Down
8 changes: 3 additions & 5 deletions src/bundle/Core/Command/DebugConfigResolverCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@
)]
class DebugConfigResolverCommand extends Command
{
/** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */
private $configResolver;
private ConfigResolverInterface $configResolver;

/** @var \Ibexa\Core\MVC\Symfony\SiteAccess */
private $siteAccess;
private SiteAccess $siteAccess;

public function __construct(
ConfigResolverInterface $configResolver,
Expand All @@ -44,7 +42,7 @@ public function __construct(
/**
* {@inheritdoc}.
*/
public function configure()
public function configure(): void
{
$this->addArgument(
'parameter',
Expand Down
11 changes: 4 additions & 7 deletions src/bundle/Core/Command/DeleteContentTranslationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,14 @@
)]
class DeleteContentTranslationCommand extends Command
{
/** @var \Ibexa\Contracts\Core\Repository\Repository */
private $repository;
private Repository $repository;

/** @var \Ibexa\Contracts\Core\Repository\ContentService */
private $contentService;

/** @var \Symfony\Component\Console\Input\InputInterface */
private $input;
private ?InputInterface $input = null;

/** @var \Symfony\Component\Console\Output\OutputInterface */
private $output;
private ?OutputInterface $output = null;

/** @var \Symfony\Component\Console\Helper\QuestionHelper */
private $questionHelper;
Expand Down Expand Up @@ -99,7 +96,7 @@
);
}

$this->output->writeln(

Check failure on line 99 in src/bundle/Core/Command/DeleteContentTranslationCommand.php

View workflow job for this annotation

GitHub Actions / Unit tests & SQLite integration tests (8.3)

Cannot call method writeln() on Symfony\Component\Console\Output\OutputInterface|null.
'<comment>**NOTE**: Make sure to run this command using the same SYMFONY_ENV setting as your Ibexa installation</comment>'
);

Expand All @@ -123,10 +120,10 @@
"Are you sure you want to delete the {$languageCode} translation from Content item {$contentName}? This operation is permanent. [y/N] ",
false
);
if (!$this->questionHelper->ask($this->input, $this->output, $question)) {

Check failure on line 123 in src/bundle/Core/Command/DeleteContentTranslationCommand.php

View workflow job for this annotation

GitHub Actions / Unit tests & SQLite integration tests (8.3)

Parameter #1 $input of method Symfony\Component\Console\Helper\QuestionHelper::ask() expects Symfony\Component\Console\Input\InputInterface, Symfony\Component\Console\Input\InputInterface|null given.

Check failure on line 123 in src/bundle/Core/Command/DeleteContentTranslationCommand.php

View workflow job for this annotation

GitHub Actions / Unit tests & SQLite integration tests (8.3)

Parameter #2 $output of method Symfony\Component\Console\Helper\QuestionHelper::ask() expects Symfony\Component\Console\Output\OutputInterface, Symfony\Component\Console\Output\OutputInterface|null given.
// Rollback any cleanup change (see above)
$this->repository->rollback();
$this->output->writeln('Reverting and aborting.');

Check failure on line 126 in src/bundle/Core/Command/DeleteContentTranslationCommand.php

View workflow job for this annotation

GitHub Actions / Unit tests & SQLite integration tests (8.3)

Cannot call method writeln() on Symfony\Component\Console\Output\OutputInterface|null.

return self::SUCCESS;
}
Expand Down Expand Up @@ -159,11 +156,11 @@
*/
private function promptUserForMainLanguageChange(
ContentInfo $contentInfo,
$languageCode,
string $languageCode,
array $lastVersionLanguageCodes
) {
$contentName = "#{$contentInfo->id} ($contentInfo->name)";
$this->output->writeln(

Check failure on line 163 in src/bundle/Core/Command/DeleteContentTranslationCommand.php

View workflow job for this annotation

GitHub Actions / Unit tests & SQLite integration tests (8.3)

Cannot call method writeln() on Symfony\Component\Console\Output\OutputInterface|null.
"<comment>The specified translation '{$languageCode}' is the main translation of Content item {$contentName}. It needs to be changed before removal.</comment>"
);

Expand All @@ -185,8 +182,8 @@
array_values($mainTranslationCandidates)
);

$newMainLanguageCode = $this->questionHelper->ask($this->input, $this->output, $question);

Check failure on line 185 in src/bundle/Core/Command/DeleteContentTranslationCommand.php

View workflow job for this annotation

GitHub Actions / Unit tests & SQLite integration tests (8.3)

Parameter #1 $input of method Symfony\Component\Console\Helper\QuestionHelper::ask() expects Symfony\Component\Console\Input\InputInterface, Symfony\Component\Console\Input\InputInterface|null given.

Check failure on line 185 in src/bundle/Core/Command/DeleteContentTranslationCommand.php

View workflow job for this annotation

GitHub Actions / Unit tests & SQLite integration tests (8.3)

Parameter #2 $output of method Symfony\Component\Console\Helper\QuestionHelper::ask() expects Symfony\Component\Console\Output\OutputInterface, Symfony\Component\Console\Output\OutputInterface|null given.
$this->output->writeln(

Check failure on line 186 in src/bundle/Core/Command/DeleteContentTranslationCommand.php

View workflow job for this annotation

GitHub Actions / Unit tests & SQLite integration tests (8.3)

Cannot call method writeln() on Symfony\Component\Console\Output\OutputInterface|null.
"<info>Updating main translation of Content item {$contentName} to {$newMainLanguageCode}</info>"
);

Expand Down
17 changes: 7 additions & 10 deletions src/bundle/Core/Command/NormalizeImagesPathsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace Ibexa\Bundle\Core\Command;

use Doctrine\DBAL\Driver\Connection;
use Ibexa\Core\FieldType\Image\ImageStorage\Gateway;
use Ibexa\Core\FieldType\Image\ImageStorage\Gateway as ImageStorageGateway;
use Ibexa\Core\IO\Exception\BinaryFileNotFoundException;
use Ibexa\Core\IO\FilePathNormalizerInterface;
Expand Down Expand Up @@ -42,17 +43,13 @@ final class NormalizeImagesPathsCommand extends Command

private const SKIP_HASHING_COMMAND_PARAMETER = 'no-hash';

/** @var \Ibexa\Core\FieldType\Image\ImageStorage\Gateway */
private $imageGateway;
private Gateway $imageGateway;

/** @var \Ibexa\Core\IO\FilePathNormalizerInterface */
private $filePathNormalizer;
private FilePathNormalizerInterface $filePathNormalizer;

/** @var \Doctrine\DBAL\Driver\Connection */
private $connection;
private Connection $connection;

/** @var \Ibexa\Core\IO\IOServiceInterface */
private $ioService;
private IOServiceInterface $ioService;

/** @var bool */
private $skipHashing;
Expand All @@ -71,7 +68,7 @@ public function __construct(
$this->ioService = $ioService;
}

protected function configure()
protected function configure(): void
{
$beforeRunningHints = self::BEFORE_RUNNING_HINTS;

Expand Down Expand Up @@ -205,7 +202,7 @@ private function updateImagePath(
}

protected function updateImagePathsToNormalize(
$imageData,
array $imageData,
array $imagePathsToNormalize
): array {
$filePath = $imageData['filepath'];
Expand Down
18 changes: 8 additions & 10 deletions src/bundle/Core/Command/RegenerateUrlAliasesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ class RegenerateUrlAliasesCommand extends Command
- Manually clear HTTP cache after running this command.
EOT;

/** @var \Ibexa\Contracts\Core\Repository\Repository */
private $repository;
private Repository $repository;

/** @var \Psr\Log\LoggerInterface */
private $logger;
private LoggerInterface $logger;

/**
* @param \Ibexa\Contracts\Core\Repository\Repository $repository
Expand Down Expand Up @@ -167,7 +165,7 @@ static function (Repository $repository): int {
*
* @return \Symfony\Component\Console\Helper\ProgressBar
*/
protected function getProgressBar($maxSteps, OutputInterface $output)
protected function getProgressBar($maxSteps, OutputInterface $output): ProgressBar
{
$progressBar = new ProgressBar($output, $maxSteps);
$progressBar->setFormat(
Expand All @@ -186,7 +184,7 @@ protected function getProgressBar($maxSteps, OutputInterface $output)
private function processLocations(array $locations, ProgressBar $progressBar): void
{
$contentList = $this->repository->sudo(
static function (Repository $repository) use ($locations) {
static function (Repository $repository) use ($locations): iterable {
$contentInfoList = array_map(
static function (Location $location) {
return $location->contentInfo;
Expand All @@ -211,7 +209,7 @@ static function (Location $location) {
}

$this->repository->sudo(
static function (Repository $repository) use ($location) {
static function (Repository $repository) use ($location): void {
$repository->getURLAliasService()->refreshSystemUrlAliasesForLocation(
$location
);
Expand Down Expand Up @@ -247,7 +245,7 @@ static function (Repository $repository) use ($location) {
private function loadAllLocations(int $offset, int $iterationCount): array
{
return $this->repository->sudo(
static function (Repository $repository) use ($offset, $iterationCount) {
static function (Repository $repository) use ($offset, $iterationCount): array {
return $repository->getLocationService()->loadAllLocations($offset, $iterationCount);
}
);
Expand All @@ -267,7 +265,7 @@ private function loadSpecificLocations(array $locationIds, int $offset, int $ite
$locationIds = array_slice($locationIds, $offset, $iterationCount);

return $this->repository->sudo(
static function (Repository $repository) use ($locationIds) {
static function (Repository $repository) use ($locationIds): iterable {
return $repository->getLocationService()->loadLocationList($locationIds);
}
);
Expand All @@ -283,7 +281,7 @@ static function (Repository $repository) use ($locationIds) {
private function getFilteredLocationList(array $locationIds): array
{
$locations = $this->repository->sudo(
static function (Repository $repository) use ($locationIds) {
static function (Repository $repository) use ($locationIds): iterable {
$locationService = $repository->getLocationService();

return $locationService->loadLocationList($locationIds);
Expand Down
26 changes: 9 additions & 17 deletions src/bundle/Core/Command/ReindexCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,24 @@ class ReindexCommand extends Command
private const string IBEXA_CLOUD_CONFIG_FILE = '/run/config.json';
private const string LINUX_CPUINFO_FILE = '/proc/cpuinfo';

/** @var \Ibexa\Core\Search\Common\Indexer|\Ibexa\Core\Search\Common\IncrementalIndexer */
private $searchIndexer;
private Indexer $searchIndexer;

/** @var string */
private $phpPath;
private string|null|bool $phpPath = null;

/** @var \Psr\Log\LoggerInterface */
private $logger;
private LoggerInterface $logger;

/** @var string */
private $siteaccess;

/** @var string */
private $env;
private string $env;

/** @var bool */
private $isDebug;
private bool $isDebug;

/** @var string */
private $projectDir;
private string $projectDir;

/** @var \Ibexa\Contracts\Core\Search\Content\IndexerGateway */
private $gateway;
private IndexerGateway $gateway;

/** @var \Ibexa\Contracts\Core\Persistence\Content\Location\Handler */
private $locationHandler;
private Handler $locationHandler;

private ContentIdListGeneratorStrategyInterface $contentIdListGeneratorStrategy;

Expand Down Expand Up @@ -97,7 +89,7 @@ public function __construct(
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
*/
public function initialize(InputInterface $input, OutputInterface $output)
public function initialize(InputInterface $input, OutputInterface $output): void
{
parent::initialize($input, $output);
if (!$this->searchIndexer instanceof Indexer) {
Expand Down
27 changes: 9 additions & 18 deletions src/bundle/Core/Command/ResizeOriginalImagesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,32 +43,23 @@ class ResizeOriginalImagesCommand extends Command
public const DEFAULT_ITERATION_COUNT = 25;
public const DEFAULT_REPOSITORY_USER = 'admin';

/** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */
private $permissionResolver;
private PermissionResolver $permissionResolver;

/** @var \Ibexa\Contracts\Core\Repository\UserService */
private $userService;
private UserService $userService;

/** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */
private $contentTypeService;
private ContentTypeService $contentTypeService;

/** @var \Ibexa\Contracts\Core\Repository\ContentService */
private $contentService;
private ContentService $contentService;

/** @var \Ibexa\Contracts\Core\Repository\SearchService */
private $searchService;
private SearchService $searchService;

/** @var \Liip\ImagineBundle\Imagine\Filter\FilterManager */
private $filterManager;
private FilterManager $filterManager;

/** @var \Ibexa\Core\IO\IOServiceInterface */
private $ioService;
private IOServiceInterface $ioService;

/** @var \Symfony\Component\Mime\MimeTypesInterface */
private $mimeTypes;
private MimeTypesInterface $mimeTypes;

/** @var \Imagine\Image\ImagineInterface */
private $imagine;
private ImagineInterface $imagine;

public function __construct(
PermissionResolver $permissionResolver,
Expand Down
11 changes: 4 additions & 7 deletions src/bundle/Core/Command/SetSystemContentTypeGroupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@ final class SetSystemContentTypeGroupCommand extends Command
{
private const DEFAULT_REPOSITORY_USER = 'admin';

/** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */
private $contentTypeService;
private ContentTypeService $contentTypeService;

/** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */
private $permissionResolver;
private PermissionResolver $permissionResolver;

/** @var \Ibexa\Contracts\Core\Repository\UserService */
private $userService;
private UserService $userService;

public function __construct(
ContentTypeService $contentTypeService,
Expand All @@ -52,7 +49,7 @@ public function __construct(
$this->userService = $userService;
}

protected function configure()
protected function configure(): void
{
$this
->addArgument('content-type-group-identifier', InputArgument::REQUIRED, 'ContentTypGroup identifier')
Expand Down
Loading
Loading