Skip to content

Commit 1e365e8

Browse files
authored
Refactor string concatenation, rule operator_linebreak and bump PHP deps (#210)
1 parent f90e802 commit 1e365e8

File tree

91 files changed

+1973
-849
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1973
-849
lines changed

composer.lock

Lines changed: 1655 additions & 532 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Commands/CreateSchema.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ protected function configure(): void
3838
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
3939
\implode("\n", [
4040
'Specify the path(s) to the CSV files you want to analyze.',
41-
'This can include a direct path to a file or a directory to search with a maximum depth of ' .
42-
Utils::MAX_DIRECTORY_DEPTH . ' levels.',
41+
'This can include a direct path to a file or a directory to search with a maximum depth of '
42+
. Utils::MAX_DIRECTORY_DEPTH . ' levels.',
4343
'Examples: <info>' . \implode('</info>; <info>', [
4444
'p/file.csv',
4545
'p/*.csv',

src/Commands/ValidateCsv.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ protected function configure(): void
4343
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
4444
\implode("\n", [
4545
'Specify the path(s) to the CSV files you want to validate.',
46-
'This can include a direct path to a file or a directory to search with a maximum depth of ' .
47-
Utils::MAX_DIRECTORY_DEPTH . ' levels.',
46+
'This can include a direct path to a file or a directory to search with a maximum depth of '
47+
. Utils::MAX_DIRECTORY_DEPTH . ' levels.',
4848
'Examples: <info>' . \implode('</info>; <info>', [
4949
'p/file.csv',
5050
'p/*.csv',
@@ -90,12 +90,12 @@ protected function configure(): void
9090
\implode("\n", [
9191
"Apply all schemas (also without `filename_pattern`) to all CSV files found as global rules.\n",
9292
'Available options:',
93-
' - <info>auto</info>: If no glob pattern (*) is used for --schema, the schema is applied to all ' .
94-
'found CSV files.',
95-
' - <info>yes|y|1</info>: Apply all schemas to all CSV files, Schemas without `filename_pattern` ' .
96-
'are applied as a global rule.',
97-
' - <info>no|n|0</info>: Apply only schemas with not empty `filename_pattern` and ' .
98-
'match the CSV files.',
93+
' - <info>auto</info>: If no glob pattern (*) is used for --schema, the schema is applied to all '
94+
. 'found CSV files.',
95+
' - <info>yes|y|1</info>: Apply all schemas to all CSV files, Schemas without `filename_pattern` '
96+
. 'are applied as a global rule.',
97+
' - <info>no|n|0</info>: Apply only schemas with not empty `filename_pattern` and '
98+
. 'match the CSV files.',
9999
'Note. If specify the option `--apply-all` without value, it will be treated as "yes".',
100100
'',
101101
]),
@@ -307,8 +307,8 @@ private function printSummary(
307307

308308
if ($errorInCsvCounter > 0) {
309309
$this->out(
310-
"Found <c>{$errorInCsvCounter}</c> issues in {$invalidCsvFiles} " .
311-
"out of {$totalCsvFiles} CSV files.",
310+
"Found <c>{$errorInCsvCounter}</c> issues in {$invalidCsvFiles} "
311+
. "out of {$totalCsvFiles} CSV files.",
312312
$indent,
313313
);
314314
} elseif (!$this->isQuickMode()) {

src/Rules/AbstractRule.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ protected function isEnabledByOption(): bool
178178
if (!\is_bool($this->options)) {
179179
$options = Utils::printList($this->options);
180180
throw new Exception(
181-
"Invalid option {$options} for the \"{$this->getRuleCode()}\" rule. " .
182-
'It should be true|false.',
181+
"Invalid option {$options} for the \"{$this->getRuleCode()}\" rule. "
182+
. 'It should be true|false.',
183183
);
184184
}
185185

@@ -198,8 +198,8 @@ protected function getOptionAsString(): string
198198
if (\is_array($this->options)) {
199199
$options = Utils::printList($this->options);
200200
throw new Exception(
201-
"Invalid option {$options} for the \"{$this->getRuleCode()}\" rule. " .
202-
'It should be int/float/string.',
201+
"Invalid option {$options} for the \"{$this->getRuleCode()}\" rule. "
202+
. 'It should be int/float/string.',
203203
);
204204
}
205205

@@ -218,8 +218,8 @@ protected function getOptionAsInt(): int
218218
if ($this->options === '' || !\is_numeric($this->options)) {
219219
$options = Utils::printList($this->options);
220220
throw new Exception(
221-
"Invalid option {$options} for the \"{$this->getRuleCode()}\" rule. " .
222-
'It should be integer.',
221+
"Invalid option {$options} for the \"{$this->getRuleCode()}\" rule. "
222+
. 'It should be integer.',
223223
);
224224
}
225225

@@ -238,8 +238,8 @@ protected function getOptionAsFloat(): float
238238
if ($this->options === '' || !\is_numeric($this->options)) {
239239
$options = Utils::printList($this->options);
240240
throw new Exception(
241-
"Invalid option {$options} for the \"{$this->getRuleCode()}\" rule. " .
242-
'It should be integer/float.',
241+
"Invalid option {$options} for the \"{$this->getRuleCode()}\" rule. "
242+
. 'It should be integer/float.',
243243
);
244244
}
245245

@@ -260,8 +260,8 @@ protected function getOptionAsArray(): array
260260
if (!\is_array($this->options)) {
261261
$options = Utils::printList($this->options);
262262
throw new Exception(
263-
"Invalid option {$options} for the \"{$this->getRuleCode()}\" rule. " .
264-
'It should be array of strings.',
263+
"Invalid option {$options} for the \"{$this->getRuleCode()}\" rule. "
264+
. 'It should be array of strings.',
265265
);
266266
}
267267

src/Rules/Aggregate/AbstractAggregateRuleCombo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ protected function validateComboAggregate(array $colValues, string $mode): ?stri
8787
}
8888

8989
if (!static::compare($expected, $actual, $mode)) {
90-
return "The {$name} in the column is \"<c>{$actual}</c>\", " .
91-
"which is {$verb} than the {$prefix}expected \"<green>{$expected}</green>\"";
90+
return "The {$name} in the column is \"<c>{$actual}</c>\", "
91+
. "which is {$verb} than the {$prefix}expected \"<green>{$expected}</green>\"";
9292
}
9393

9494
return null;

src/Rules/Aggregate/ComboContraharmonicMean.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public function getHelpMeta(): array
3030
{
3131
return [
3232
[
33-
'Contraharmonic mean. A function complementary to the harmonic mean. ' .
34-
'A special case of the Lehmer mean, L₂(x), where p = 2.',
33+
'Contraharmonic mean. A function complementary to the harmonic mean. '
34+
. 'A special case of the Lehmer mean, L₂(x), where p = 2.',
3535
'See: https://en.wikipedia.org/wiki/Contraharmonic_mean',
3636
],
3737
[],

src/Rules/Aggregate/ComboCount.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public function getHelpMeta(): array
3030
return [
3131
[
3232
'Total number of rows in the CSV file.',
33-
'Since any(!) values are taken into account, ' .
34-
'it only makes sense to use these rules once in any column.',
33+
'Since any(!) values are taken into account, '
34+
. 'it only makes sense to use these rules once in any column.',
3535
],
3636
[],
3737
];

src/Rules/Aggregate/ComboCountZero.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public function getHelpMeta(): array
2929
{
3030
return [
3131
[
32-
'Number of zero values. ' .
33-
"Any text and spaces (i.e. anything that doesn't look like a number) will be converted to 0.",
32+
'Number of zero values. '
33+
. "Any text and spaces (i.e. anything that doesn't look like a number) will be converted to 0.",
3434
],
3535
[],
3636
];

src/Rules/Aggregate/ComboGeometricMean.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public function getHelpMeta(): array
3030
{
3131
return [
3232
[
33-
'Geometric mean. A type of mean which indicates the central tendency or typical value of' .
34-
' a set of numbers',
33+
'Geometric mean. A type of mean which indicates the central tendency or typical value of'
34+
. ' a set of numbers',
3535
'by using the product of their values (as opposed to the arithmetic mean which uses their sum).',
3636
'See: https://en.wikipedia.org/wiki/Geometric_mean',
3737
],

src/Rules/Aggregate/ComboHarmonicMean.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public function getHelpMeta(): array
3030
{
3131
return [
3232
[
33-
'Harmonic mean (subcontrary mean). The harmonic mean can be expressed as the reciprocal of ' .
34-
'the arithmetic mean of the reciprocals.',
33+
'Harmonic mean (subcontrary mean). The harmonic mean can be expressed as the reciprocal of '
34+
. 'the arithmetic mean of the reciprocals.',
3535
'Appropriate for situations when the average of rates is desired.',
3636
'See: https://en.wikipedia.org/wiki/Harmonic_mean',
3737
],

0 commit comments

Comments
 (0)