Skip to content

PHP 8.3+ modernization: native types, #[Override], quick wins - #72

Merged
cuppett merged 4 commits into
mainfrom
feat/update-version-matrix
Mar 29, 2026
Merged

cuppett merged 4 commits into
mainfrom
feat/update-version-matrix

Conversation

@cuppett

@cuppett cuppett commented Mar 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add native type declarations to ~130+ methods and ~45 properties across traits, kinds, instances, patches, and auth providers
  • Add #[\Override] attributes to ~40+ methods that implement interfaces or override parent class methods
  • Apply PHP 8.0–8.3 quick wins: constructor promotion (KubernetesCluster), null-safe operators, replace call_user_func with direct closure invocation
  • Drop PHP 8.2 from CI matrix, add Laravel 13 and Kubernetes 1.35 support
  • Update documentation references from PHP 8.2 to PHP 8.3 throughout

Key changes

Type safety:

  • All trait properties now have native types (?string, bool, string, array, ?KubernetesCluster, etc.)
  • All fluent/builder methods declare : static return types
  • Union types where needed: JsonPatch|array, string|array (exec/attach return real arrays for WebSocket responses)
  • Static properties in all Kind classes typed consistently with their trait declarations

#[\Override]:

  • RunsClusterOperations trait methods implementing InteractsWithK8sCluster
  • toArray() / toJson() across K8sResource, Instance, JsonPatch, JsonMergePatch
  • Auth token providers implementing TokenProviderInterface
  • Test setUp(), getPackageProviders(), getEnvironmentSetUp() in TestCase

Correctness fix:

  • exec() and attach() return string|array — HTTP path returns string, WebSocket upgrade path returns array; verified by integration tests

Test plan

  • ./vendor/bin/pint — clean
  • vendor/bin/psalm — clean
  • vendor/bin/phpunit — unit tests pass
  • CI=true vendor/bin/phpunit — 336 integration tests pass against minikube, 7 skipped (EKS/OpenShift)
  • npm run docs:build — docs compile

🤖 Generated with Claude Code

cuppett and others added 3 commits March 29, 2026 06:54
- PHP: ^8.2 -> ^8.3 (CI matrix: 8.3/8.4/8.5)
- Laravel: drop 11.x, add 13.x (now 12+13)
- Testbench: drop 9.x, add 11.x (now 10+11)
- PHPUnit: drop ^10.0 constraint (now ^11.5 only)
- Symfony Process: ^7.3.4 -> ^7.3.4|^8.0 (Laravel 13 compat)
- Illuminate: drop ^11.0 constraint (now ^12.0|^13.0)
- K8s CI matrix: 1.32.9/1.33.5/1.34.1 -> 1.33.10/1.34.6/1.35.3
- Remove Testbench 9.x compat property from TestCase
- Run Pint to fix code style across src/ and tests/
- Update all docs, CLAUDE.md, AGENTS.md, agent config

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add native type declarations, #[\Override] attributes, and modern PHP
patterns throughout the codebase. Key changes:

- Native typed properties and return types across all traits, kinds,
  instances, patches, auth providers, and cluster classes
- #[\Override] attributes on all interface/parent implementations
- Constructor promotion for PhpK8sException, JsonMergePatch, KubernetesCluster
- Null-safe operator in AuthenticatesCluster::getAuthToken()
- Replace call_user_func() with direct closure invocation
- Static property types (?string, bool, string) in HasKind/HasNamespace/HasVersion
  and all 35+ Kind classes and test CRDs
- Parameter types (mixed, union types) on previously untyped params
- Update docs: PHP 8.2 -> 8.3 throughout, rename php-82-modernization.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cuppett
cuppett force-pushed the feat/update-version-matrix branch from cba71e1 to 525cc6c Compare March 29, 2026 12:14
The deploy job already guards on push to main, so running the build
on pull_requests was unnecessary CI overhead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cuppett
cuppett merged commit 58b1f44 into main Mar 29, 2026
36 checks passed
@cuppett
cuppett deleted the feat/update-version-matrix branch March 29, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant