Skip to content
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

build(symfony/6.4): phpcs update #689

Merged
merged 4 commits into from
Dec 21, 2023
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
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
'phpdoc_separation' => ['skip_unlisted_annotations' => true],
'native_function_invocation' => ['include' => ['@all']],
'no_unused_imports' => true,
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true, 'remove_inheritdoc' => true],
])
->setRiskyAllowed(true)
->setFinder($finder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface ClientRequestInterface
{
public function getCacheKey(string $prefix = '', string $environment = null): string;

public function getContentType(string $name, ?Environment $environment = null): ?ContentTypeInterface;
public function getContentType(string $name, Environment $environment = null): ?ContentTypeInterface;

/**
* @return array<mixed>
Expand Down
4 changes: 2 additions & 2 deletions EMS/client-helper-bundle/src/Controller/EmbedController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct(ClientRequestManager $manager, private readonly Cach
* @param string[] $sourceFields
* @param array<mixed> $args
*/
public function renderHierarchyAction(string $template, string $parent, string $field, int $depth = null, array $sourceFields = [], array $args = [], ?string $cacheType = null): Response
public function renderHierarchyAction(string $template, string $parent, string $field, int $depth = null, array $sourceFields = [], array $args = [], string $cacheType = null): Response
{
$cacheKey = [
'EMSCH_Hierarchy',
Expand Down Expand Up @@ -55,7 +55,7 @@ public function renderHierarchyAction(string $template, string $parent, string $
* @param array<mixed> $args
* @param string[] $sourceExclude
*/
public function renderBlockAction(null|string|array $searchType, array $body, string $template, array $args = [], int $from = 0, int $size = 10, ?string $cacheType = null, array $sourceExclude = []): Response
public function renderBlockAction(null|string|array $searchType, array $body, string $template, array $args = [], int $from = 0, int $size = 10, string $cacheType = null, array $sourceExclude = []): Response
{
$cacheKey = [
'EMSCH_Block',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@

final class EMSClientHelperExtension extends Extension
{
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container): void
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
Expand Down
2 changes: 1 addition & 1 deletion EMS/client-helper-bundle/src/Helper/Api/ApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function getContentTypes(string $apiName): Response
/**
* @param array<mixed> $filter
*/
public function getContentType(string $apiName, string $contentType, array $filter = [], int $size = 10, ?string $scrollId = null): Response
public function getContentType(string $apiName, string $contentType, array $filter = [], int $size = 10, string $scrollId = null): Response
{
$response = new Response();

Expand Down
6 changes: 3 additions & 3 deletions EMS/client-helper-bundle/src/Helper/Api/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function getName(): string
*
* @return array<mixed>
*/
public function createDraft(string $type, array $body, ?string $ouuid = null): array
public function createDraft(string $type, array $body, string $ouuid = null): array
{
@\trigger_error('Deprecated use the initNewDocument or initNewDraftRevision functions', E_USER_DEPRECATED);

Expand All @@ -43,7 +43,7 @@ public function createDraft(string $type, array $body, ?string $ouuid = null): a
*
* @return array<mixed>
*/
public function initNewDocument(string $type, array $body, ?string $ouuid = null): array
public function initNewDocument(string $type, array $body, string $ouuid = null): array
{
if (null === $ouuid) {
$url = \sprintf('api/data/%s/draft', $type);
Expand Down Expand Up @@ -101,7 +101,7 @@ public function discardDraft(string $type, int $revisionId)
/**
* @return array<mixed>
*/
public function postFile(\SplFileInfo $file, ?string $forcedFilename = null): array
public function postFile(\SplFileInfo $file, string $forcedFilename = null): array
{
$response = $this->client->post('api/file/upload', [
'multipart' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ final class ContentType implements ContentTypeInterface
{
private \DateTimeImmutable $lastPublished;
/** @var mixed */
private $cache = null;
private $cache;

public function __construct(private readonly Environment $environment, private readonly string $name, private readonly int $total)
{
Expand All @@ -33,9 +33,6 @@ public function isLastPublishedAfterTime(int $timestamp): bool
return $this->lastPublished->getTimestamp() <= $timestamp;
}

/**
* {@inheritDoc}
*/
public function getCacheValidityTag(): string
{
return \sprintf('%d_%d', $this->getLastPublished()->getTimestamp(), $this->total);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public function getSettings(Environment $environment, bool $cache = true): Setti
return $settings;
}

public function getContentType(string $name, ?Environment $environment = null): ?ContentType
public function getContentType(string $name, Environment $environment = null): ?ContentType
{
if (null === $environment) {
if (null === $currentEnvironment = $this->getCurrentEnvironment()) {
Expand Down Expand Up @@ -369,7 +369,7 @@ public static function getType(string $emsLink): ?string
*
* @return array<mixed>
*/
public function search(null|string|array $type, array $body, int $from = 0, int $size = 10, array $sourceExclude = [], ?string $regex = null, string $index = null)
public function search(null|string|array $type, array $body, int $from = 0, int $size = 10, array $sourceExclude = [], string $regex = null, string $index = null)
{
if (null === $type) {
$types = [];
Expand Down Expand Up @@ -407,7 +407,7 @@ public function search(null|string|array $type, array $body, int $from = 0, int
/**
* @param string[] $types
*/
public function initializeCommonSearch(array $types, ?AbstractQuery $query = null): Search
public function initializeCommonSearch(array $types, AbstractQuery $query = null): Search
{
$query = $this->elasticaService->filterByContentTypes($query, $types);

Expand Down Expand Up @@ -477,7 +477,7 @@ public function searchBy(string $type, array $parameters, int $from = 0, int $si
*
* @return array{_id: string, _type?: string, _source: array<mixed>}
*/
public function searchOne(null|string|array $type, array $body, ?string $indexRegex = null): array
public function searchOne(null|string|array $type, array $body, string $indexRegex = null): array
{
$this->logger->debug('ClientRequest : searchOne for {type}', ['type' => $type, 'body' => $body, 'indexRegex' => $indexRegex]);
$search = $this->search($type, $body, 0, 2, [], $indexRegex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct(
*
* @return array<mixed>
*/
public function search(null|string|array $type, array $body, int $from = 0, int $size = 10, array $sourceExclude = [], ?string $regex = null, ?string $index = null): array
public function search(null|string|array $type, array $body, int $from = 0, int $size = 10, array $sourceExclude = [], string $regex = null, string $index = null): array
{
$client = $this->manager->getDefault();

Expand All @@ -50,7 +50,7 @@ public function search(null|string|array $type, array $body, int $from = 0, int
* @param string|string[]|null $type
* @param array<mixed> $body
*/
public function searchOne(null|string|array $type, array $body, ?string $indexRegex = null): DocumentInterface
public function searchOne(null|string|array $type, array $body, string $indexRegex = null): DocumentInterface
{
try {
return Document::fromArray($this->manager->getDefault()->searchOne($type, $body, $indexRegex));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ public function __construct(
}
}

/**
* {@inheritDoc}
*/
public function addEnvironment(string $name, array $config): void
{
if ($this->emschEnv && !isset($config[Environment::DEFAULT])) {
Expand Down
6 changes: 0 additions & 6 deletions EMS/client-helper-bundle/src/Helper/Routing/BaseRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,11 @@ abstract class BaseRouter implements RouterInterface, RequestMatcherInterface
protected ?UrlMatcher $matcher = null;
protected ?UrlGenerator $generator = null;

/**
* {@inheritdoc}
*/
public function getContext(): RequestContext
{
return $this->context;
}

/**
* {@inheritdoc}
*/
public function setContext(RequestContext $context): void
{
$this->context = $context;
Expand Down
4 changes: 2 additions & 2 deletions EMS/client-helper-bundle/src/Helper/Routing/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static function fromData(string $name, array $data): self
/**
* @param string[] $locales
*/
public function addToCollection(RouteCollection $collection, array $locales = [], ?string $prefix = null): void
public function addToCollection(RouteCollection $collection, array $locales = [], string $prefix = null): void
{
$path = $this->options['path'];

Expand All @@ -66,7 +66,7 @@ public function addToCollection(RouteCollection $collection, array $locales = []
}
}

private function createRoute(string $path, ?string $locale = null): SymfonyRoute
private function createRoute(string $path, string $locale = null): SymfonyRoute
{
$defaults = $this->options['defaults'];

Expand Down
2 changes: 1 addition & 1 deletion EMS/client-helper-bundle/src/Helper/Search/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public function handleRequest(Request $request): void
* @param array<mixed> $aggregation
* @param string[] $types
*/
public function handleAggregation(array $aggregation, array $types = [], ?AbstractQuery $queryFilters = null): void
public function handleAggregation(array $aggregation, array $types = [], AbstractQuery $queryFilters = null): void
{
$this->queryTypes = $types;
$this->queryFilters = $queryFilters;
Expand Down
2 changes: 1 addition & 1 deletion EMS/client-helper-bundle/src/Twig/RoutingRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function createUrl(string $relativePath, string $path, array $parameters
return $url;
}

public function transform(string $content, ?string $locale = null, ?string $baseUrl = null): string
public function transform(string $content, string $locale = null, string $baseUrl = null): string
{
return $this->transformer->transform($content, ['locale' => $locale, 'baseUrl' => $baseUrl]);
}
Expand Down
6 changes: 3 additions & 3 deletions EMS/common-bundle/src/Common/Command/AbstractCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ protected function getOptionBool(string $name): bool
return true === $this->input->getOption($name);
}

protected function getOptionInt(string $name, ?int $default = null): int
protected function getOptionInt(string $name, int $default = null): int
{
if (null !== $option = $this->input->getOption($name)) {
return \intval($option);
Expand All @@ -178,7 +178,7 @@ protected function getOptionInt(string $name, ?int $default = null): int
return $default;
}

protected function getOptionFloat(string $name, ?float $default = null): float
protected function getOptionFloat(string $name, float $default = null): float
{
if (null !== $option = $this->input->getOption($name)) {
return \floatval($option);
Expand Down Expand Up @@ -206,7 +206,7 @@ protected function getOptionIntNull(string $name): ?int
return null === $option ? null : \intval($option);
}

protected function getOptionString(string $name, ?string $default = null): string
protected function getOptionString(string $name, string $default = null): string
{
if (null !== $option = $this->input->getOption($name)) {
return \strval($option);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function getContentTypes(): array
return $contentTypes;
}

public function runCommand(string $command, ?OutputInterface $output = null): void
public function runCommand(string $command, OutputInterface $output = null): void
{
$job = [
'class' => 'EMS\\CoreBundle\\Entity\\Job',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct(private readonly Client $client, string $contentType
/**
* @param array<string, mixed> $rawData
*/
public function create(array $rawData, ?string $ouuid = null): DraftInterface
public function create(array $rawData, string $ouuid = null): DraftInterface
{
$resource = $this->makeResource('create', $ouuid);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function uploadContents(string $contents, string $filename, string $mimeT
return $hash;
}

public function uploadFile(string $realPath, ?string $mimeType = null, ?string $filename = null, ?callable $callback = null): string
public function uploadFile(string $realPath, string $mimeType = null, string $filename = null, callable $callback = null): string
{
$hash = $this->hashFile($realPath);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function healthStatus(): string
return $status;
}

public function refresh(?string $index = null): bool
public function refresh(string $index = null): bool
{
$success = $this->client->post('/api/search/refresh', [
'index' => $index,
Expand Down
4 changes: 2 additions & 2 deletions EMS/common-bundle/src/Common/CoreApi/TokenStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function giveBaseUrl(): string
return $baseUrl;
}

public function getToken(?string $baseUrl = null): ?string
public function getToken(string $baseUrl = null): ?string
{
if (null !== $baseUrl) {
$cacheBaseUrl = $this->apiCacheBaseUrl();
Expand All @@ -65,7 +65,7 @@ public function getToken(?string $baseUrl = null): ?string
return null;
}

public function giveToken(?string $baseUrl = null): string
public function giveToken(string $baseUrl = null): string
{
$token = $this->getToken($baseUrl);
if (null === $token) {
Expand Down
3 changes: 0 additions & 3 deletions EMS/common-bundle/src/Common/File/FileReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

final class FileReader implements FileReaderInterface
{
/**
* {@inheritDoc}
*/
public function getData(string $filename, bool $skipFirstRow = false, string $encoding = null): array
{
$reader = IOFactory::createReaderForFile($filename);
Expand Down
6 changes: 3 additions & 3 deletions EMS/common-bundle/src/Common/Standard/Hash.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@

final class Hash
{
public static function string(string $value, ?string $prefix = null): string
public static function string(string $value, string $prefix = null): string
{
return self::hash($value, $prefix);
}

/**
* @param array<mixed> $value
*/
public static function array(array $value, ?string $prefix = null): string
public static function array(array $value, string $prefix = null): string
{
return self::hash(\EMS\Helpers\Standard\Json::encode($value), $prefix);
}

private static function hash(string $value, ?string $prefix = null): string
private static function hash(string $value, string $prefix = null): string
{
return $prefix.\sha1($value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface DataInterface
*
* @throws CoreApiExceptionInterface
*/
public function create(array $rawData, ?string $ouuid = null): DraftInterface;
public function create(array $rawData, string $ouuid = null): DraftInterface;

/**
* @throws CoreApiExceptionInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function addChunk(string $hash, string $chunk): int;

public function uploadContents(string $contents, string $filename, string $mimeType): string;

public function uploadFile(string $realPath, ?string $mimeType = null, ?string $filename = null, ?callable $callback = null): string;
public function uploadFile(string $realPath, string $mimeType = null, string $filename = null, callable $callback = null): string;

public function uploadStream(StreamInterface $stream, string $filename, string $mimeType): string;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function version(): string;

public function healthStatus(): string;

public function refresh(?string $index = null): bool;
public function refresh(string $index = null): bool;

/**
* @return string[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface PdfGeneratorInterface
{
public function createOptionsFromHtml(string $html): PdfPrintOptions;

public function generateResponseFromHtml(string $html, ?PdfPrintOptions $options = null): Response;
public function generateResponseFromHtml(string $html, PdfPrintOptions $options = null): Response;

public function generateStreamedResponseFromHtml(string $html, ?PdfPrintOptions $options = null): StreamedResponse;
public function generateStreamedResponseFromHtml(string $html, PdfPrintOptions $options = null): StreamedResponse;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function __construct(
) {
}

public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
public function collect(Request $request, Response $response, \Throwable $exception = null): void
{
$this->data['nb_queries'] = $this->logger->getNbQueries();
$this->data['queries'] = $this->logger->getQueries();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@

class EMSCommonExtension extends Extension
{
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container): void
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
Expand Down
2 changes: 1 addition & 1 deletion EMS/common-bundle/src/Elasticsearch/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function request($path, $method = Request::GET, $data = [], array $query
return $response;
}

public function setStopwatch(?Stopwatch $stopwatch = null): void
public function setStopwatch(Stopwatch $stopwatch = null): void
{
$this->stopwatch = $stopwatch;
}
Expand Down
Loading
Loading