Add CommandAttributeTest to validate command attributes and descriptions #55911
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixing Symfony Console 7.3 Deprecation Warning
Issue Description
When running
composer run dev
in Laravel 12.16.0 applications with PHP 8.3.14, users were encountering repeated truncated deprecation warnings from Symfony Console 7.3:The full log message:
Root Cause
The issue was related to Laravel's
ClosureCommand
class not having a$description
property defined. In Symfony Console 7.3, thegetDefaultDescription()
method was deprecated in favor of using the#[AsCommand]
attribute, and Symfony was generating deprecation warnings because of this.Fix Summary
The fix involved adding a
$description
property to theClosureCommand
class in Laravel's codebase:This ensures that when closure commands are created, they have a proper description property that is compatible with Symfony Console 7.3's expectations.
Implementation Details
Added a
$description
property to theClosureCommand
class in:/src/Illuminate/Foundation/Console/ClosureCommand.php
Created a test to verify that closure commands work correctly:
/tests/Integration/Foundation/Console/ClosureCommandTest.php
This approach follows the same implementation pattern used in Laravel 11, as demonstrated in PR #55888.
Benefits
Related Issues and PRs