Skip to content

Commit

Permalink
Run cs fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
l-you committed Dec 4, 2023
1 parent 8ebec77 commit 724e5ae
Show file tree
Hide file tree
Showing 67 changed files with 78 additions and 249 deletions.
1 change: 1 addition & 0 deletions src/Configuration/ConfigManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class ConfigManager implements ManagerInterface
{
/**
* @var IndexConfig[]
*
* @phpstan-var array<string, IndexConfigInterface>
*/
private $indexes = [];
Expand Down
1 change: 1 addition & 0 deletions src/Configuration/IndexConfigInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function getNumericDetection(): ?bool;

/**
* @return string|bool|null
*
* @phpstan-return ?TDynamic
*/
public function getDynamic();
Expand Down
6 changes: 6 additions & 0 deletions src/Configuration/IndexConfigTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,27 @@ trait IndexConfigTrait
* An array of settings sent to ElasticSearch when creating the index.
*
* @var array
*
* @phpstan-var TSettings
*
* @phpstan-ignore-next-line Ignored because of a bug in PHPStan (https://github.com/phpstan/phpstan/issues/5091)
*/
private $settings;

/**
* @var array
*
* @phpstan-var TConfig
*
* @phpstan-ignore-next-line Ignored because of a bug in PHPStan (https://github.com/phpstan/phpstan/issues/5091)
*/
private $config;

/**
* @var array
*
* @phpstan-var TMapping
*
* @phpstan-ignore-next-line Ignored because of a bug in PHPStan (https://github.com/phpstan/phpstan/issues/5091)
*/
private $mapping;
Expand Down
2 changes: 2 additions & 0 deletions src/Configuration/Source/ContainerSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class ContainerSource implements SourceInterface
* The internal container representation of information.
*
* @var array
*
* @phpstan-var list<TConfig>
*/
private $configArray;
Expand All @@ -41,6 +42,7 @@ public function __construct(array $configArray)
* Should return all configuration available from the data source.
*
* @return IndexConfig[]
*
* @phpstan-return array<string, IndexConfig>
*/
public function getConfiguration(): array
Expand Down
1 change: 1 addition & 0 deletions src/Configuration/Source/SourceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface SourceInterface
* Should return all configuration available from the data source.
*
* @return \FOS\ElasticaBundle\Configuration\IndexConfig[]
*
* @phpstan-return array<string, IndexConfigInterface>
*/
public function getConfiguration(): array;
Expand Down
2 changes: 2 additions & 0 deletions src/Configuration/Source/TemplateContainerSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class TemplateContainerSource implements SourceInterface
* The internal container representation of information.
*
* @var array
*
* @phpstan-var list<TConfig>
*/
private $configArray;
Expand All @@ -41,6 +42,7 @@ public function __construct(array $configArray)
* Should return all configuration available from the data source.
*
* @return IndexTemplateConfig[]
*
* @phpstan-return array<string, IndexTemplateConfig>
*/
public function getConfiguration(): array
Expand Down
3 changes: 3 additions & 0 deletions src/Configuration/TypeConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ class TypeConfig
{
/**
* @var array
*
* @phpstan-var TElasticConfig
*/
private $config;

/**
* @var array
*
* @phpstan-var TMapping
*/
private $mapping;
Expand All @@ -38,6 +40,7 @@ class TypeConfig

/**
* @param TMapping $mapping
*
* @phpstan-param TElasticConfig $config
*/
public function __construct(string $name, array $mapping, array $config = [])
Expand Down
6 changes: 0 additions & 6 deletions src/DataCollector/ElasticaDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,11 @@ public function collect(Request $request, Response $response, ?\Throwable $excep
$this->data['queries'] = $this->logger->getQueries();
}

/**
* @return mixed
*/
public function getQueryCount()
{
return $this->data['nb_queries'];
}

/**
* @return mixed
*/
public function getQueries()
{
return $this->data['queries'];
Expand Down
2 changes: 2 additions & 0 deletions src/DependencyInjection/FOSElasticaExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class FOSElasticaExtension extends Extension
* An array of indexes as configured by the extension.
*
* @var array
*
* @phpstan-var array<string, TIndexConfig>
*/
private $indexConfigs = [];
Expand All @@ -49,6 +50,7 @@ class FOSElasticaExtension extends Extension
* An array of index templates as configured by the extension.
*
* @var array
*
* @phpstan-var array<string, TIndexTemplateConfig>
*/
private $indexTemplateConfigs = [];
Expand Down
7 changes: 2 additions & 5 deletions src/Doctrine/AbstractElasticaToModelTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ public function getObjectClass(): string
*
* @param Result[] $elasticaObjects of elastica objects
*
* @throws \RuntimeException
*
* @return array
*
* @throws \RuntimeException
*/
public function transform(array $elasticaObjects)
{
Expand Down Expand Up @@ -144,9 +144,6 @@ public function hybridTransform(array $elasticaObjects)
return $result;
}

/**
* {@inheritdoc}
*/
public function getIdentifierField(): string
{
return $this->options['identifier'];
Expand Down
3 changes: 0 additions & 3 deletions src/Doctrine/MongoDBPagerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ public function __construct(
$this->registerListenersService = $registerListenersService;
}

/**
* {@inheritdoc}
*/
public function provide(array $options = []): PagerInterface
{
$options = \array_replace($this->baseOptions, $options);
Expand Down
3 changes: 0 additions & 3 deletions src/Doctrine/ORMPagerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ public function __construct(
$this->registerListenersService = $registerListenersService;
}

/**
* {@inheritdoc}
*/
public function provide(array $options = []): PagerInterface
{
$options = \array_replace($this->baseOptions, $options);
Expand Down
5 changes: 1 addition & 4 deletions src/Doctrine/PHPCRPagerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ public function __construct(ManagerRegistry $doctrine, RegisterListenersService
$this->registerListenersService = $registerListenersService;
}

/**
* {@inheritdoc}
*/
public function provide(array $options = []): PagerInterface
{
$options = \array_replace($this->baseOptions, $options);
Expand All @@ -73,7 +70,7 @@ public function provide(array $options = []): PagerInterface
$repository = $manager->getRepository($this->objectClass);

$adapter = new QueryAdapter(
\call_user_func([$repository, $options['query_builder_method']], static::ENTITY_ALIAS)
\call_user_func([$repository, $options['query_builder_method']], self::ENTITY_ALIAS)
);

$pager = new PagerfantaPager(new Pagerfanta($adapter));
Expand Down
3 changes: 0 additions & 3 deletions src/Doctrine/RepositoryManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ public function __construct(ManagerRegistry $managerRegistry, RepositoryManagerI
$this->repositoryManager = $repositoryManager;
}

/**
* {@inheritdoc}
*/
public function addIndex(string $indexName, FinderInterface $finder, ?string $repositoryName = null): void
{
throw new \LogicException(__METHOD__.' should not be called. Call addIndex on the main repository manager');
Expand Down
2 changes: 0 additions & 2 deletions src/Elastica/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ class Client extends BaseClient
private $stopwatch;

/**
* {@inheritdoc}
*
* @param array<mixed> $data
* @param array<mixed> $query
*/
Expand Down
4 changes: 1 addition & 3 deletions src/Elastica/IndexTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@
*
* @author Dmitry Balabka <dmitry.balabka@intexsys.lv>
*/
class IndexTemplate extends BaseIndexTemplate
{
}
class IndexTemplate extends BaseIndexTemplate {}
3 changes: 1 addition & 2 deletions src/Event/AbstractIndexPopulateEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ abstract class AbstractIndexPopulateEvent extends AbstractIndexEvent

/**
* @var array
*
* @phpstan-var TOptions
*/
protected $options;
Expand Down Expand Up @@ -67,8 +68,6 @@ public function getOptions(): array

/**
* @throws \InvalidArgumentException if option does not exist
*
* @return mixed
*/
public function getOption(string $name)
{
Expand Down
1 change: 1 addition & 0 deletions src/Event/AbstractTransformEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ abstract class AbstractTransformEvent extends Event

/**
* @var array
*
* @phpstan-var TFields
*/
private $fields;
Expand Down
1 change: 1 addition & 0 deletions src/Event/PostIndexMappingBuildEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ final class PostIndexMappingBuildEvent extends AbstractIndexEvent

/**
* @var array
*
* @phpstan-var TMapping
*/
private $mapping;
Expand Down
4 changes: 1 addition & 3 deletions src/Event/PostIndexPopulateEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@

namespace FOS\ElasticaBundle\Event;

final class PostIndexPopulateEvent extends AbstractIndexPopulateEvent
{
}
final class PostIndexPopulateEvent extends AbstractIndexPopulateEvent {}
4 changes: 1 addition & 3 deletions src/Event/PostIndexResetEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@

namespace FOS\ElasticaBundle\Event;

final class PostIndexResetEvent extends AbstractIndexResetEvent
{
}
final class PostIndexResetEvent extends AbstractIndexResetEvent {}
4 changes: 1 addition & 3 deletions src/Event/PostTransformEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@

namespace FOS\ElasticaBundle\Event;

final class PostTransformEvent extends AbstractTransformEvent
{
}
final class PostTransformEvent extends AbstractTransformEvent {}
3 changes: 0 additions & 3 deletions src/Event/PreIndexPopulateEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@

final class PreIndexPopulateEvent extends AbstractIndexPopulateEvent
{
/**
* @param mixed $value
*/
public function setOption(string $name, $value): self
{
$this->options[$name] = $value;
Expand Down
2 changes: 0 additions & 2 deletions src/FOSElasticaBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
class FOSElasticaBundle extends Bundle
{
/**
* {@inheritdoc}
*
* @return void
*/
public function build(ContainerBuilder $container)
Expand Down
2 changes: 2 additions & 0 deletions src/Finder/FinderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ interface FinderInterface
* Searches for query results within a given limit.
*
* @param mixed $query Can be a string, an array or an \Elastica\Query object
*
* @phpstan-param TQuery $query
*
* @param int|null $limit How many results to get
*
* @phpstan-param TOptions $options
*
* @return array<object> results
Expand Down
6 changes: 3 additions & 3 deletions src/Finder/PaginatedFinderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
* @phpstan-import-type TQuery from FinderInterface
*
* @method Pagerfanta findHybridPaginated(mixed $query) Searches for query hybrid results.
*
* @phpstan-method Pagerfanta<HybridResult> findHybridPaginated(TQuery $query)
* @phpstan-method HybridResult[] findHybrid(TQuery $query, ?int $limit = null, array $options = [])
*
* @phpstan-import-type TOptions from FinderInterface
*/
interface PaginatedFinderInterface extends FinderInterface
Expand All @@ -29,6 +31,7 @@ interface PaginatedFinderInterface extends FinderInterface
* Searches for query results and returns them wrapped in a paginator.
*
* @param mixed $query Can be a string, an array or an \Elastica\Query object
*
* @phpstan-param TQuery $query
* @phpstan-param TOptions $options
*
Expand All @@ -39,7 +42,6 @@ public function findPaginated($query, array $options = []);
/**
* Creates a paginator adapter for this query.
*
* @param mixed $query
* @phpstan-param TQuery $query
* @phpstan-param TOptions $options
*
Expand All @@ -50,7 +52,6 @@ public function createPaginatorAdapter($query, array $options = []);
/**
* Creates a hybrid paginator adapter for this query.
*
* @param mixed $query
* @phpstan-param TQuery $query
* @phpstan-param TOptions $options
*
Expand All @@ -61,7 +62,6 @@ public function createHybridPaginatorAdapter($query, array $options = []);
/**
* Creates a raw paginator adapter for this query.
*
* @param mixed $query
* @phpstan-param TQuery $query
* @phpstan-param TOptions $options
*
Expand Down

0 comments on commit 724e5ae

Please sign in to comment.