Skip to content

Commit c0ef58e

Browse files
carusogabrielnikic
authored andcommitted
Simplify returns in generate-phpt
1 parent e061a4e commit c0ef58e

File tree

6 files changed

+17
-43
lines changed

6 files changed

+17
-43
lines changed

scripts/dev/generate-phpt/src/setup/gtOptionalSections.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,11 @@ public function hasSkipif() {
5656
}
5757

5858
public function hasSkipifKey() {
59-
if($this->skipifKey != '') {
60-
return true;
61-
}
62-
return false;
59+
return $this->skipifKey != '';
6360
}
6461

6562
public function hasSkipifExt() {
66-
if($this->skipifExt != '') {
67-
return true;
68-
}
69-
return false;
63+
return $this->skipifExt != '';
7064
}
7165
public function hasIni() {
7266
return $this->optSections['ini'];

scripts/dev/generate-phpt/src/setup/preconditions/gtIfClassHasMethod.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,14 @@
55
*
66
*/
77
class gtIfClassHasMethod extends gtPreCondition {
8-
8+
99
public function check( $clo) {
10-
if($clo->hasOption('c')) {
11-
if(!$clo->hasOption('m')) {
12-
return false;
13-
}
14-
return true;
15-
}
16-
return true;
10+
return !$clo->hasOption('c') || $clo->hasOption('m');
1711
}
18-
12+
1913
public function getMessage() {
2014
return gtText::get('methodNotSpecified');
2115
}
2216

2317
}
24-
?>
18+
?>

scripts/dev/generate-phpt/src/setup/preconditions/gtIsSpecifiedFunctionOrMethod.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@
55
*
66
*/
77
class gtIsSpecifiedFunctionOrMethod extends gtPreCondition {
8-
8+
99
public function check( $clo) {
10-
if($clo->hasOption('f') || $clo->hasOption('m')) {
11-
12-
return true;
13-
}
14-
return false;
10+
return $clo->hasOption('f') || $clo->hasOption('m');
1511
}
16-
12+
1713
public function getMessage() {
1814
return gtText::get('functionOrMethodNotSpecified');
1915
}
2016
}
21-
?>
17+
?>

scripts/dev/generate-phpt/src/setup/preconditions/gtIsSpecifiedTestType.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@
55
*
66
*/
77
class gtIsSpecifiedTestType extends gtPreCondition {
8-
8+
99
public function check( $clo) {
10-
if($clo->hasOption('b') || $clo->hasOption('e') || $clo->hasOption('v') ) {
11-
12-
return true;
13-
}
14-
return false;
10+
return $clo->hasOption('b') || $clo->hasOption('e') || $clo->hasOption('v');
1511
}
1612

1713
public function getMessage() {
1814
return gtText::get('testTypeNotSpecified');
1915
}
2016
}
21-
?>
17+
?>

scripts/dev/generate-phpt/src/setup/preconditions/gtIsValidClass.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ class gtIsValidClass extends gtPreCondition {
99
public function check( $clo) {
1010
if($clo->hasOption('c') ) {
1111
$className = $clo->getOption('c');
12-
if( in_array( $className, get_declared_classes() ) ) {
13-
return true;
14-
}
15-
return false;
12+
return in_array( $className, get_declared_classes() );
1613
}
1714
return true;
1815
}
@@ -21,4 +18,4 @@ public function getMessage() {
2118
return gtText::get('unknownClass');
2219
}
2320
}
24-
?>
21+
?>

scripts/dev/generate-phpt/src/setup/preconditions/gtIsValidFunction.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ public function check( $clo) {
1010
if($clo->hasOption('f') ) {
1111
$function = $clo->getOption('f');
1212
$functions = get_defined_functions();
13-
if( in_array( $function, $functions['internal'] ) ) {
14-
return true;
15-
}
16-
return false;
13+
return in_array( $function, $functions['internal'] );
1714
}
1815
return true;
1916
}
@@ -22,4 +19,4 @@ public function getMessage() {
2219
return gtText::get('unknownFunction');
2320
}
2421
}
25-
?>
22+
?>

0 commit comments

Comments
 (0)