@@ -52,8 +52,8 @@ |
||
| 52 | 52 | // IRules::IS_POST_CODE => External\IsPostCode::class, // too many formats for simple check, use regex |
| 53 | 53 | // IRules::IS_TELEPHONE => External\IsPhone::class, // too many formats for simple check, use regex |
| 54 | 54 | // IRules::IS_EU_VAT => External\IsEuVat::class, // too many formats, needs some library for checking |
| 55 | - IRules::IS_DATE => External\IsDate::class, // too many formats, needs some library for checking |
|
| 56 | - IRules::IS_DATE_REGEX => External\IsDateRegex::class, // too many formats, needs some library for checking |
|
| 55 | + IRules::IS_DATE => External\IsDate::class, // too many formats, needs some library for checking |
|
| 56 | + IRules::IS_DATE_REGEX => External\IsDateRegex::class, // too many formats, needs some library for checking |
|
| 57 | 57 | IRules::SAFE_EQUALS_BASIC => Safe\HashedBasicEquals::class, |
| 58 | 58 | IRules::SAFE_EQUALS_FUNC => Safe\HashedFuncEquals::class, |
| 59 | 59 | IRules::SAFE_EQUALS_PASS => Safe\HashedPassEquals::class, |
@@ -18,11 +18,15 @@ |
||
| 18 | 18 | { |
| 19 | 19 | $data = new Rules\ProcessCallback(); |
| 20 | 20 | $this->assertInstanceOf(Rules\ARule::class, $data); |
| 21 | - if (!$gotResult) $this->expectException(RuleException::class); |
|
| 21 | + if (!$gotResult) { |
|
| 22 | + $this->expectException(RuleException::class); |
|
| 23 | + } |
|
| 22 | 24 | $data->setAgainstValue($expectedCall); |
| 23 | 25 | if ($gotResult) { |
| 24 | 26 | $mock = MockEntry::init('foo', $checkValue); |
| 25 | - if (!$pass) $this->expectException(RuleException::class); |
|
| 27 | + if (!$pass) { |
|
| 28 | + $this->expectException(RuleException::class); |
|
| 29 | + } |
|
| 26 | 30 | $data->validate($mock); |
| 27 | 31 | } |
| 28 | 32 | } |
@@ -63,9 +63,9 @@ |
||
| 63 | 63 | public function compareLenProvider(): array |
| 64 | 64 | { |
| 65 | 65 | return [ |
| 66 | - ['yxcvbnm', 8, false, false, true ], |
|
| 67 | - ['asdfghjk', 8, true, true, true ], |
|
| 68 | - ['qwertutop', 8, true, false, false], |
|
| 66 | + ['yxcvbnm', 8, false, false, true], |
|
| 67 | + ['asdfghjk', 8, true, true, true], |
|
| 68 | + ['qwertutop', 8, true, false, false], |
|
| 69 | 69 | ]; |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -20,7 +20,9 @@ discard block |
||
| 20 | 20 | $data = new Rules\LengthMin(); |
| 21 | 21 | $this->assertInstanceOf(Rules\ARule::class, $data); |
| 22 | 22 | $data->setAgainstValue($length); |
| 23 | - if (!$passMin) $this->expectException(RuleException::class); |
|
| 23 | + if (!$passMin) { |
|
| 24 | + $this->expectException(RuleException::class); |
|
| 25 | + } |
|
| 24 | 26 | $data->validate(MockEntry::init('foo', $value)); |
| 25 | 27 | } |
| 26 | 28 | |
@@ -38,7 +40,9 @@ discard block |
||
| 38 | 40 | $data = new Rules\LengthEquals(); |
| 39 | 41 | $this->assertInstanceOf(Rules\ARule::class, $data); |
| 40 | 42 | $data->setAgainstValue($length); |
| 41 | - if (!$passEq) $this->expectException(RuleException::class); |
|
| 43 | + if (!$passEq) { |
|
| 44 | + $this->expectException(RuleException::class); |
|
| 45 | + } |
|
| 42 | 46 | $data->validate(MockEntry::init('foo', $value)); |
| 43 | 47 | } |
| 44 | 48 | |
@@ -56,7 +60,9 @@ discard block |
||
| 56 | 60 | $data = new Rules\LengthMax(); |
| 57 | 61 | $this->assertInstanceOf(Rules\ARule::class, $data); |
| 58 | 62 | $data->setAgainstValue($length); |
| 59 | - if (!$passMax) $this->expectException(RuleException::class); |
|
| 63 | + if (!$passMax) { |
|
| 64 | + $this->expectException(RuleException::class); |
|
| 65 | + } |
|
| 60 | 66 | $data->validate(MockEntry::init('foo', $value)); |
| 61 | 67 | } |
| 62 | 68 | |
@@ -45,11 +45,11 @@ |
||
| 45 | 45 | public function stringsProvider(): array |
| 46 | 46 | { |
| 47 | 47 | return [ |
| 48 | - ['[email protected]', true, false], |
|
| 49 | - ['[email protected]', true, false], |
|
| 48 | + ['[email protected]', true, false], |
|
| 49 | + ['[email protected]', true, false], |
|
| 50 | 50 | ['foo@[email protected]', false, false], |
| 51 | - ['6', false, false], |
|
| 52 | - ['bar.example', false, true ], |
|
| 51 | + ['6', false, false], |
|
| 52 | + ['bar.example', false, true], |
|
| 53 | 53 | ['foo.bar.baz.example', false, false], |
| 54 | 54 | ]; |
| 55 | 55 | } |
@@ -20,7 +20,9 @@ discard block |
||
| 20 | 20 | $this->assertInstanceOf(Rules\ARule::class, $data); |
| 21 | 21 | |
| 22 | 22 | $mock = MockEntry::init('foo', $checkValue); |
| 23 | - if (!$isEmail) $this->expectException(RuleException::class); |
|
| 23 | + if (!$isEmail) { |
|
| 24 | + $this->expectException(RuleException::class); |
|
| 25 | + } |
|
| 24 | 26 | $data->validate($mock); |
| 25 | 27 | } |
| 26 | 28 | |
@@ -38,7 +40,9 @@ discard block |
||
| 38 | 40 | $this->assertInstanceOf(Rules\ARule::class, $data); |
| 39 | 41 | |
| 40 | 42 | $mock = MockEntry::init('foo', $checkValue); |
| 41 | - if (!$isDomain) $this->expectException(RuleException::class); |
|
| 43 | + if (!$isDomain) { |
|
| 44 | + $this->expectException(RuleException::class); |
|
| 45 | + } |
|
| 42 | 46 | $data->validate($mock); |
| 43 | 47 | } |
| 44 | 48 | |
@@ -57,9 +57,9 @@ |
||
| 57 | 57 | public function compareFormatProvider(): array |
| 58 | 58 | { |
| 59 | 59 | return [ |
| 60 | - [false, true, false, false], |
|
| 61 | - [123, false, true, false], |
|
| 62 | - ['abc', false, false, true], |
|
| 60 | + [false, true, false, false], |
|
| 61 | + [123, false, true, false], |
|
| 62 | + ['abc', false, false, true], |
|
| 63 | 63 | [new \stdClass(), false, false, false], |
| 64 | 64 | ]; |
| 65 | 65 | } |
@@ -18,7 +18,9 @@ discard block |
||
| 18 | 18 | { |
| 19 | 19 | $data = new Rules\IsBool(); |
| 20 | 20 | $this->assertInstanceOf(Rules\ARule::class, $data); |
| 21 | - if (!$resultBool) $this->expectException(RuleException::class); |
|
| 21 | + if (!$resultBool) { |
|
| 22 | + $this->expectException(RuleException::class); |
|
| 23 | + } |
|
| 22 | 24 | $data->validate(MockEntry::init('foo', $value)); |
| 23 | 25 | } |
| 24 | 26 | |
@@ -34,7 +36,9 @@ discard block |
||
| 34 | 36 | { |
| 35 | 37 | $data = new Rules\IsNumeric(); |
| 36 | 38 | $this->assertInstanceOf(Rules\ARule::class, $data); |
| 37 | - if (!$resultNum) $this->expectException(RuleException::class); |
|
| 39 | + if (!$resultNum) { |
|
| 40 | + $this->expectException(RuleException::class); |
|
| 41 | + } |
|
| 38 | 42 | $data->validate(MockEntry::init('foo', $value)); |
| 39 | 43 | } |
| 40 | 44 | |
@@ -50,7 +54,9 @@ discard block |
||
| 50 | 54 | { |
| 51 | 55 | $data = new Rules\IsString(); |
| 52 | 56 | $this->assertInstanceOf(Rules\ARule::class, $data); |
| 53 | - if (!$resultStr) $this->expectException(RuleException::class); |
|
| 57 | + if (!$resultStr) { |
|
| 58 | + $this->expectException(RuleException::class); |
|
| 59 | + } |
|
| 54 | 60 | $data->validate(MockEntry::init('foo', $value)); |
| 55 | 61 | } |
| 56 | 62 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $this->assertInstanceOf(File\AFileRule::class, $data); |
| 80 | 80 | $data->setAgainstValue($maxSize); |
| 81 | 81 | $mock = MockFile::init('foo', 'text0.txt', 'text/plain', |
| 82 | - '', $fileSize, UPLOAD_ERR_OK ); |
|
| 82 | + '', $fileSize, UPLOAD_ERR_OK); |
|
| 83 | 83 | if (!$match) $this->expectException(RuleException::class); |
| 84 | 84 | $data->validate($mock); |
| 85 | 85 | } |
@@ -87,10 +87,10 @@ discard block |
||
| 87 | 87 | public function sizeMatchProvider(): array |
| 88 | 88 | { |
| 89 | 89 | return [ |
| 90 | - ['32', 128, false], |
|
| 90 | + ['32', 128, false], |
|
| 91 | 91 | ['10g', 46843, true], |
| 92 | 92 | ['15m', 84641, true], |
| 93 | - ['30k', 3534, true], |
|
| 93 | + ['30k', 3534, true], |
|
| 94 | 94 | ['30k', 35534, false], |
| 95 | 95 | ]; |
| 96 | 96 | } |
@@ -20,7 +20,9 @@ discard block |
||
| 20 | 20 | $data->setAgainstValue($expectedValue); |
| 21 | 21 | $this->assertInstanceOf(Rules\ARule::class, $data); |
| 22 | 22 | $mock = MockEntry::init($key, $checkValue); |
| 23 | - if (!$gotResult) $this->expectException(RuleException::class); |
|
| 23 | + if (!$gotResult) { |
|
| 24 | + $this->expectException(RuleException::class); |
|
| 25 | + } |
|
| 24 | 26 | $data->validate($mock); |
| 25 | 27 | } |
| 26 | 28 | |
@@ -38,7 +40,9 @@ discard block |
||
| 38 | 40 | $data->setAgainstValue($expectedValue); |
| 39 | 41 | $this->assertInstanceOf(Rules\ARule::class, $data); |
| 40 | 42 | $mock = MockEntry::init($key, $checkValue); |
| 41 | - if (!$gotResult) $this->expectException(RuleException::class); |
|
| 43 | + if (!$gotResult) { |
|
| 44 | + $this->expectException(RuleException::class); |
|
| 45 | + } |
|
| 42 | 46 | $data->validate($mock); |
| 43 | 47 | } |
| 44 | 48 | } |
@@ -69,7 +69,9 @@ discard block |
||
| 69 | 69 | $this->assertInstanceOf(Rules\ARule::class, $data); |
| 70 | 70 | |
| 71 | 71 | $mock = MockEntry::init('foo', 'bar'); |
| 72 | - if (!$matchAll) $this->expectException(RuleException::class); |
|
| 72 | + if (!$matchAll) { |
|
| 73 | + $this->expectException(RuleException::class); |
|
| 74 | + } |
|
| 73 | 75 | $data->validate($mock); |
| 74 | 76 | } |
| 75 | 77 | |
@@ -86,7 +88,9 @@ discard block |
||
| 86 | 88 | $data->setAgainstValue($expectedValue); |
| 87 | 89 | $this->assertInstanceOf(Rules\ARule::class, $data); |
| 88 | 90 | $mock = MockEntry::init('foo', 'bar'); |
| 89 | - if (!$matchAny) $this->expectException(RuleException::class); |
|
| 91 | + if (!$matchAny) { |
|
| 92 | + $this->expectException(RuleException::class); |
|
| 93 | + } |
|
| 90 | 94 | $data->validate($mock); |
| 91 | 95 | } |
| 92 | 96 | |
@@ -111,11 +111,11 @@ |
||
| 111 | 111 | public function compareRangesProvider(): array |
| 112 | 112 | { |
| 113 | 113 | return [ |
| 114 | - [2, '8', '4', false, false, ], |
|
| 115 | - [2, '8', '2', false, true, ], |
|
| 116 | - [6, '4', '8', true, true, ], |
|
| 117 | - [10, '2', '10', false, true, ], |
|
| 118 | - [10, '2', '6', false, false, ], |
|
| 114 | + [2, '8', '4', false, false, ], |
|
| 115 | + [2, '8', '2', false, true, ], |
|
| 116 | + [6, '4', '8', true, true, ], |
|
| 117 | + [10, '2', '10', false, true, ], |
|
| 118 | + [10, '2', '6', false, false, ], |
|
| 119 | 119 | ]; |
| 120 | 120 | } |
| 121 | 121 | } |
@@ -16,7 +16,9 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $data = new Rules\InRange(); |
| 18 | 18 | $this->assertInstanceOf(Rules\ARule::class, $data); |
| 19 | - if ($gotException) $this->expectException(RuleException::class); |
|
| 19 | + if ($gotException) { |
|
| 20 | + $this->expectException(RuleException::class); |
|
| 21 | + } |
|
| 20 | 22 | $data->setAgainstValue($expectedValue); |
| 21 | 23 | } |
| 22 | 24 | |
@@ -47,7 +49,9 @@ discard block |
||
| 47 | 49 | $data->setAgainstValue([$lowerLimit, $upperLimit]); |
| 48 | 50 | $this->assertInstanceOf(Rules\ARule::class, $data); |
| 49 | 51 | $mock = MockEntry::init('foo', $checkValue); |
| 50 | - if (!$range) $this->expectException(RuleException::class); |
|
| 52 | + if (!$range) { |
|
| 53 | + $this->expectException(RuleException::class); |
|
| 54 | + } |
|
| 51 | 55 | $data->validate($mock); |
| 52 | 56 | } |
| 53 | 57 | |
@@ -66,7 +70,9 @@ discard block |
||
| 66 | 70 | $data->setAgainstValue([$lowerLimit, $upperLimit]); |
| 67 | 71 | $this->assertInstanceOf(Rules\ARule::class, $data); |
| 68 | 72 | $mock = MockEntry::init('foo', $checkValue); |
| 69 | - if (!$rangeEq) $this->expectException(RuleException::class); |
|
| 73 | + if (!$rangeEq) { |
|
| 74 | + $this->expectException(RuleException::class); |
|
| 75 | + } |
|
| 70 | 76 | $data->validate($mock); |
| 71 | 77 | } |
| 72 | 78 | |
@@ -85,7 +91,9 @@ discard block |
||
| 85 | 91 | $data->setAgainstValue([$lowerLimit, $upperLimit]); |
| 86 | 92 | $this->assertInstanceOf(Rules\ARule::class, $data); |
| 87 | 93 | $mock = MockEntry::init('foo', $checkValue); |
| 88 | - if ($range) $this->expectException(RuleException::class); |
|
| 94 | + if ($range) { |
|
| 95 | + $this->expectException(RuleException::class); |
|
| 96 | + } |
|
| 89 | 97 | $data->validate($mock); |
| 90 | 98 | } |
| 91 | 99 | |
@@ -104,7 +112,9 @@ discard block |
||
| 104 | 112 | $data->setAgainstValue([$lowerLimit, $upperLimit]); |
| 105 | 113 | $this->assertInstanceOf(Rules\ARule::class, $data); |
| 106 | 114 | $mock = MockEntry::init('foo', $checkValue); |
| 107 | - if ($rangeEq) $this->expectException(RuleException::class); |
|
| 115 | + if ($rangeEq) { |
|
| 116 | + $this->expectException(RuleException::class); |
|
| 117 | + } |
|
| 108 | 118 | $data->validate($mock); |
| 109 | 119 | } |
| 110 | 120 | |