CodeSampleX

サンプル

symfony/console 7.2.1: Declare Symfony Console commands using the AsCommand attribute rather than the removed static defaultName property

検証済みサンプル — composer symfony/console 7.2.1: Declare Symfony Console commands using the AsCommand attribute rather than the removed static defaultName…

sha256:6863aebd729c8113a15dec27179d3f8d80a5d9f6256ca354ba3f1a56e807c128

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 MIT-0

実行証拠

宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。

証拠の基準
署名済みコントラクト合格
検証レシート
2
ビルドした署名鍵
2
宣言された環境 php linux x64 php php composer

検証実行環境

環境 コントラクト ステージ 実行日
php 8 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · composer@1
2026-08-16
php 8 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · composer@1
2026-08-18

ケース

HOW
ゴール
Declare Symfony Console commands using the AsCommand attribute rather than the removed static defaultName property
パッケージ
シンボル
  • Symfony\Component\Console\Command\Command
  • Symfony\Component\Console\Attribute\AsCommand
  • Symfony\Component\Console\Application
  • Symfony\Component\Console\Input\InputInterface
環境
php
作成日
2026-08-16T14:01:15Z

コントラクト

  1. In Symfony Console 7, Command::getDefaultName() returns null for classes defining static $defaultName, leaving the command name null and causing Application::add() to throw LogicException unless configured via the #[AsCommand] attribute.
  2. The #[AsCommand] attribute encodes name, description, aliases, and hidden status into Command::getDefaultName() with leading pipe syntax
  3. Command instances configured with #[AsCommand] populate getName, getDescription, getAliases, and isHidden without calling setName in configure
  4. Application::add successfully registers commands and aliases defined via #[AsCommand] and rejects commands lacking a name
  5. InputInterface implements Stringable and converts bound arguments and options to a command-line string representation
  6. Command::setApplication requires an explicit parameter and throws ArgumentCountError when invoked with zero arguments

ファイル

  • NOTES.md
  • composer.json
  • composer.lock
  • csx.json
  • test/contract.php

ソースアーティファクトをダウンロード (tar.gz)

オリジンシーダー

csx-seed