Files
farmOS-dev/vendor/consolidation/annotated-command/src/Attributes/DefaultFields.php
2024-12-10 15:08:16 +01:00

26 lines
585 B
PHP

<?php
namespace Consolidation\AnnotatedCommand\Attributes;
use Attribute;
use Consolidation\AnnotatedCommand\Parser\CommandInfo;
#[Attribute(Attribute::TARGET_METHOD)]
class DefaultFields
{
/**
* @param $fields
* An array of field names to show by default.
*/
public function __construct(
public array $fields,
) {
}
public static function handle(\ReflectionAttribute $attribute, CommandInfo $commandInfo)
{
$args = $attribute->getArguments();
$commandInfo->addAnnotation('default-fields', $args['fields']);
}
}