From cd4654585524d9ede432a14f9d71fa78fa0c3265 Mon Sep 17 00:00:00 2001 From: Henrique Moody Date: Sat, 24 Oct 2015 01:32:07 -0200 Subject: [PATCH] Small coding standards and docs improvements --- docs/ArrayVal.md | 2 +- library/Exceptions/BoolValException.php | 2 +- library/Exceptions/FloatTypeException.php | 2 +- library/Rules/Bsn.php | 4 ++-- library/Rules/CountryCode.php | 6 +++--- library/Rules/CreditCard.php | 2 +- library/Rules/NfeAccessKey.php | 2 +- library/Rules/VideoUrl.php | 2 +- library/Validator.php | 2 +- tests/integration/exception_update.phpt | 2 +- tests/integration/issue-425.phpt | 2 +- tests/integration/readme/example_1.phpt | 4 ++-- tests/integration/readme/example_2.phpt | 6 +++--- tests/integration/readme/example_3.phpt | 4 ++-- tests/integration/readme/example_4.phpt | 4 ++-- tests/integration/rules/allOf_2.phpt | 2 +- tests/integration/rules/allOf_3.phpt | 2 +- tests/integration/rules/allOf_4.phpt | 2 +- tests/integration/rules/allOf_5.phpt | 2 +- tests/integration/rules/beetwen_1.phpt | 2 +- tests/integration/rules/boolval_2.phpt | 8 ++++---- tests/integration/rules/ip_3.phpt | 4 ++-- tests/integration/rules/ip_4.phpt | 4 ++-- tests/integration/rules/ip_5.phpt | 4 ++-- tests/integration/rules/iterable_1.phpt | 2 +- tests/integration/rules/keyValue_1.phpt | 2 +- tests/integration/rules/keyValue_2.phpt | 2 +- tests/integration/rules/notBlank_1.phpt | 2 +- tests/integration/rules/notEmpty_1.phpt | 2 +- tests/integration/rules/objectType_1.phpt | 4 ++-- .../Exceptions/NestedValidationExceptionTest.php | 2 +- tests/unit/Exceptions/ValidationExceptionTest.php | 8 ++++---- tests/unit/Rules/CountableTest.php | 2 +- tests/unit/Rules/CountryCodeTest.php | 4 ++-- tests/unit/Rules/CurrencyCodeTest.php | 4 ++-- tests/unit/Rules/FloatTypeTest.php | 4 ++-- tests/unit/Rules/IterableTest.php | 6 +++--- tests/unit/Rules/KeyNestedTest.php | 12 ++++++------ 38 files changed, 66 insertions(+), 66 deletions(-) diff --git a/docs/ArrayVal.md b/docs/ArrayVal.md index 8beec4b4c..eb246a136 100644 --- a/docs/ArrayVal.md +++ b/docs/ArrayVal.md @@ -2,7 +2,7 @@ - `v::arrayVal()` -Validates if the input is an array or if the input be used as an array +Validates if the input is an array or if the input can be used as an array (instance of `ArrayAccess`). ```php diff --git a/library/Exceptions/BoolValException.php b/library/Exceptions/BoolValException.php index 96a43d33e..bb2ab4367 100644 --- a/library/Exceptions/BoolValException.php +++ b/library/Exceptions/BoolValException.php @@ -18,6 +18,6 @@ class BoolValException extends ValidationException ], self::MODE_NEGATIVE => [ self::STANDARD => '{{name}} must not be a boolean value', - ] + ], ]; } diff --git a/library/Exceptions/FloatTypeException.php b/library/Exceptions/FloatTypeException.php index 439f5d945..178f2a6b1 100644 --- a/library/Exceptions/FloatTypeException.php +++ b/library/Exceptions/FloatTypeException.php @@ -19,6 +19,6 @@ class FloatTypeException extends ValidationException ], self::MODE_NEGATIVE => [ self::STANDARD => '{{name}} must not be of the type float', - ] + ], ]; } diff --git a/library/Rules/Bsn.php b/library/Rules/Bsn.php index 145ea2f93..99f0c1d0f 100644 --- a/library/Rules/Bsn.php +++ b/library/Rules/Bsn.php @@ -12,7 +12,7 @@ namespace Respect\Validation\Rules; /** - * Validates a Dutch citizen service number (BSN) + * Validates a Dutch citizen service number (BSN). * * @author Ronald Drenth * @@ -34,7 +34,7 @@ public function validate($input) } $sum = -1 * $input[8]; - for ($i = 9; $i > 1; $i--) { + for ($i = 9; $i > 1; --$i) { $sum += $i * $input[9 - $i]; } diff --git a/library/Rules/CountryCode.php b/library/Rules/CountryCode.php index 7611e0926..37cc8c809 100644 --- a/library/Rules/CountryCode.php +++ b/library/Rules/CountryCode.php @@ -18,8 +18,8 @@ */ class CountryCode extends AbstractSearcher { - const ALPHA2 = 'alpha-2'; - const ALPHA3 = 'alpha-3'; + const ALPHA2 = 'alpha-2'; + const ALPHA3 = 'alpha-3'; const NUMERIC = 'numeric'; /** @@ -293,7 +293,7 @@ public function __construct($set = self::ALPHA2) throw new ComponentException(sprintf('"%s" is not a valid country set for ISO 3166-1', $set)); } - $this->set = $set; + $this->set = $set; $this->index = $index; } diff --git a/library/Rules/CreditCard.php b/library/Rules/CreditCard.php index 4ec55647f..20752f6ae 100644 --- a/library/Rules/CreditCard.php +++ b/library/Rules/CreditCard.php @@ -27,7 +27,7 @@ private function verifyMod10($input) { $sum = 0; $input = strrev($input); - for ($i = 0; $i < strlen($input); $i++) { + for ($i = 0; $i < strlen($input); ++$i) { $current = substr($input, $i, 1); if ($i % 2 == 1) { $current *= 2; diff --git a/library/Rules/NfeAccessKey.php b/library/Rules/NfeAccessKey.php index cad013ace..6be3ed461 100644 --- a/library/Rules/NfeAccessKey.php +++ b/library/Rules/NfeAccessKey.php @@ -33,7 +33,7 @@ public function validate($aK) } $w = []; - for ($i = 0, $z = 5, $m = 43; $i <= $m; $i++) { + for ($i = 0, $z = 5, $m = 43; $i <= $m; ++$i) { $z = ($i < $m) ? ($z - 1) == 1 ? 9 : ($z - 1) : 0; $w[] = $z; } diff --git a/library/Rules/VideoUrl.php b/library/Rules/VideoUrl.php index 7004633f7..c346105da 100644 --- a/library/Rules/VideoUrl.php +++ b/library/Rules/VideoUrl.php @@ -34,7 +34,7 @@ class VideoUrl extends AbstractRule ]; /** - * Create a new instance VideoUrl + * Create a new instance VideoUrl. * * @param string $service */ diff --git a/library/Validator.php b/library/Validator.php index 601287c4c..0cabf6377 100644 --- a/library/Validator.php +++ b/library/Validator.php @@ -55,7 +55,7 @@ * @method static Validator each(Validatable $itemValidator = null, Validatable $keyValidator = null) * @method static Validator email() * @method static Validator endsWith(mixed $endValue, bool $identical = false) - * @method static Validator equals(mixed $compareTo, bool $compareIdentical = false) + * @method static Validator equals(mixed $compareTo) * @method static Validator even() * @method static Validator executable() * @method static Validator exists() diff --git a/tests/integration/exception_update.phpt b/tests/integration/exception_update.phpt index d402f6da9..bc6c77f48 100644 --- a/tests/integration/exception_update.phpt +++ b/tests/integration/exception_update.phpt @@ -8,7 +8,7 @@ use Respect\Validation\Validator as v; try { v::not(v::alnum())->check('abc123'); } catch (Exception $exception) { - $exception->setParam('translator', function() { + $exception->setParam('translator', function () { return '{{name}} não deve conter letras (a-z) ou dígitos (0-9)'; }); echo $exception->getMessage(); diff --git a/tests/integration/issue-425.phpt b/tests/integration/issue-425.phpt index e3d263c55..1c79cf418 100644 --- a/tests/integration/issue-425.phpt +++ b/tests/integration/issue-425.phpt @@ -3,8 +3,8 @@ require 'vendor/autoload.php'; -use Respect\Validation\Validator as v; use Respect\Validation\Exceptions\AllOfException; +use Respect\Validation\Validator as v; $validator = v::create() ->key('age', v::intType()->notEmpty()->noneOf(v::stringType())) diff --git a/tests/integration/readme/example_1.phpt b/tests/integration/readme/example_1.phpt index 342876757..abe8812b9 100644 --- a/tests/integration/readme/example_1.phpt +++ b/tests/integration/readme/example_1.phpt @@ -4,11 +4,11 @@ require 'vendor/autoload.php'; use Respect\Validation\Validator as v; -$user = new stdClass; +$user = new stdClass(); $user->name = 'Alexandre'; $user->birthdate = '1987-07-01'; -$userValidator = v::attribute('name', v::stringType()->length(1,32)) +$userValidator = v::attribute('name', v::stringType()->length(1, 32)) ->attribute('birthdate', v::date()->age(18)); $userValidator->assert($user); diff --git a/tests/integration/readme/example_2.phpt b/tests/integration/readme/example_2.phpt index 3d41eb8c8..60fc9a22b 100644 --- a/tests/integration/readme/example_2.phpt +++ b/tests/integration/readme/example_2.phpt @@ -2,14 +2,14 @@ noWhitespace()->length(1, 15); try { $usernameValidator->assert('really messed up screen#name'); -} catch(NestedValidationException $exception) { - echo $exception->getFullMessage(); +} catch (NestedValidationException $exception) { + echo $exception->getFullMessage(); } ?> --EXPECTF-- diff --git a/tests/integration/readme/example_3.phpt b/tests/integration/readme/example_3.phpt index 71babe219..e8ff71cea 100644 --- a/tests/integration/readme/example_3.phpt +++ b/tests/integration/readme/example_3.phpt @@ -2,13 +2,13 @@ noWhitespace()->length(1, 15); try { $usernameValidator->assert('really messed up screen#name'); -} catch(NestedValidationException $exception) { +} catch (NestedValidationException $exception) { print_r($exception->findMessages(['alnum', 'noWhitespace'])); } ?> diff --git a/tests/integration/readme/example_4.phpt b/tests/integration/readme/example_4.phpt index 66979ba0c..abf0b05ed 100644 --- a/tests/integration/readme/example_4.phpt +++ b/tests/integration/readme/example_4.phpt @@ -2,13 +2,13 @@ noWhitespace()->length(1, 15); try { $usernameValidator->assert('really messed up screen#name'); -} catch(NestedValidationException $exception) { +} catch (NestedValidationException $exception) { print_r($exception->getMessages()); } ?> diff --git a/tests/integration/rules/allOf_2.phpt b/tests/integration/rules/allOf_2.phpt index e93d0f155..6ee15a9cd 100644 --- a/tests/integration/rules/allOf_2.phpt +++ b/tests/integration/rules/allOf_2.phpt @@ -2,8 +2,8 @@ check('Luke i\'m your father'); diff --git a/tests/integration/rules/allOf_3.phpt b/tests/integration/rules/allOf_3.phpt index 5de1f90cf..d9fdd0fba 100644 --- a/tests/integration/rules/allOf_3.phpt +++ b/tests/integration/rules/allOf_3.phpt @@ -2,8 +2,8 @@ assert(42); diff --git a/tests/integration/rules/allOf_4.phpt b/tests/integration/rules/allOf_4.phpt index 077ec0593..b53a68c3d 100644 --- a/tests/integration/rules/allOf_4.phpt +++ b/tests/integration/rules/allOf_4.phpt @@ -2,8 +2,8 @@ check(42); diff --git a/tests/integration/rules/allOf_5.phpt b/tests/integration/rules/allOf_5.phpt index 88ee57017..62f830122 100644 --- a/tests/integration/rules/allOf_5.phpt +++ b/tests/integration/rules/allOf_5.phpt @@ -2,8 +2,8 @@ assert('Frank Zappa is fantastic'); diff --git a/tests/integration/rules/beetwen_1.phpt b/tests/integration/rules/beetwen_1.phpt index 272772e25..e2d3a651f 100644 --- a/tests/integration/rules/beetwen_1.phpt +++ b/tests/integration/rules/beetwen_1.phpt @@ -8,7 +8,7 @@ use Respect\Validation\Validator as v; v::intType()->between(1, 42)->check(2); v::intType()->between(1, 2)->assert(2); -v::date()->between('1989-12-20', 'tomorrow', false)->assert(new DateTime); +v::date()->between('1989-12-20', 'tomorrow', false)->assert(new DateTime()); v::stringType()->between('a', 'e', false)->assert('d'); ?> diff --git a/tests/integration/rules/boolval_2.phpt b/tests/integration/rules/boolval_2.phpt index d46ab5de2..87d9e0c5e 100644 --- a/tests/integration/rules/boolval_2.phpt +++ b/tests/integration/rules/boolval_2.phpt @@ -9,25 +9,25 @@ use Respect\Validation\Validator as v; try { v::boolVal()->check('ok'); } catch (BoolValException $e) { - echo $e->getMainMessage() . PHP_EOL; + echo $e->getMainMessage().PHP_EOL; } try { v::not(v::boolVal())->check('yes'); } catch (BoolValException $e) { - echo $e->getMainMessage() . PHP_EOL; + echo $e->getMainMessage().PHP_EOL; } try { v::boolVal()->assert('yep'); } catch (AllOfException $e) { - echo $e->getFullMessage() . PHP_EOL; + echo $e->getFullMessage().PHP_EOL; } try { v::not(v::boolVal())->assert('on'); } catch (AllOfException $e) { - echo $e->getFullMessage() . PHP_EOL; + echo $e->getFullMessage().PHP_EOL; } ?> --EXPECTF-- diff --git a/tests/integration/rules/ip_3.phpt b/tests/integration/rules/ip_3.phpt index 0817baa6e..e5f63c239 100644 --- a/tests/integration/rules/ip_3.phpt +++ b/tests/integration/rules/ip_3.phpt @@ -9,13 +9,13 @@ use Respect\Validation\Validator as v; try { v::ip()->check('foo'); } catch (IpException $e) { - echo $e->getMainMessage() . PHP_EOL; + echo $e->getMainMessage().PHP_EOL; } try { v::ip()->assert('foo'); } catch (AllOfException $e) { - echo $e->getFullMessage() . PHP_EOL; + echo $e->getFullMessage().PHP_EOL; } ?> --EXPECTF-- diff --git a/tests/integration/rules/ip_4.phpt b/tests/integration/rules/ip_4.phpt index 500bf22e3..a316cfc99 100644 --- a/tests/integration/rules/ip_4.phpt +++ b/tests/integration/rules/ip_4.phpt @@ -9,13 +9,13 @@ use Respect\Validation\Validator as v; try { v::not(v::ip())->check('10.0.0.1'); } catch (IpException $e) { - echo $e->getMainMessage() . PHP_EOL; + echo $e->getMainMessage().PHP_EOL; } try { v::not(v::ip())->assert('10.0.0.1'); } catch (AllOfException $e) { - echo $e->getFullMessage() . PHP_EOL; + echo $e->getFullMessage().PHP_EOL; } ?> --EXPECTF-- diff --git a/tests/integration/rules/ip_5.phpt b/tests/integration/rules/ip_5.phpt index 928416901..3d573ab26 100644 --- a/tests/integration/rules/ip_5.phpt +++ b/tests/integration/rules/ip_5.phpt @@ -9,13 +9,13 @@ use Respect\Validation\Validator as v; try { v::ip('127.0.1.*')->check('127.0.0.1'); } catch (IpException $e) { - echo $e->getMainMessage() . PHP_EOL; + echo $e->getMainMessage().PHP_EOL; } try { v::ip('127.0.1.*')->assert('127.0.0.1'); } catch (AllOfException $e) { - echo $e->getFullMessage() . PHP_EOL; + echo $e->getFullMessage().PHP_EOL; } ?> --EXPECTF-- diff --git a/tests/integration/rules/iterable_1.phpt b/tests/integration/rules/iterable_1.phpt index 127a5df73..83684af63 100644 --- a/tests/integration/rules/iterable_1.phpt +++ b/tests/integration/rules/iterable_1.phpt @@ -6,6 +6,6 @@ require 'vendor/autoload.php'; use Respect\Validation\Validator as v; v::iterable()->assert([1, 2, 3]); -v::iterable()->check(new ArrayObject); +v::iterable()->check(new ArrayObject()); ?> --EXPECTF-- diff --git a/tests/integration/rules/keyValue_1.phpt b/tests/integration/rules/keyValue_1.phpt index 7fdadc287..70c93c90f 100644 --- a/tests/integration/rules/keyValue_1.phpt +++ b/tests/integration/rules/keyValue_1.phpt @@ -7,7 +7,7 @@ use Respect\Validation\Validator as v; $data = [ 'password' => 'shuberry', 'password_confirmation' => 'shuberry', - 'valid_passwords' => ['shuberry', 'monty-python'] + 'valid_passwords' => ['shuberry', 'monty-python'], ]; v::keyValue('password', 'equals', 'password_confirmation')->check($data); diff --git a/tests/integration/rules/keyValue_2.phpt b/tests/integration/rules/keyValue_2.phpt index d446426a0..9ee65753a 100644 --- a/tests/integration/rules/keyValue_2.phpt +++ b/tests/integration/rules/keyValue_2.phpt @@ -7,7 +7,7 @@ use Respect\Validation\Validator as v; $data = [ 'password' => 'shuberry', - 'password_confirmation' => '_shuberry_' + 'password_confirmation' => '_shuberry_', ]; try { diff --git a/tests/integration/rules/notBlank_1.phpt b/tests/integration/rules/notBlank_1.phpt index 3c9886ba8..12ed0d177 100644 --- a/tests/integration/rules/notBlank_1.phpt +++ b/tests/integration/rules/notBlank_1.phpt @@ -7,7 +7,7 @@ use Respect\Validation\Validator as v; $notBlankValues = [ 'a', 1, - 1.0 + 1.0, ]; //Check the "pure" value diff --git a/tests/integration/rules/notEmpty_1.phpt b/tests/integration/rules/notEmpty_1.phpt index a0e5dc816..2393de636 100644 --- a/tests/integration/rules/notEmpty_1.phpt +++ b/tests/integration/rules/notEmpty_1.phpt @@ -7,7 +7,7 @@ use Respect\Validation\Validator as v; $notEmptyValues = [ 'a', 1, - 1.0 + 1.0, ]; //Check not empty values diff --git a/tests/integration/rules/objectType_1.phpt b/tests/integration/rules/objectType_1.phpt index 9c939379a..0edd9e2bb 100644 --- a/tests/integration/rules/objectType_1.phpt +++ b/tests/integration/rules/objectType_1.phpt @@ -4,7 +4,7 @@ require 'vendor/autoload.php'; use Respect\Validation\Validator as v; -v::objectType()->assert(new stdClass); -v::objectType()->check(new stdClass); +v::objectType()->assert(new stdClass()); +v::objectType()->check(new stdClass()); ?> --EXPECTF-- diff --git a/tests/unit/Exceptions/NestedValidationExceptionTest.php b/tests/unit/Exceptions/NestedValidationExceptionTest.php index dcfb4146f..0109d1ec8 100644 --- a/tests/unit/Exceptions/NestedValidationExceptionTest.php +++ b/tests/unit/Exceptions/NestedValidationExceptionTest.php @@ -13,7 +13,7 @@ /** * phpunit has an issue with mocking exceptions when in HHVM: - * https://github.com/sebastianbergmann/phpunit-mock-objects/issues/207 + * https://github.com/sebastianbergmann/phpunit-mock-objects/issues/207. */ class PrivateNestedValidationException extends NestedValidationException { diff --git a/tests/unit/Exceptions/ValidationExceptionTest.php b/tests/unit/Exceptions/ValidationExceptionTest.php index 65eeb6cad..7854e2281 100644 --- a/tests/unit/Exceptions/ValidationExceptionTest.php +++ b/tests/unit/Exceptions/ValidationExceptionTest.php @@ -104,11 +104,11 @@ public function providerForStringify() [range(1, 80), '{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ... }'], [ ['foo' => true, 'bar' => ['baz' => 123, 'qux' => [1, 2, 3]]], - '{ "foo": true, "bar": { "baz": 123, "qux": { 1, 2, 3 } } }' + '{ "foo": true, "bar": { "baz": 123, "qux": { 1, 2, 3 } } }', ], [ ['foo' => true, 'bar' => ['baz' => 123, 'qux' => ['norf' => [1,2,3]]]], - '{ "foo": true, "bar": { "baz": 123, "qux": { "norf": ... } } }' + '{ "foo": true, "bar": { "baz": 123, "qux": { "norf": ... } } }', ], [[[], 'foo'], '{ { }, "foo" }'], [[[1], 'foo'], '{ { 1 }, "foo" }'], @@ -124,7 +124,7 @@ public function providerForStringify() [$object5, '`[object] (stdClass: { "name": [object] (stdClass: ...) })`'], [ $exception, - '`[exception] (Exception: { "message": "My message", "code": 0, "file": "%s:%d" })`' + '`[exception] (Exception: { "message": "My message", "code": 0, "file": "%s:%d" })`', ], [$iterator1, '`[traversable] (ArrayIterator: { 1, 2, 3 })`'], [$iterator2, '`[traversable] (ArrayIterator: { "a": 1, "b": 2, "c": 3 })`'], @@ -133,7 +133,7 @@ public function providerForStringify() [xml_parser_create(), '`[resource] (xml)`'], [ [$object4, [42, 43], true, null, tmpfile()], - '{ `[object] (stdClass: { "foo": 1, "bar": false })`, { 42, 43 }, true, null, `[resource] (stream)` }' + '{ `[object] (stdClass: { "foo": 1, "bar": false })`, { 42, 43 }, true, null, `[resource] (stream)` }', ], ]; } diff --git a/tests/unit/Rules/CountableTest.php b/tests/unit/Rules/CountableTest.php index 8097efcf8..5754eed4d 100644 --- a/tests/unit/Rules/CountableTest.php +++ b/tests/unit/Rules/CountableTest.php @@ -37,7 +37,7 @@ public function providerForInvalidInput() [$rule, 1.0], [$rule, new \stdClass()], [$rule, PHP_INT_MAX], - [$rule, true] + [$rule, true], ]; } } diff --git a/tests/unit/Rules/CountryCodeTest.php b/tests/unit/Rules/CountryCodeTest.php index d61897f0e..d6754521e 100644 --- a/tests/unit/Rules/CountryCodeTest.php +++ b/tests/unit/Rules/CountryCodeTest.php @@ -48,7 +48,7 @@ public function providerForValidCountryCode() [CountryCode::NUMERIC, '276'], [CountryCode::ALPHA2, 'US'], [CountryCode::ALPHA3, 'USA'], - [CountryCode::NUMERIC, '840'] + [CountryCode::NUMERIC, '840'], ]; } @@ -57,7 +57,7 @@ public function providerForInvalidCountryCode() return [ [CountryCode::ALPHA2, 'USA'], [CountryCode::ALPHA3, 'US'], - [CountryCode::NUMERIC, '000'] + [CountryCode::NUMERIC, '000'], ]; } diff --git a/tests/unit/Rules/CurrencyCodeTest.php b/tests/unit/Rules/CurrencyCodeTest.php index b53646d21..95e0ad0a8 100644 --- a/tests/unit/Rules/CurrencyCodeTest.php +++ b/tests/unit/Rules/CurrencyCodeTest.php @@ -26,7 +26,7 @@ public function providerForValidInput() [$rule, 'GBP'], [$rule, 'XAU'], [$rule, 'xba'], - [$rule, 'xxx'] + [$rule, 'xxx'], ]; } @@ -37,7 +37,7 @@ public function providerForInvalidInput() return [ [$rule, 'BTC'], [$rule, 'GGP'], - [$rule, 'USA'] + [$rule, 'USA'], ]; } } diff --git a/tests/unit/Rules/FloatTypeTest.php b/tests/unit/Rules/FloatTypeTest.php index 7eaa7d16f..27a6f99a9 100644 --- a/tests/unit/Rules/FloatTypeTest.php +++ b/tests/unit/Rules/FloatTypeTest.php @@ -27,7 +27,7 @@ public function providerForValidInput() [$rule, 7E-10], [$rule, 0.0], [$rule, -2.44], - [$rule, 10/33.33], + [$rule, 10 / 33.33], [$rule, PHP_INT_MAX + 1], ]; } @@ -41,7 +41,7 @@ public function providerForInvalidInput() [$rule, '1.0'], [$rule, '7E-10'], [$rule, 111111], - [$rule, PHP_INT_MAX * -1] + [$rule, PHP_INT_MAX * -1], ]; } } diff --git a/tests/unit/Rules/IterableTest.php b/tests/unit/Rules/IterableTest.php index 3770ea74c..fcf26276b 100644 --- a/tests/unit/Rules/IterableTest.php +++ b/tests/unit/Rules/IterableTest.php @@ -23,8 +23,8 @@ public function providerForValidInput() return [ [$rule, [1, 2, 3]], - [$rule, new \stdClass], - [$rule, new \ArrayIterator] + [$rule, new \stdClass()], + [$rule, new \ArrayIterator()], ]; } @@ -37,7 +37,7 @@ public function providerForInvalidInput() [$rule, 'asdf'], [$rule, 9.85], [$rule, null], - [$rule, true] + [$rule, true], ]; } } diff --git a/tests/unit/Rules/KeyNestedTest.php b/tests/unit/Rules/KeyNestedTest.php index 48792ad3b..2114ba610 100644 --- a/tests/unit/Rules/KeyNestedTest.php +++ b/tests/unit/Rules/KeyNestedTest.php @@ -24,7 +24,7 @@ public function testArrayWithPresentKeysWillReturnTrueForFullPathValidator() { $array = [ 'bar' => [ - 'foo' => [ + 'foo' => [ 'baz' => 'hello world!', ], 'foooo' => [ @@ -41,7 +41,7 @@ public function testArrayWithPresentKeysWillReturnTrueForFullPathValidator() public function testArrayWithNumericKeysWillReturnTrueForFullPathValidator() { $array = [ - 0 => 'Zero, the hero!' + 0 => 'Zero, the hero!', ]; $rule = new KeyNested(0, new Equals('Zero, the hero!')); @@ -53,7 +53,7 @@ public function testArrayWithPresentKeysWillReturnTrueForHalfPathValidator() { $array = [ 'bar' => [ - 'foo' => [ + 'foo' => [ 'baz' => 'hello world!', ], 'foooo' => [ @@ -71,7 +71,7 @@ public function testOnjectWithPresentPropertiesWillReturnTrueForDirtyPathValidat { $object = (object) [ 'bar' => (object) [ - 'foo' => (object) [ + 'foo' => (object) [ 'baz' => 'hello world!', ], 'foooo' => (object) [ @@ -148,7 +148,7 @@ public function testExtraValidatorShouldValidateKey() $validator = new KeyNested('bar.foo.baz', $subValidator); $object = [ 'bar' => [ - 'foo' => [ + 'foo' => [ 'baz' => 'example', ], ], @@ -168,7 +168,7 @@ public function testArrayAccessWithPresentKeysWillReturnTrue() { $arrayAccess = new ArrayObject([ 'bar' => [ - 'foo' => [ + 'foo' => [ 'baz' => 'hello world!', ], 'foooo' => [