Skip to content

Commit

Permalink
chore: fix cs
Browse files Browse the repository at this point in the history
  • Loading branch information
lyrixx committed Mar 15, 2024
1 parent 92bebb0 commit 376a483
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Client extends ElasticaClient
private ResultSetBuilder $resultSetBuilder;
private IndexNameMapper $indexNameMapper;

public function __construct($config = [], callable $callback = null, LoggerInterface $logger = null, ResultSetBuilder $resultSetBuilder = null, IndexNameMapper $indexNameMapper = null)
public function __construct($config = [], ?callable $callback = null, ?LoggerInterface $logger = null, ?ResultSetBuilder $resultSetBuilder = null, ?IndexNameMapper $indexNameMapper = null)
{
parent::__construct($config, $callback, $logger);

Expand Down
2 changes: 1 addition & 1 deletion src/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function getModel($id)
return $this->resultSetBuilder->buildModelFromDocument($document);
}

public function createSearch($query = '', $options = null, BuilderInterface $builder = null): Search
public function createSearch($query = '', $options = null, ?BuilderInterface $builder = null): Search
{
return parent::createSearch($query, $options, $builder ?? $this->resultSetBuilder);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Indexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Indexer

private ?Bulk $currentBulk = null;

public function __construct(Client $client, SerializerInterface $serializer, int $bulkMaxSize = 100, array $bulkRequestParams = [], ContextBuilderInterface $contextBuilder = null)
public function __construct(Client $client, SerializerInterface $serializer, int $bulkMaxSize = 100, array $bulkRequestParams = [], ?ContextBuilderInterface $contextBuilder = null)
{
// TODO: on the destruct, maybe throw an exception for non empty indexer queues?
Expand Down
2 changes: 1 addition & 1 deletion src/Mapping/YamlProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class YamlProvider implements MappingProviderInterface
private string $configurationDirectory;
private Parser $parser;

public function __construct(string $configurationDirectory, Parser $parser = null)
public function __construct(string $configurationDirectory, ?Parser $parser = null)
{
$this->configurationDirectory = $configurationDirectory;
$this->parser = $parser ?? new Parser();
Expand Down
4 changes: 2 additions & 2 deletions src/Model/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ class Document extends ElasticaDocument
{
private ?object $model;

public function __construct(?string $id, object $model = null, array|string $data = [], Index|string $index = '')
public function __construct(?string $id, ?object $model = null, array|string $data = [], Index|string $index = '')
{
parent::__construct($id, $data, $index);

$this->model = $model;
}

public static function createFromDocument(ElasticaDocument $document, object $model = null): self
public static function createFromDocument(ElasticaDocument $document, ?object $model = null): self
{
return new self($document->getId(), $model, $document->getData(), $document->getIndex());
}
Expand Down
2 changes: 1 addition & 1 deletion src/Transport/HttpClientTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class HttpClientTransport extends AbstractTransport
*/
private string $scheme;

public function __construct(HttpClientInterface $client, string $scheme = 'http', Connection $connection = null)
public function __construct(HttpClientInterface $client, string $scheme = 'http', ?Connection $connection = null)
{
parent::__construct($connection);

Expand Down
4 changes: 2 additions & 2 deletions tests/BaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected function setUp(): void
$this->getFactory()->buildClient()->request('*', 'DELETE');
}

protected function getFactory(string $path = null, array $config = []): Factory
protected function getFactory(?string $path = null, array $config = []): Factory
{
return new Factory($config + [
Factory::CONFIG_MAPPINGS_DIRECTORY => $path ?? __DIR__ . '/configs',
Expand All @@ -33,7 +33,7 @@ protected function getFactory(string $path = null, array $config = []): Factory
]);
}

protected function getClient(string $path = null, array $config = []): Client
protected function getClient(?string $path = null, array $config = []): Client
{
return $this->getFactory($path, $config)->buildClient();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/IndexBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public function testMigrate(): void
$this->assertInstanceOf(ElasticaDocument::class, $document);
}

private function getIndexBuilder(string $path = null, array $config = []): IndexBuilder
private function getIndexBuilder(?string $path = null, array $config = []): IndexBuilder
{
return $this->getFactory($path, $config)->buildIndexBuilder();
}
Expand Down

0 comments on commit 376a483

Please sign in to comment.