Skip to content

Commit c335cb2

Browse files
committed
chore: update dependencies and fix mago lint/analyze finding
- bump composer + tooling lockfiles - annotate non-negative-int args for stricter str_repeat checks - guard str_repeat counts against underflow - drop redundant pragmas, docblocks and dead test assertions - disable no-duplicate-match-arm for intentional mapping tables
1 parent bc34458 commit c335cb2

26 files changed

Lines changed: 340 additions & 319 deletions

File tree

composer.lock

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

mago.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ no-redundant-file = { enabled = false }
114114
no-sprintf-concat = { enabled = false }
115115
no-global = { enabled = false }
116116
no-redundant-method-override = { enabled = false }
117+
no-duplicate-match-arm = { enabled = false }
117118
no-redundant-else = { enabled = true, level = "warning" }
118119
no-redundant-variable = { enabled = true, level = "warning" }
119120
strict-types = { enabled = true, level = "error" }

src/bridge/monolog/http/src/Flow/Bridge/Monolog/Http/Sanitization/Mask.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ public function sanitize(string $value): string
6262
return $value;
6363
}
6464

65-
return substr($value, 0, $this->offset) . str_repeat($this->character, $length - $this->offset);
65+
return substr($value, 0, $this->offset) . str_repeat($this->character, max(0, $length - $this->offset));
6666
}
6767
}

src/bridge/symfony/postgresql-session/src/Flow/Bridge/Symfony/PostgreSQLSession/FlowPostgreSqlSessionHandler.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ public function purgeExpired(): int
191191
* Otherwise long-lived sessions whose payload never changes would be
192192
* garbage-collected even if still in active use.
193193
*/
194-
// @mago-expect analysis:incompatible-parameter-name
195194
#[Override]
196195
public function updateTimestamp(#[SensitiveParameter] string $sessionId, string $data): bool
197196
{

src/bridge/symfony/telemetry-bundle/src/Flow/Bridge/Symfony/TelemetryBundle/Instrumentation/Twig/TracingTwigExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function leave(Profile $profile): void
9393
// @mago-expect analysis:impossible-assignment
9494
$spanData = $this->activeSpans[$profile];
9595

96-
// @mago-expect analysis:no-value(2),redundant-type-comparison(2),redundant-logical-operation(2)
96+
// @mago-expect analysis:no-value,redundant-type-comparison,redundant-logical-operation(2)
9797
if (is_array($spanData) && $spanData['tracer'] instanceof Tracer && $spanData['span'] instanceof Span) {
9898
// OTEL spec: instrumentation leaves the status Unset on success.
9999
$spanData['tracer']->complete($spanData['span']);

src/bridge/symfony/telemetry-bundle/src/Flow/Bridge/Symfony/TelemetryBundle/Logger/ConsoleVerbosityLevels.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
*/
3232
final readonly class ConsoleVerbosityLevels
3333
{
34+
/**
35+
* @var array<string, int>
36+
*/
3437
private const array CONSTANT_NAMES = [
3538
'VERBOSITY_QUIET' => OutputInterface::VERBOSITY_QUIET,
3639
'VERBOSITY_NORMAL' => OutputInterface::VERBOSITY_NORMAL,

src/core/etl/src/Flow/ETL/Formatter/ASCII/ASCIIValue.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,24 @@ public static function mb_str_pad(
6464
$rightPaddingLength = $paddingRequired - $leftPaddingLength;
6565

6666
return (
67-
mb_substr(str_repeat($padding, $leftPaddingLength), 0, $leftPaddingLength, $encoding)
67+
mb_substr(str_repeat($padding, max(0, $leftPaddingLength)), 0, $leftPaddingLength, $encoding)
6868
. $input
69-
. mb_substr(str_repeat($padding, $rightPaddingLength), 0, $rightPaddingLength, $encoding)
69+
. mb_substr(
70+
str_repeat($padding, max(0, $rightPaddingLength)),
71+
0,
72+
$rightPaddingLength,
73+
$encoding,
74+
)
7075
);
7176
}
7277
}
7378

7479
return $result;
7580
}
7681

82+
/**
83+
* @return int<0, max>
84+
*/
7785
public function length(int|bool $truncate = 20): int
7886
{
7987
return mb_strlen($this->print($truncate));

src/core/etl/src/Flow/ETL/Formatter/ASCII/Body.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ public function __construct(
1515
private Rows $rows,
1616
) {}
1717

18+
/**
19+
* @return int<0, max>
20+
*/
1821
public function maximumLength(string $entry, int|bool $truncate = 20): int
1922
{
2023
$max = 0;

src/core/etl/src/Flow/ETL/Function/Sanitize.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function eval(Row $row, FlowContext $context): ?string
4141
$size = mb_strlen($val);
4242

4343
if ($skipCharacters !== null && $size > $skipCharacters) {
44-
return mb_substr($val, 0, $skipCharacters) . str_repeat($placeholder, $size - $skipCharacters);
44+
return mb_substr($val, 0, $skipCharacters) . str_repeat($placeholder, max(0, $size - $skipCharacters));
4545
}
4646

4747
return str_repeat($placeholder, $size);

src/core/etl/src/Flow/ETL/Processor/BatchingProcessor.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public function process(Generator $rows, FlowContext $context): Generator
4646
$buffer[] = $row;
4747

4848
if (count($buffer) >= $this->size) {
49-
// @mago-ignore analysis:mixed-argument
5049
yield new Rows(...array_splice($buffer, 0, $this->size));
5150
}
5251
}

0 commit comments

Comments
 (0)