Problem/Motivation

#3605324 fixed the PHPStan config so the CI job now actually runs. It found 17
pre-existing level-6 violations: nullable return types on install hooks that never
return null, type mismatches in the Views filter plugins (getValueOptions,
getAvailableYears, getMonthOptions), and a handful of pedantic test assertions
(assertTrue(true), assertIsInt on a known int, etc.). Full list in the
phpstan-baseline.neon artifact on MR !16.

Proposed resolution

Fix the violations in source and test files:

  • ai_metering.install: narrow ?string to string on hook_update_9008/9010/9011.
  • UsageModelFilter, UsageProviderFilter: match getValueOptions() return type to parent (array|null), remove redundant isset, drop unreachable code.
  • UsagePeriodFilter: fix array key types on getAvailableYears() / getMonthOptions(); annotate $this->query as Sql so PHPStan resolves addWhere().
  • Tests: type mock variables as MockObject&CacheBackendInterface; remove always-true assertions.

Remaining tasks

  • Fix all 17 violations, confirm PHPStan CI goes green.

User interface changes

None.

API changes

None.

Data model changes

None.

AI assistance

N/A

Comments

codeitwisely created an issue. See original summary.

  • 9676531d committed on 3605367-fix-phpstan-level6-violations
    Issue #3605367 by codeitwisely: Fix 17 PHPStan level-6 violations
    

  • 672df842 committed on 3605367-fix-phpstan-level6-violations
    Issue #3605367 by codeitwisely: Fix covariant property warning — use...

  • 672df842 committed on 1.0.x
    Issue #3605367 by codeitwisely: Fix covariant property warning — use...

  • 9676531d committed on 1.0.x
    Issue #3605367 by codeitwisely: Fix 17 PHPStan level-6 violations
    
codeitwisely’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.