@@ -9,7 +9,7 @@ |
||
9 | 9 | /** |
10 | 10 | * Form constructor. |
11 | 11 | * |
12 | - * @param $x |
|
12 | + * @param integer $x |
|
13 | 13 | */ |
14 | 14 | public function __construct($x) |
15 | 15 | { |
@@ -19,7 +19,7 @@ |
||
19 | 19 | function getX() |
20 | 20 | { |
21 | 21 | //returns closure bound to this object and scope |
22 | - return function () |
|
22 | + return function() |
|
23 | 23 | { |
24 | 24 | return $this->x; |
25 | 25 | }; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | { |
26 | 26 | // let's review that all items are integers! |
27 | 27 | $result = array_map( |
28 | - function ($value) |
|
28 | + function($value) |
|
29 | 29 | { |
30 | 30 | return (int) $value; |
31 | 31 | }, |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public function arraysSum(...$arrays) |
39 | 39 | { |
40 | 40 | return array_map( |
41 | - function (array $array) |
|
41 | + function(array $array) |
|
42 | 42 | { |
43 | 43 | return ($array); |
44 | 44 | }, |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $example = new Example(); |
73 | 73 | $not_an_example = new NotAnExample(); |
74 | 74 | |
75 | - return $example->greetings() . ' ' . $not_an_example->greetings() . '!'; |
|
75 | + return $example->greetings().' '.$not_an_example->greetings().'!'; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | public function divideEnters($a, $b) |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | $credit_card = preg_replace_callback( |
98 | 98 | '/([a-z]{1})/', |
99 | - function ($m) |
|
99 | + function($m) |
|
100 | 100 | { |
101 | 101 | return strtoupper($m[1]); |
102 | 102 | }, |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | $credit_card = preg_replace_callback( |
107 | 107 | '/([0-9]{1})/', |
108 | - function ($m) |
|
108 | + function($m) |
|
109 | 109 | { |
110 | 110 | return 'XXX'; |
111 | 111 | }, |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | { |
145 | 145 | list($id, $name) = $data[$number_user]; |
146 | 146 | |
147 | - return $id . '_' . $name; |
|
147 | + return $id.'_'.$name; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | public function getAllComposedNames($data) |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | foreach ($data as list($id, $name)) |
155 | 155 | { |
156 | - $all_composed_names .= $id . '_' . $name . '|'; |
|
156 | + $all_composed_names .= $id.'_'.$name.'|'; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | return $all_composed_names; |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Kata\PHP7Kata; |
4 | 4 | |
5 | -use Kata\OtherExamples\Form; |
|
6 | 5 | use Kata\OtherExamples\Example; |
6 | +use Kata\OtherExamples\Form; |
|
7 | 7 | use Kata\OtherExamples\NotAnExample; |
8 | 8 | |
9 | 9 | final class LegacyToMigrate |
@@ -54,12 +54,10 @@ discard block |
||
54 | 54 | if ($a == $b) |
55 | 55 | { |
56 | 56 | return 0; |
57 | - } |
|
58 | - elseif ($a > $b) |
|
57 | + } elseif ($a > $b) |
|
59 | 58 | { |
60 | 59 | return 1; |
61 | - } |
|
62 | - else |
|
60 | + } else |
|
63 | 61 | { |
64 | 62 | return -1; |
65 | 63 | } |
@@ -162,8 +160,7 @@ discard block |
||
162 | 160 | try |
163 | 161 | { |
164 | 162 | $this->functionThatFails(); |
165 | - } |
|
166 | - catch (FirstException $e) |
|
163 | + } catch (FirstException $e) |
|
167 | 164 | { |
168 | 165 | return false; |
169 | 166 | } |
@@ -171,8 +168,7 @@ discard block |
||
171 | 168 | try |
172 | 169 | { |
173 | 170 | $this->anotherFunctionThatAlsoFails(); |
174 | - } |
|
175 | - catch (SecondException $e) |
|
171 | + } catch (SecondException $e) |
|
176 | 172 | { |
177 | 173 | return false; |
178 | 174 | } |