Webmozart\Console\Api\Config\OptionCommandConfig::setPreferShortName PHP Method

setPreferShortName() public method

This information is mainly used in the help where the preferred name is listed before alternative names.
public setPreferShortName ( ) : static
return static The current instance.
    public function setPreferShortName()
    {
        if (null === $this->shortName) {
            throw new LogicException('No short name is set.');
        }
        $this->longNamePreferred = false;
        return $this;
    }

Usage Example

コード例 #1
0
 public function testSetShortNameToNullSetsLongNameToBePreferred()
 {
     $this->config->setShortName('d');
     $this->config->setPreferShortName();
     $this->config->setShortName(null);
     $this->assertTrue($this->config->isLongNamePreferred());
     $this->assertFalse($this->config->isShortNamePreferred());
 }