Repository navigation
Conversation
Reviewer's GuideAPIUpdate public PHPDoc parameter and return types to PHPStan-compatible annotations, including the refined attribute-array and non-empty-string types.
ImplementationReplace Psalm-specific assertions and suppressions with PHPStan equivalents or targeted ignores where dynamic attribute values are intentionally cast or treated as CSS data.
ConfigurationReplace Psalm CI jobs and workflow path filters with PHPStan, add PHP 8.5 to the static-analysis matrix, and swap the Composer dependency and command entry for PHPStan.
DocumentationDocument the move to PHPStan and remove the obsolete Psalm badges.
Other changesFiles not grouped.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #289 +/- ##
===========================================
Coverage 100.00% 100.00%
Complexity 1067 1067
===========================================
Files 138 138
Lines 2763 2764 +1
===========================================
+ Hits 2763 2764 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/Tag/Select.php" line_range="20" />
<code_context>
* @link https://www.w3.org/TR/html52/sec-forms.html#the-select-element
*
- * @psalm-type OptionsData = array<array-key, string|Stringable|int|float|null|array<array-key,string|Stringable|int|float|null>>
+ * @phpstan-type OptionsData = (string|Stringable|int|float|null|(string|Stringable|int|float|null)[])[]
*/
final class Select extends NormalTag
</code_context>
<issue_to_address>
**Valid string-keyed inputs fail analysis**
When callers pass string-keyed option data, option or group attribute maps, or CSS classes, pHPStan treats the `[]` annotations in `OptionsData`, the attribute maps, and `$class` as integer-keyed arrays, so it rejects these runtime-supported inputs and reports false analysis errors.
Use explicit `array<array-key, ...>` types for these arrays, including the nested arrays in `OptionsData`.
Also at `src/Tag/Select.php:107`, `src/Tag/Select.php:141-143`, `src/Tag/Optgroup.php:38`, `src/Html.php:2464`.
</issue_to_address>
### Comment 2
<location path="src/Widget/CheckboxList/CheckboxList.php" line_range="337" />
<code_context>
/**
- * @psalm-param Closure(CheckboxItem):string|null $formatter
+ * @param Closure(CheckboxItem):string|null $formatter
*/
public function itemFormatter(?Closure $formatter): self
</code_context>
<issue_to_address>
**Null formatters appear invalid**
When callers pass null to clear a formatter, pHPStan reads `:string|null` as a nullable callback return type, not a nullable callback. The documented parameter therefore excludes `null` even though both methods accept `?Closure`, so callers using `itemFormatter(null)` to clear a formatter get false analysis errors.
Document each formatter as `(Closure(Item): string)|null`, with the actual item class substituted for `Item`.
Also at `src/Widget/RadioList/RadioList.php:318`.
</issue_to_address>Sourcery assessment
Approval pending. 2 findings to address first.
Blocking findings: src/Tag/Select.php:20, src/Widget/CheckboxList/CheckboxList.php:337
Summary by Sourcery
Replace Psalm with PHPStan as the project's static analysis tool.
Enhancements:
Build:
CI:
Documentation:
Chores: