Completed
Push — master ( a610d6...977b27 )
by Vitaliy
02:36
created
src/Element/CheckboxList.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
   class CheckboxList extends \Fiv\Form\Element\Multiple {
18 18
 
19 19
     /**
20
-     * @param array|string $data
20
+     * @param string[] $data
21 21
      * @return $this
22 22
      */
23 23
     public function setValue($data) {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,14 +61,14 @@
 block discarded – undo
61 61
 
62 62
       foreach ($this->options as $value => $text) {
63 63
         $attributes['value'] = $value;
64
-        $attributes['name'] = $name . '[]';
64
+        $attributes['name'] = $name.'[]';
65 65
         if (in_array($value, $currentValues)) {
66 66
           $attributes['checked'] = 'checked';
67 67
         } else {
68 68
           unset($attributes['checked']);
69 69
         }
70 70
 
71
-        $html .= '<label>' . static::tag('input', $attributes) . $text . '</label>';
71
+        $html .= '<label>'.static::tag('input', $attributes).$text.'</label>';
72 72
       }
73 73
 
74 74
       return $html;
Please login to merge, or discard this patch.
Tests/Element/HtmlTest.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,4 +58,4 @@
 block discarded – undo
58 58
     }
59 59
 
60 60
   }
61
- 
62 61
\ No newline at end of file
62
+  
63 63
\ No newline at end of file
Please login to merge, or discard this patch.
Tests/Element/TextAreaTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@
 block discarded – undo
20 20
 
21 21
     public function testRender() {
22 22
       $element = $this->getElement();
23
-      $this->assertContains('<textarea', (string)$element);
24
-      $this->assertContains('</textarea', (string)$element);
23
+      $this->assertContains('<textarea', (string) $element);
24
+      $this->assertContains('</textarea', (string) $element);
25 25
 
26 26
       $element->setValue('custom data');
27 27
       $this->assertContains('>custom data<', $element->render());
Please login to merge, or discard this patch.
Tests/FormTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -214,7 +214,7 @@
 block discarded – undo
214 214
 
215 215
       $checkedItemsNum = 0;
216 216
 
217
-      $element->addValidator(new CallBackValidator(function ($value) use (&$checkedItemsNum) {
217
+      $element->addValidator(new CallBackValidator(function($value) use (&$checkedItemsNum) {
218 218
         $checkedItemsNum++;
219 219
 
220 220
         return !empty($value);
Please login to merge, or discard this patch.
Tests/Validator/CallBackValidatorTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
   class CallBackValidatorTest extends \PHPUnit_Framework_TestCase {
12 12
 
13 13
     public function testLen() {
14
-      $lengthValidator = new CallBackValidator(function ($value) {
14
+      $lengthValidator = new CallBackValidator(function($value) {
15 15
         return strlen($value) > 3 and strlen($value) < 10;
16 16
       });
17 17
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         '[email protected]',
54 54
       ];
55 55
 
56
-      $callBackValidator = (new CallBackValidator(function ($value) use ($existEmailList) {
56
+      $callBackValidator = (new CallBackValidator(function($value) use ($existEmailList) {
57 57
         if (empty($value)) {
58 58
           return true;
59 59
         }
Please login to merge, or discard this patch.
src/Validator/Len.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
    * @author  Ivan Shcherbak <[email protected]>
13 13
    * @package Fiv\Form\Validator
14 14
    */
15
-  class Len extends BaseValidator{
15
+  class Len extends BaseValidator {
16 16
 
17 17
     /**
18 18
      * @var int|null
Please login to merge, or discard this patch.
src/Filter/Trim.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
    * @author  Ivan Shcherbak <[email protected]>
7 7
    * @package Fiv\Form\Filter
8 8
    */
9
-  class Trim implements FilterInterface{
9
+  class Trim implements FilterInterface {
10 10
 
11 11
     /**
12 12
      * @inheritdoc
Please login to merge, or discard this patch.
src/Form.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
 
57 57
     /**
58
-     * @param $name
58
+     * @param string $name
59 59
      * @return $this
60 60
      */
61 61
     public function setName($name) {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 
300 300
     /**
301 301
      * @param string $name
302
-     * @param null $text
302
+     * @param string $text
303 303
      * @return TextArea
304 304
      */
305 305
     public function textarea($name, $text = null) {
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
      * $form->hidden('key', md5($this-user->id . HASH_A);
317 317
      * ```
318 318
      * @param string $name
319
-     * @param null $value
319
+     * @param string $value
320 320
      * @return \Fiv\Form\Element\Input
321 321
      */
322 322
     public function hidden($name, $value = null) {
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
      * $form->submit('register', 'зареєструватись');
335 335
      * ```
336 336
      * @param string $name
337
-     * @param null $value
337
+     * @param string $value
338 338
      * @return Submit
339 339
      */
340 340
     public function submit($name, $value = null) {
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
      */
189 189
     protected function addError($error) {
190 190
       if (!is_string($error)) {
191
-        throw new \InvalidArgumentException('Error should be a string, ' . gettype($error) . ' given.');
191
+        throw new \InvalidArgumentException('Error should be a string, '.gettype($error).' given.');
192 192
       }
193 193
       $this->validationResult = false;
194 194
       $this->errorList[] = $error;
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      */
236 236
     public function getElement($name) {
237 237
       if (empty($this->elements[$name])) {
238
-        throw new \InvalidArgumentException('Element with name "' . $name . '" not found');
238
+        throw new \InvalidArgumentException('Element with name "'.$name.'" not found');
239 239
       }
240 240
       return $this->elements[$name];
241 241
     }
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
      */
398 398
     public function addElement(Element\BaseElement $element) {
399 399
       if (isset($this->elements[$element->getName()])) {
400
-        throw new \Exception('Element with name ' . $element->getName() . ' is already added. Use setElement to overwrite it or change name');
400
+        throw new \Exception('Element with name '.$element->getName().' is already added. Use setElement to overwrite it or change name');
401 401
       }
402 402
 
403 403
       $this->cleanValidationFlag();
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
      * @return string
413 413
      */
414 414
     public function render() {
415
-      return $this->renderStart() . $this->renderElements() . $this->renderEnd();
415
+      return $this->renderStart().$this->renderElements().$this->renderEnd();
416 416
     }
417 417
 
418 418
 
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
         }
432 432
 
433 433
         $formHtml .=
434
-          '<dt>' . $element->getText() . '</dt>' .
435
-          '<dd>' . $element->render() . '</dd>';
434
+          '<dt>'.$element->getText().'</dt>'.
435
+          '<dd>'.$element->render().'</dd>';
436 436
       }
437 437
 
438 438
       $formHtml .= '</dl>';
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
       $method = $this->getMethod();
457 457
       $this->setAttribute('method', $method);
458 458
 
459
-      $html = '<form ' . Element\Html::renderAttributes($this->getAttributes()) . '>';
459
+      $html = '<form '.Element\Html::renderAttributes($this->getAttributes()).'>';
460 460
       $html .= $hidden->render();
461 461
 
462 462
       # render hidden element
Please login to merge, or discard this patch.
src/Element/Select.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@
 block discarded – undo
14 14
      * @return string
15 15
      */
16 16
     public function render() {
17
-      $html = '<select ' . Html::renderAttributes($this->getAttributes()) . ' >';
17
+      $html = '<select '.Html::renderAttributes($this->getAttributes()).' >';
18 18
       $currentValue = $this->getValue();
19 19
 
20 20
       foreach ($this->options as $value => $text) {
21 21
         $html .= '<option'
22 22
           . ($currentValue == $value ? ' selected="1" ' : '')
23
-          . ' value="' . $value . '"'
23
+          . ' value="'.$value.'"'
24 24
           . '>'
25 25
           . $text
26 26
           . '</option>';
Please login to merge, or discard this patch.