Apply "SlevomatCodingStandard.ControlStructures.RequireTernaryOperator"

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
This commit is contained in:
Henrique Moody 2019-02-09 13:25:54 +01:00
parent e500222f5b
commit 3abf64f496
No known key found for this signature in database
GPG key ID: 221E9281655813A6
3 changed files with 9 additions and 16 deletions

View file

@ -65,17 +65,13 @@ class Domain extends AbstractComposite
public function tldCheck(bool $do = true): void
{
if (true === $do) {
$this->tld = new Tld();
} else {
$this->tld = new AllOf(
new Not(
new StartsWith('-')
),
new NoWhitespace(),
new Length(2, null)
);
}
$this->tld = $do ? new Tld() : new AllOf(
new Not(
new StartsWith('-')
),
new NoWhitespace(),
new Length(2, null)
);
}
/**

View file

@ -59,11 +59,7 @@ class Zend extends AbstractRule
*/
private function createZendValidator(string $name, array $params): ZendValidator
{
if (false === mb_stripos($name, 'Zend')) {
$name = "Zend\\Validator\\{$name}";
} else {
$name = "\\{$name}";
}
$name = false === mb_stripos($name, 'Zend') ? "Zend\\Validator\\{$name}" : "\\{$name}";
$reflection = new ReflectionClass($name);

View file

@ -59,6 +59,7 @@
<rule ref="SlevomatCodingStandard.ControlStructures.NewWithParentheses" />
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator" />
<rule ref="SlevomatCodingStandard.ControlStructures.RequireShortTernaryOperator" />
<rule ref="SlevomatCodingStandard.ControlStructures.RequireTernaryOperator" />
<rule ref="SlevomatCodingStandard.ControlStructures.UselessTernaryOperator" />
<rule ref="SlevomatCodingStandard.Exceptions.DeadCatch" />
<rule ref="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly" />