Fix static analysis: widen return types to static, add explicit Container/K8sSecret methods#20
Fix static analysis: widen return types to static, add explicit Container/K8sSecret methods#20
Conversation
…ntainer/K8sSecret methods - Change get(), create(), createOrUpdate(), syncWithCluster() return types from K8sResource to static so concrete subclass methods are visible to PHPStan/Psalm after cluster operations - Change updateStatus(), jsonPatchStatus(), jsonMergePatchStatus() from self to static to maintain the covariant chain in subclasses - Add explicit setName/getName, setImagePullPolicy/getImagePullPolicy, setCommand/getCommand, setArgs/getArgs, setWorkingDir/getWorkingDir methods on Container instead of relying on __call magic - Add explicit setType/getType methods on K8sSecret instead of relying on __call magic Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Cancels in-progress runs when a new push arrives on the same branch, but leaves main runs to complete so coverage reports aren't dropped. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Greptile SummaryThis PR improves static analysis correctness across the library by widening return types to The main concern is in Other changes:
Confidence Score: 4/5Safe to merge after clarifying the intentional scope of the composer.json constraint narrowing and documenting it in the PR description or changelog. All PHP source changes (return type widening, explicit Container/K8sSecret methods, is_array guards) are correct and clean. The one P1 finding is in composer.json: dropping Laravel 13 and Symfony 8 from production constraints is an undocumented breaking change for library consumers that the author should either document as intentional or revert. composer.json — constraint narrowing silently drops Laravel 13 and Symfony 8 support for library consumers. Important Files Changed
Reviews (4): Last reviewed commit: "Fix K8sScale::create() return type to st..." | Re-trigger Greptile |
- Restore proper union type hints on jsonPatchStatus/jsonMergePatchStatus - Use imported class names instead of FQCN - Fix @throws annotations to use short class names - Remove minimum-stability: dev from composer.json Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- illuminate/macroable and illuminate/support: ^13.0 - symfony/process: ^8.0 - orchestra/testbench: ^11.0 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
illuminate/* and testbench are coupled to Laravel 12 on PHP 8.3: - illuminate/macroable + illuminate/support: ^12.0 - symfony/process: ^7.4 (symfony 8 requires PHP 8.4) - orchestra/testbench: ^10.9.0 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PHP 8.5 enforces covariant return type compatibility strictly. K8sScale overrode create() with K8sResource instead of static, causing a fatal error. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
Follow-up to partial type-safety fixes already landed (refresh, refreshOriginal, apply, jsonPatch, jsonMergePatch).
RunsClusterOperations— changedget(),create(),createOrUpdate(),syncWithCluster(),updateStatus(),jsonPatchStatus(),jsonMergePatchStatus()return types tostatic. Without this, code like$cluster->secret()->get()->getData()causes static analyzers to report undefined methods since the return type is widened to the base class.__callmagic reliance with explicit typed methods onContainer(setName/getName,setImagePullPolicy/getImagePullPolicy,setCommand/getCommand,setArgs/getArgs,setWorkingDir/getWorkingDir) andK8sSecret(setType/getType). The__callfallback remains for ad-hoc/CRD attributes.Test plan
vendor/bin/phpunit --filter Test$passes (unit tests)vendor/bin/psalmpasses with no new issuesCI=true vendor/bin/phpunit)🤖 Generated with Claude Code