Save to database #13
@@ -1,51 +0,0 @@
|
|||||||
# PHPStan level 8 — first run
|
|
||||||
|
|
||||||
**Resolved.** All 22 errors below were closed by adding the missing
|
|
||||||
array-shape docblocks (plus two `(int) strtotime()` casts and an
|
|
||||||
`array_values()` re-index in `ContributionCollection`). `composer phpstan`
|
|
||||||
now reports zero errors. Kept here as a record of what level 8 flagged on
|
|
||||||
first run.
|
|
||||||
|
|
||||||
`composer phpstan` (level 8, `paths: [src, tests]`) reports 22 errors, all
|
|
||||||
`missingType.iterableValue` / `missingType.generics` — none are correctness
|
|
||||||
bugs, all are missing `@param`/`@return` array-shape docblocks on iterable
|
|
||||||
parameters.
|
|
||||||
|
|
||||||
Run: `docker compose exec graph composer phpstan` (needs `--memory-limit=512M`
|
|
||||||
if run directly via `vendor/bin/phpstan analyse`, the default 128M crashes on
|
|
||||||
this project's parallel workers).
|
|
||||||
|
|
||||||
## `missingType.iterableValue` — `iterable $providers` constructor params
|
|
||||||
|
|
||||||
- `src/Command/RefetchContributionsCommand.php:29`
|
|
||||||
- `src/Service/ContributionAggregator.php:16`
|
|
||||||
- `src/Service/Provider/ProviderHealthChecker.php:11`
|
|
||||||
|
|
||||||
Fix: add `@param iterable<ProviderInterface> $providers` above each
|
|
||||||
constructor.
|
|
||||||
|
|
||||||
## `missingType.iterableValue` — `SvgRenderer.php` (8 occurrences)
|
|
||||||
|
|
||||||
Every `array` parameter/return on `render()`, `buildGrid()`,
|
|
||||||
`computeStats()`, `renderMonthLabels()`, `renderCells()`, `renderLegend()` is
|
|
||||||
untyped. Fix: add `@param array<string, int>` / `@return array<...>` shapes
|
|
||||||
matching each method's actual contents (contribution date=>count maps, grid
|
|
||||||
cell arrays, color arrays).
|
|
||||||
|
|
||||||
## `missingType.generics` / `assign.propertyType` — `ContributionCollection.php`
|
|
||||||
|
|
||||||
- Line 17: `$contributions` is typed `array<int, Contribution>` but
|
|
||||||
`array_map` over `Contribution ...$contributions` in the constructor can
|
|
||||||
produce non-sequential/string keys. Fix: re-index with `array_values()`
|
|
||||||
before assigning, or relax the property type to `array<array-key, Contribution>`.
|
|
||||||
- Line 20: `getIterator(): \ArrayIterator` needs generic types:
|
|
||||||
`@return \ArrayIterator<int, Contribution>`.
|
|
||||||
|
|
||||||
## `missingType.iterableValue` — test doubles/providers (8 occurrences)
|
|
||||||
|
|
||||||
Stub/fixture helper methods with untyped `array` params in
|
|
||||||
`RefetchContributionsCommandTest`, `ContributionAggregatorTest`,
|
|
||||||
`GitHubProviderTest`, `GitLabProviderTest`, `GiteaProviderTest`, and the two
|
|
||||||
PHPUnit data providers in `SvgRendererTest`. Fix: add
|
|
||||||
`@param array<string, int> $fresh` (or the relevant shape) / `@return
|
|
||||||
iterable<string, array{...}>` on the data providers.
|
|
||||||
Reference in New Issue
Block a user