@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace voku\HtmlFormValidator; |
6 | 6 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | { |
23 | 23 | $argsMatches = []; |
24 | 24 | \preg_match('/\((?<args>.*?)\)$/', $string, $argsMatches); |
25 | - $string = (string)\preg_replace('/\((.*?)\)$/', '', $string); |
|
25 | + $string = (string) \preg_replace('/\((.*?)\)$/', '', $string); |
|
26 | 26 | |
27 | 27 | $args = []; |
28 | 28 | if (isset($argsMatches['args'])) { |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $arg = trim($argTmp); |
40 | 40 | |
41 | 41 | if ($arg === 'true' || $arg === 'false') { |
42 | - $arg = (bool)$arg; |
|
42 | + $arg = (bool) $arg; |
|
43 | 43 | } else if ($args === 'null') { |
44 | 44 | $arg = null; |
45 | 45 | } |
@@ -114,7 +114,7 @@ |
||
114 | 114 | // |
115 | 115 | |
116 | 116 | switch ($fieldFilter) { |
117 | - case 'escape': |
|
117 | + case 'escape': |
|
118 | 118 | return \htmlentities($currentFieldData, ENT_QUOTES | ENT_HTML5, 'UTF-8'); |
119 | 119 | } |
120 | 120 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace voku\HtmlFormValidator; |
6 | 6 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | list($fieldFilter, $fieldFilterArgs) = ValidatorHelpers::getArgsFromString($fieldFilter); |
126 | 126 | |
127 | - $currentFieldData = (array)$currentFieldData; |
|
127 | + $currentFieldData = (array) $currentFieldData; |
|
128 | 128 | foreach ($fieldFilterArgs as $arg) { |
129 | 129 | $currentFieldData[] = $arg; |
130 | 130 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $currentFieldData = \call_user_func_array([UTF8::class, $fieldFilter], $currentFieldData); |
146 | 146 | } else { |
147 | 147 | throw new UnknownFilter( |
148 | - 'No filter available for "' . $fieldFilter . '"' |
|
148 | + 'No filter available for "'.$fieldFilter.'"' |
|
149 | 149 | ); |
150 | 150 | } |
151 | 151 | |
@@ -209,8 +209,8 @@ discard block |
||
209 | 209 | $fieldHelperChar = ''; |
210 | 210 | $fieldArrayTmp = preg_replace_callback( |
211 | 211 | '/\[([^\]]+)\]/', |
212 | - function ($match) use ($fieldHelperChar) { |
|
213 | - return $match[1] . $fieldHelperChar; |
|
212 | + function($match) use ($fieldHelperChar) { |
|
213 | + return $match[1].$fieldHelperChar; |
|
214 | 214 | }, |
215 | 215 | $fieldArray |
216 | 216 | ); |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | if ($inputType) { |
392 | 392 | $selectedRule = $this->autoSelectRuleByInputType($inputType); |
393 | 393 | if ($selectedRule) { |
394 | - $inputRule .= '|' . $selectedRule; |
|
394 | + $inputRule .= '|'.$selectedRule; |
|
395 | 395 | } |
396 | 396 | } |
397 | 397 | |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | // |
401 | 401 | |
402 | 402 | if ($inputPattern) { |
403 | - $inputRule .= '|regex(/' . $inputPattern . '/)'; |
|
403 | + $inputRule .= '|regex(/'.$inputPattern.'/)'; |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | // |
@@ -408,19 +408,19 @@ discard block |
||
408 | 408 | // |
409 | 409 | |
410 | 410 | if ($inputMinLength) { |
411 | - $inputRule .= '|minLength(' . serialize($inputMinLength) . ')'; |
|
411 | + $inputRule .= '|minLength('.serialize($inputMinLength).')'; |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | if ($inputMaxLength) { |
415 | - $inputRule .= '|maxLength(' . serialize($inputMaxLength) . ')'; |
|
415 | + $inputRule .= '|maxLength('.serialize($inputMaxLength).')'; |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | if ($inputMin) { |
419 | - $inputRule .= '|min(' . serialize($inputMin) . ')'; |
|
419 | + $inputRule .= '|min('.serialize($inputMin).')'; |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | if ($inputMax) { |
423 | - $inputRule .= '|max(' . serialize($inputMax) . ')'; |
|
423 | + $inputRule .= '|max('.serialize($inputMax).')'; |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | } |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | foreach ($formField->getElementsByTagName('option') as $option) { |
434 | 434 | $selectableValues[] = $option->getNode()->nodeValue; |
435 | 435 | } |
436 | - $inputRule .= '|in(' . serialize($selectableValues) . ')'; |
|
436 | + $inputRule .= '|in('.serialize($selectableValues).')'; |
|
437 | 437 | |
438 | 438 | } else if ( |
439 | 439 | ( |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | $selectableValues = []; |
448 | 448 | |
449 | 449 | try { |
450 | - $formFieldNames = $form->find('[name=' . $formField->name . ']'); |
|
450 | + $formFieldNames = $form->find('[name='.$formField->name.']'); |
|
451 | 451 | } catch (SyntaxErrorException $syntaxErrorException) { |
452 | 452 | $formFieldNames = null; |
453 | 453 | // TODO@me -> can the symfony CssSelectorConverter use array-name-attributes? |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | } |
460 | 460 | } |
461 | 461 | |
462 | - $inputRule .= '|in(' . serialize($selectableValues) . ')'; |
|
462 | + $inputRule .= '|in('.serialize($selectableValues).')'; |
|
463 | 463 | |
464 | 464 | } |
465 | 465 | } |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | |
592 | 592 | } catch (ComponentException $componentException) { |
593 | 593 | throw new UnknownValidationRule( |
594 | - 'No rule defined for: ' . $field . ' (rule: ' . $fieldRule . ' | class: ' . $validationClass . ')', |
|
594 | + 'No rule defined for: '.$field.' (rule: '.$fieldRule.' | class: '.$validationClass.')', |
|
595 | 595 | 500, |
596 | 596 | $componentException |
597 | 597 | ); |