簡體   English   中英

Symfony 5.4 升級后每個控制台命令中的棄用通知

[英]Deprecation notices in every console command following Symfony 5.4 upgrade

我對 Symfony 5.4 應用程序中的以下棄用通知感到非常困惑。

“Symfony\Component\Console\Command\Command::$defaultName”屬性被認為是最終的。 您不應在“CRMPiccoBundle\Console\Command\Aws\Cognito\CreateUser”中覆蓋它。

在我的代碼中,我有以下內容:

class CreateUser extends Command
{
    protected static $defaultName = 'crmpiccobundle:aws:cognito:createuser';

...與文檔一致。

父命令 class 如下所示:

/**
 * @var string|null The default command name
 */
protected static $defaultName;

我的所有命令現在都輸出棄用通知,這並不理想。

composer show | grep console
symfony/console                      v5.4.19            Eases the creation of beautiful and testable command line interfaces

我在這里誤解了什么? 我在 PHP 8.1.14。

第一:棄用不是錯誤在升級到 Symfony 之前,您不需要修復任何內容 6. 然后您必須修復錯誤。

其次,與許多文檔一樣,Symfony 文檔有時會滯后於開發。 新方法記錄在這里

所以你可以切換到使用這個

#[AsCommand(
    name: 'crmpiccobundle:aws:cognito:createuser',
    description: 'Creates a new user.',
)]
class CreateUser extends Command
{
...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM