]> granicus.if.org Git - php/commitdiff
Simplify returns in generate-phpt
authorGabriel Caruso <carusogabriel34@gmail.com>
Thu, 25 Jan 2018 06:02:42 +0000 (04:02 -0200)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 26 Jan 2018 21:19:08 +0000 (22:19 +0100)
scripts/dev/generate-phpt/src/setup/gtOptionalSections.php
scripts/dev/generate-phpt/src/setup/preconditions/gtIfClassHasMethod.php
scripts/dev/generate-phpt/src/setup/preconditions/gtIsSpecifiedFunctionOrMethod.php
scripts/dev/generate-phpt/src/setup/preconditions/gtIsSpecifiedTestType.php
scripts/dev/generate-phpt/src/setup/preconditions/gtIsValidClass.php
scripts/dev/generate-phpt/src/setup/preconditions/gtIsValidFunction.php

index 1d2a163175bd22b9ca9c5312e498c5c09a63bbb7..17409bc455f10a0e71cb2df23a168192c3cc7b5a 100644 (file)
@@ -56,17 +56,11 @@ class gtOptionalSections {
   }
 
   public function hasSkipifKey() {
-    if($this->skipifKey != '') {
-      return true;
-    }
-    return false;
+    return $this->skipifKey != '';
   }
   
   public function hasSkipifExt() {
-    if($this->skipifExt != '') {
-      return true;
-    }
-    return false;
+    return $this->skipifExt != '';
   }
   public function hasIni() {
     return $this->optSections['ini'];
index c91b210714c954c41384b9ce3a72d85b3a5fe572..f4cb23a266c15b505abc5af193692d87a72258f7 100644 (file)
@@ -5,20 +5,14 @@
  *
  */
 class gtIfClassHasMethod extends gtPreCondition {
-  
+
   public function check( $clo) {
-    if($clo->hasOption('c')) {
-      if(!$clo->hasOption('m')) {
-        return false;
-      }
-      return  true;
-    }
-    return true;
+    return !$clo->hasOption('c') || $clo->hasOption('m');
   }
-  
+
   public function getMessage() {
     return gtText::get('methodNotSpecified');
   }
 
 }
-?>
\ No newline at end of file
+?>
index 7495c73ecaabebb27dcad2109aa7e86259160056..0d2b6df7f5369fb6a9c537f858620b8767c7e701 100644 (file)
@@ -5,17 +5,13 @@
  *
  */
 class gtIsSpecifiedFunctionOrMethod extends gtPreCondition {
-  
+
   public function check( $clo) {
-    if($clo->hasOption('f') || $clo->hasOption('m')) {
-    
-        return true;
-      }
-    return false;
+    return $clo->hasOption('f') || $clo->hasOption('m');
   }
-  
+
   public function getMessage() {
     return gtText::get('functionOrMethodNotSpecified');
   }
 }
-?>
\ No newline at end of file
+?>
index 40530f3aca84bb89578ee59ad08a486a76c0efa0..9069a604ea16c28accc1ad005e2b042b95bd79e9 100644 (file)
@@ -5,17 +5,13 @@
  *
  */
 class gtIsSpecifiedTestType extends gtPreCondition {
-  
+
   public function check( $clo) {
-    if($clo->hasOption('b') || $clo->hasOption('e') || $clo->hasOption('v') ) {
-    
-        return true;
-      }
-    return false;
+    return $clo->hasOption('b') || $clo->hasOption('e') || $clo->hasOption('v');
   }
   
   public function getMessage() {
     return gtText::get('testTypeNotSpecified');
   }
 }
-?>
\ No newline at end of file
+?>
index a39bab453ef0cdfa99864f252ac8709a81e59720..363fdc95944fe2d4407e4fcbdd976ee0f542fa1d 100644 (file)
@@ -9,10 +9,7 @@ class gtIsValidClass extends gtPreCondition {
   public function check( $clo) {
     if($clo->hasOption('c') ) {
       $className = $clo->getOption('c');
-      if( in_array( $className, get_declared_classes() ) ) {
-        return true;
-      }
-      return false;
+      return in_array( $className, get_declared_classes() );
     }
     return true;
   }
@@ -21,4 +18,4 @@ class gtIsValidClass extends gtPreCondition {
     return gtText::get('unknownClass');
   }
 }
-?>
\ No newline at end of file
+?>
index ed91c2ca3b5c13d4ab0d90eb7ca417244274f55f..9d7f2a5b75455e383f26bfbf781bd4af61eecbda 100644 (file)
@@ -10,10 +10,7 @@ class gtIsValidFunction extends gtPreCondition {
     if($clo->hasOption('f') ) {
       $function = $clo->getOption('f');
       $functions = get_defined_functions();
-      if( in_array( $function, $functions['internal'] ) ) {
-        return true;
-      }
-      return false;
+      return in_array( $function, $functions['internal'] );
     }
     return true;
   }
@@ -22,4 +19,4 @@ class gtIsValidFunction extends gtPreCondition {
     return gtText::get('unknownFunction');
   }
 }
-?>
\ No newline at end of file
+?>