From 3abf64f496addedf025ee102e996fdd94a404ad6 Mon Sep 17 00:00:00 2001 From: Henrique Moody Date: Sat, 9 Feb 2019 13:25:54 +0100 Subject: [PATCH] Apply "SlevomatCodingStandard.ControlStructures.RequireTernaryOperator" Signed-off-by: Henrique Moody --- library/Rules/Domain.php | 18 +++++++----------- library/Rules/Zend.php | 6 +----- phpcs.xml.dist | 1 + 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/library/Rules/Domain.php b/library/Rules/Domain.php index 1b7bd5e2..427001b2 100644 --- a/library/Rules/Domain.php +++ b/library/Rules/Domain.php @@ -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) + ); } /** diff --git a/library/Rules/Zend.php b/library/Rules/Zend.php index de220c46..bec54b71 100644 --- a/library/Rules/Zend.php +++ b/library/Rules/Zend.php @@ -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); diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 4da4a4ef..cbae2d98 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -59,6 +59,7 @@ +