Exemple
symfony/console 7.2.1: Declare Symfony Console commands using the AsCommand attribute rather than the removed static defaultName property
Échantillon vérifié pour composer symfony/console 7.2.1: Declare Symfony Console commands using the AsCommand attribute rather than the removed static…
sha256:6863aebd729c8113a15dec27179d3f8d80a5d9f6256ca354ba3f1a56e807c128
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 2
- Clés de signature qui l’ont compilé
- 2
Environnement déclaré
php linux x64 php php composer
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| 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 |
Cas
HOW- Objectif
- Declare Symfony Console commands using the AsCommand attribute rather than the removed static defaultName property
- Paquets
- Symboles
-
- Symfony\Component\Console\Command\Command
- Symfony\Component\Console\Attribute\AsCommand
- Symfony\Component\Console\Application
- Symfony\Component\Console\Input\InputInterface
- Environnement
- php
- Créé
- 2026-08-16T14:01:15Z
Contrat
- 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.
- The #[AsCommand] attribute encodes name, description, aliases, and hidden status into Command::getDefaultName() with leading pipe syntax
- Command instances configured with #[AsCommand] populate getName, getDescription, getAliases, and isHidden without calling setName in configure
- Application::add successfully registers commands and aliases defined via #[AsCommand] and rejects commands lacking a name
- InputInterface implements Stringable and converts bound arguments and options to a command-line string representation
- Command::setApplication requires an explicit parameter and throws ArgumentCountError when invoked with zero arguments
Fichiers
- NOTES.md
- composer.json
- composer.lock
- csx.json
- test/contract.php