Webmozart\Console\Api\Config\CommandConfig::setDescription PHP Method

setDescription() public method

The description is a short one-liner that describes the command in the command listing. The description should be written in imperative form rather than in descriptive form. So: > List the contents of a directory. should be preferred over > Lists the contents of a directory.
See also: getDescription()
public setDescription ( string $description ) : static
$description string The description.
return static The current instance.
    public function setDescription($description)
    {
        if (null !== $description) {
            Assert::string($description, 'The command description must be a string or null. Got: %s');
            Assert::notEmpty($description, 'The command description must not be empty.');
        }
        $this->description = $description;
        return $this;
    }

Usage Example

示例#1
0
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testSetDescriptionFailsIfNotString()
 {
     $this->config->setDescription(1234);
 }