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
3 changes: 3 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the CleverAge/ProcessBundle package.
*
Expand Down Expand Up @@ -33,6 +35,7 @@
'header_comment' => ['header' => $fileHeaderComment],
'modernize_strpos' => true,
'get_class_to_class_keyword' => true,
'declare_strict_types' => true,
])
->setRiskyAllowed(true)
->setFinder(
Expand Down
1 change: 1 addition & 0 deletions src/CleverAgeProcessBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function build(ContainerBuilder $container): void
$container->addCompilerPass(new CheckSerializerCompilerPass());
}

#[\Override]
public function getPath(): string
{
return \dirname(__DIR__);
Expand Down
9 changes: 1 addition & 8 deletions src/Configuration/ProcessConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,7 @@ public function getDependencyGroups(): array
if (null === $this->dependencyGroups) {
$this->dependencyGroups = [];
foreach ($this->getTaskConfigurations() as $taskConfiguration) {
$isInBranch = false;
foreach ($this->dependencyGroups as $branch) {
if (\in_array($taskConfiguration->getCode(), $branch, true)) {
$isInBranch = true;
break;
}
}

$isInBranch = array_any($this->dependencyGroups, static fn ($branch) => \in_array($taskConfiguration->getCode(), $branch, true));
if (!$isInBranch) {
$dependencies = $this->buildDependencies($taskConfiguration);
$dependencies = $this->sortDependencies($dependencies);
Expand Down
4 changes: 1 addition & 3 deletions src/Configuration/TaskConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ public function getOutputs(): array
return $this->outputs;
}

/**
* @deprecated Use getErrorOutputs method instead
*/
#[\Deprecated(message: 'Use getErrorOutputs method instead')]
public function getErrors(): array
{
@trigger_error('Deprecated method, use getErrorOutputs instead', \E_USER_DEPRECATED);
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ protected function appendTaskConfigDefinition(NodeBuilder $definition): void
$definition->arrayNode($nodeName)
->beforeNormalization()
->ifString()
->then(fn ($item): array => [$item])->end()
->then(static fn ($item): array => [$item])->end()
->prototype('scalar');
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/Filesystem/CsvFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ public function __construct(
/**
* Will return a resource if the file was created using a resource.
*/
#[\Override]
public function getFilePath(): string
{
return $this->filePath;
}

#[\Override]
protected function getResourceName(): string
{
return "CSV file '{$this->filePath}'";
Expand Down
1 change: 1 addition & 0 deletions src/Logger/TaskProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

class TaskProcessor extends AbstractProcessor
{
#[\Override]
public function __invoke(LogRecord $record): LogRecord
{
$record = parent::__invoke($record);
Expand Down
1 change: 1 addition & 0 deletions src/Logger/TransformerProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

class TransformerProcessor extends AbstractProcessor
{
#[\Override]
public function __invoke(LogRecord $record): LogRecord
{
$record = parent::__invoke($record);
Expand Down
2 changes: 2 additions & 0 deletions src/Task/File/Csv/AbstractCsvTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/
abstract class AbstractCsvTask extends AbstractCsvResourceTask
{
#[\Override]
protected function initFile(ProcessState $state): void
{
if ($this->csv instanceof CsvResource) {
Expand All @@ -41,6 +42,7 @@ protected function initFile(ProcessState $state): void
);
}

#[\Override]
protected function configureOptions(OptionsResolver $resolver): void
{
parent::configureOptions($resolver);
Expand Down
1 change: 1 addition & 0 deletions src/Task/File/Csv/CsvReaderTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ protected function getHeaders(ProcessState $state, array $options): ?array
return $options['headers'];
}

#[\Override]
protected function configureOptions(OptionsResolver $resolver): void
{
parent::configureOptions($resolver);
Expand Down
4 changes: 4 additions & 0 deletions src/Task/File/Csv/CsvSplitterTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
class CsvSplitterTask extends InputCsvReaderTask
{
#[\Override]
public function execute(ProcessState $state): void
{
$options = $this->getOptions($state);
Expand All @@ -49,6 +50,7 @@ public function execute(ProcessState $state): void
* return true if the task has a next element
* return false if the task has terminated it's iteration.
*/
#[\Override]
public function next(ProcessState $state): bool
{
if (!$this->csv instanceof CsvResource) {
Expand All @@ -64,6 +66,7 @@ public function next(ProcessState $state): bool
return !$endOfFile;
}

#[\Override]
public function finalize(ProcessState $state): void
{
if ($this->csv instanceof CsvResource) {
Expand Down Expand Up @@ -100,6 +103,7 @@ protected function splitCsv(CsvResource $csv, int $maxLines): string
return $tmpFilePath;
}

#[\Override]
protected function configureOptions(OptionsResolver $resolver): void
{
parent::configureOptions($resolver);
Expand Down
1 change: 1 addition & 0 deletions src/Task/File/Csv/CsvWriterTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function proceed(ProcessState $state): void
$state->setOutput($this->csv->getFilePath());
}

#[\Override]
protected function configureOptions(OptionsResolver $resolver): void
{
parent::configureOptions($resolver);
Expand Down
2 changes: 2 additions & 0 deletions src/Task/File/Csv/InputCsvReaderTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
class InputCsvReaderTask extends CsvReaderTask
{
#[\Override]
protected function getOptions(ProcessState $state): array
{
$options = parent::getOptions($state);
Expand All @@ -31,6 +32,7 @@ protected function getOptions(ProcessState $state): array
return $options;
}

#[\Override]
protected function configureOptions(OptionsResolver $resolver): void
{
parent::configureOptions($resolver);
Expand Down
2 changes: 2 additions & 0 deletions src/Task/File/InputFileReaderTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
class InputFileReaderTask extends FileReaderTask
{
#[\Override]
protected function getOptions(ProcessState $state): array
{
$options = parent::getOptions($state);
Expand All @@ -31,6 +32,7 @@ protected function getOptions(ProcessState $state): array
return $options;
}

#[\Override]
protected function configureOptions(OptionsResolver $resolver): void
{
parent::configureOptions($resolver);
Expand Down
3 changes: 3 additions & 0 deletions src/Task/File/InputFolderBrowserTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ public function flush(ProcessState $state): void
$state->setSkipped(true);
}

#[\Override]
public function initialize(ProcessState $state): void
{
parent::getOptions($state);
}

#[\Override]
protected function configureOptions(OptionsResolver $resolver): void
{
parent::configureOptions($resolver);
Expand All @@ -47,6 +49,7 @@ protected function configureOptions(OptionsResolver $resolver): void
$resolver->setAllowedTypes('base_folder_path', ['string']);
}

#[\Override]
protected function getOptions(ProcessState $state): array
{
$options = parent::getOptions($state);
Expand Down
2 changes: 2 additions & 0 deletions src/Task/File/InputLineReaderTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
class InputLineReaderTask extends LineReaderTask
{
#[\Override]
protected function getOptions(ProcessState $state): array
{
$options = parent::getOptions($state);
Expand All @@ -31,6 +32,7 @@ protected function getOptions(ProcessState $state): array
return $options;
}

#[\Override]
protected function configureOptions(OptionsResolver $resolver): void
{
parent::configureOptions($resolver);
Expand Down
1 change: 1 addition & 0 deletions src/Task/FilterTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class FilterTask extends AbstractConfigurableTask
{
use ConditionTrait;

#[\Override]
public function initialize(ProcessState $state): void
{
parent::initialize($state);
Expand Down
1 change: 1 addition & 0 deletions src/Task/IterableBatchTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function __construct(
) {
}

#[\Override]
public function initialize(ProcessState $state): void
{
parent::initialize($state);
Expand Down
1 change: 1 addition & 0 deletions src/Task/Process/ProcessExecutorTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function execute(ProcessState $state): void
$state->setOutput($output);
}

#[\Override]
public function initialize(ProcessState $state): void
{
parent::initialize($state);
Expand Down
2 changes: 1 addition & 1 deletion src/Task/Process/ProcessLauncherTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ function (Options $options, $value) {
$resolver->setAllowedTypes('sleep_interval', ['integer', 'double']);
$resolver->setAllowedTypes('sleep_interval_after_launch', ['integer', 'double']);
$resolver->setAllowedTypes('sleep_on_finalize_interval', ['integer', 'double']);
$microsecondNormalizer = fn (Options $options, $value): int => (int) ($value * 1_000_000);
$microsecondNormalizer = static fn (Options $options, $value): int => (int) ($value * 1_000_000);
$resolver->setNormalizer('sleep_interval', $microsecondNormalizer);
$resolver->setNormalizer('sleep_interval_after_launch', $microsecondNormalizer);
$resolver->setNormalizer('sleep_on_finalize_interval', $microsecondNormalizer);
Expand Down
1 change: 1 addition & 0 deletions src/Task/SplitJoinLineTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
class SplitJoinLineTask extends AbstractIterableOutputTask
{
#[\Override]
public function next(ProcessState $state): bool
{
$valid = parent::next($state);
Expand Down
2 changes: 1 addition & 1 deletion src/Transformer/CachedTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function configureOptions(OptionsResolver $resolver): void
$resolver->setAllowedTypes('ttl', ['null', 'string', \DateTimeInterface::class]);
$resolver->setNormalizer(
'ttl',
function (Options $options, $value) {
static function (Options $options, $value) {
/*
* Best use is a relative date string like "+1 hour".
*
Expand Down
2 changes: 1 addition & 1 deletion src/Transformer/RulesTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function configureRuleOptions(OptionsResolver $resolver, ?array $expressi
};

$resolver->setNormalizer('condition', $expressionNormalizer);
$resolver->setNormalizer('default', function (Options $options, $value) {
$resolver->setNormalizer('default', static function (Options $options, $value) {
if ($value && $options['condition']) {
throw new \InvalidArgumentException('A rule cannot have a condition and be the default in the same time');
}
Expand Down
Loading