Skip to content

Commit 3e5140a

Browse files
committed
fix: dependencies, static analysis
1 parent a5772a5 commit 3e5140a

13 files changed

Lines changed: 608 additions & 285 deletions

File tree

composer.lock

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

phpstan.neon

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,27 @@ parameters:
164164
-
165165
path: src/lib/parquet/src/Flow/Parquet/Dremel/DremelShredder.php
166166
identifier: assign.propertyType
167+
# brick/math 0.12-0.14 vs 0.15+ compatibility shim — branches differ per installed version
168+
-
169+
path: src/core/etl/src/Flow/Calculator/Calculator.php
170+
identifier: function.alreadyNarrowedType
171+
reportUnmatched: false
172+
-
173+
path: src/core/etl/src/Flow/Calculator/Calculator.php
174+
identifier: function.impossibleType
175+
reportUnmatched: false
176+
-
177+
path: src/core/etl/src/Flow/Calculator/Calculator.php
178+
identifier: method.nonObject
179+
reportUnmatched: false
180+
-
181+
path: src/core/etl/src/Flow/Calculator/Calculator.php
182+
identifier: classConstant.notFound
183+
reportUnmatched: false
184+
-
185+
path: src/core/etl/src/Flow/Calculator/Calculator.php
186+
identifier: argument.type
187+
reportUnmatched: false
167188

168189
includes:
169190
- tools/phpstan/vendor/spaze/phpstan-disallowed-calls/extension.neon

src/bridge/symfony/filesystem-cache/tests/Flow/Bridge/Symfony/FilesystemCache/Tests/Unit/FlowFilesystemCacheAdapterTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Flow\Bridge\Symfony\FilesystemCache\Tests\Unit\Double\{FailingMvFilesystem, SpyLogger, SpyMarshaller};
1010
use PHPUnit\Framework\TestCase;
1111
use Symfony\Component\Cache\Exception\InvalidArgumentException;
12+
use Symfony\Component\Cache\Marshaller\DefaultMarshaller;
1213

1314
final class FlowFilesystemCacheAdapterTest extends TestCase
1415
{
@@ -240,7 +241,8 @@ public function test_save_with_zero_lifetime_writes_zero_expiry_header() : void
240241

241242
public function test_save_writes_file_with_three_line_format() : void
242243
{
243-
$adapter = $this->context->adapter();
244+
$marshaller = new DefaultMarshaller(useIgbinarySerialize: false);
245+
$adapter = $this->context->adapter(marshaller: $marshaller);
244246
$item = $adapter->getItem('key1');
245247
$item->set('value1');
246248
$item->expiresAfter(600);

src/core/etl/src/Flow/Calculator/Calculator.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,8 @@ public function add(int|float|string $a, int|float|string $b) : int|float
3838
public function divide(int|float|string $a, int|float|string $b, ?int $scale = null, ?Rounding $rounding = null) : int|float
3939
{
4040
try {
41-
if ($scale === null && $rounding === null) {
42-
$aDecimal = BigDecimal::of((string) $a);
43-
$result = $aDecimal->dividedBy(BigDecimal::of((string) $b), $aDecimal->getScale());
44-
45-
if (!self::hasNonZeroFractionalPart($result)) {
46-
return $result->toInt();
47-
}
48-
}
41+
$aDecimal = BigDecimal::of((string) $a);
42+
$effectiveScale = $scale ?? $aDecimal->getScale();
4943

5044
$useNewNaming = \defined('Brick\Math\RoundingMode::Up');
5145

@@ -62,7 +56,7 @@ public function divide(int|float|string $a, int|float|string $b, ?int $scale = n
6256
default => $useNewNaming ? RoundingMode::Unnecessary : RoundingMode::UNNECESSARY,
6357
};
6458

65-
$result = BigDecimal::of((string) $a)->dividedBy(BigDecimal::of((string) $b), $scale, $brickMode);
59+
$result = $aDecimal->dividedBy(BigDecimal::of((string) $b), $effectiveScale, $brickMode);
6660

6761
if (!self::hasNonZeroFractionalPart($result)) {
6862
return $result->toInt();
@@ -132,10 +126,10 @@ public function subtract(int|float|string $a, int|float|string $b) : int|float
132126

133127
private static function hasNonZeroFractionalPart(BigDecimal $result) : bool
134128
{
135-
if (method_exists($result, 'hasNonZeroFractionalPart')) { // @phpstan-ignore function.alreadyNarrowedType
129+
if (\method_exists($result, 'hasNonZeroFractionalPart')) {
136130
return $result->hasNonZeroFractionalPart();
137131
}
138132

139-
return !$result->getFractionalPart()->isZero(); // @phpstan-ignore method.nonObject
133+
return !$result->getFractionalPart()->isZero();
140134
}
141135
}

src/core/etl/src/Flow/ETL/GroupBy.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,16 @@ public function group(Rows $rows, FlowContext $context) : void
127127
$valuesHash = $this->hash($values);
128128

129129
if (!\array_key_exists($valuesHash, $this->groupedTable)) {
130-
$this->groupedTable[$valuesHash] = [
131-
'values' => $values,
132-
'aggregators' => [],
133-
];
130+
$aggregators = [];
134131

135132
foreach ($this->aggregations as $aggregator) {
136-
$this->groupedTable[$valuesHash]['aggregators'][] = clone $aggregator;
133+
$aggregators[] = clone $aggregator;
137134
}
135+
136+
$this->groupedTable[$valuesHash] = [
137+
'values' => $values,
138+
'aggregators' => $aggregators,
139+
];
138140
}
139141

140142
foreach ($this->groupedTable[$valuesHash]['aggregators'] as $aggregator) {

src/lib/telemetry/src/Flow/Telemetry/Tracer/Sampler/TraceIdRatioBasedSampler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(
4040
));
4141
}
4242

43-
$this->threshold = (int) ($ratio * PHP_INT_MAX);
43+
$this->threshold = $ratio >= 1.0 ? PHP_INT_MAX : (int) ($ratio * PHP_INT_MAX);
4444
}
4545

4646
public function __toString() : string

tools/box/composer.lock

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

0 commit comments

Comments
 (0)