Skip to content

Fix Psalm InvalidArgument errors in DocsCommand for route argument type - #86

Merged
tabuna merged 3 commits into
laravel13from
copilot/fix-invalid-argument-errors-again
Mar 18, 2026
Merged

tabuna merged 3 commits into
laravel13from
copilot/fix-invalid-argument-errors-again

Conversation

Copilot AI commented Mar 18, 2026

Copy link
Copy Markdown

Command::argument() returns mixed (string|array), causing Psalm to flag both getByName() and route() calls in DocsCommand::handle() since both expect string/BackedEnum|string.

Changes

  • src/Commands/DocsCommand.php: Replace (string) cast with a /** @var string $routeName */ annotation — Psalm doesn't fully narrow types through runtime casts, but respects @var for static type inference, resolving both:
    • getByName(string $name) on line 42
    • route(BackedEnum|string $name) on line 54
// Before
$routeName = $this->argument('route'); // mixed: string|array

// After
/** @var string $routeName */
$routeName = $this->argument('route'); // Psalm sees: string

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: tabuna <5102591+tabuna@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix invalid argument errors in DocsCommand Fix static analysis error: cast route argument to string in DocsCommand Mar 18, 2026
Copilot AI requested a review from tabuna March 18, 2026 06:21
…idArgument on route()

Co-authored-by: tabuna <5102591+tabuna@users.noreply.github.com>
Copilot AI changed the title Fix static analysis error: cast route argument to string in DocsCommand Fix Psalm InvalidArgument errors in DocsCommand for route argument type Mar 18, 2026
@tabuna
tabuna marked this pull request as ready for review March 18, 2026 06:26
@tabuna
tabuna merged commit 0528379 into laravel13 Mar 18, 2026
196 checks passed
@tabuna
tabuna deleted the copilot/fix-invalid-argument-errors-again branch March 18, 2026 06:26
@codecov

codecov Bot commented Mar 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.78%. Comparing base (278e6c3) to head (fb45ab6).
⚠️ Report is 1 commits behind head on laravel13.

Additional details and impacted files
@@             Coverage Diff              @@
##             laravel13      #86   +/-   ##
============================================
  Coverage        99.78%   99.78%           
  Complexity         134      134           
============================================
  Files               24       24           
  Lines              456      456           
============================================
  Hits               455      455           
  Misses               1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants