Skip to content

Cast --limit option to int before passing to getReportData - #7

Open
tosfos wants to merge 1 commit into
masterfrom
fix-maintenance-limit-type
Open

tosfos wants to merge 1 commit into
masterfrom
fix-maintenance-limit-type

Conversation

@tosfos

@tosfos tosfos commented Feb 13, 2026

Copy link
Copy Markdown

Summary

Maintenance::getOption( 'limit' ) returns a string when the option is set (e.g. "--limit" => "100" from argv). SemanticReports::getReportData() declares ?int $limit. Passing a string causes a TypeError in PHP 8 when running the script with --limit.

Change

  • File: maintenance/GenerateReport.php
  • Cast the limit option to int when present: $limitOpt = $this->getOption( 'limit' ); then pass $limitOpt !== null ? (int)$limitOpt : null so that when the option is not provided we pass null, and when provided we pass an integer.

Testing

  • php -l maintenance/GenerateReport.php passes.
  • Existing integration tests (invalid args) do not exercise the limit path; this fix is required for valid runs with --limit.

Jira: create SLOP task and add comment (summary, PR link, scores, humorous paragraph, "Work was performed by AI / Cursor Agent").

Work performed by AI / Cursor Agent.

Maintenance::getOption() returns string when the option is set; getReportData()
expects ?int $limit. Passing a string causes TypeError in PHP 8.

Co-authored-by: Cursor <cursoragent@cursor.com>
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