Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"wixel/gump": "^2.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.25",
"friendsofphp/php-cs-fixer": "^3.48",
"pestphp/pest": "^1.23",
"phpstan/phpstan": "^1.10",
"symfony/var-dumper": "^5.4"
"symfony/var-dumper": "^5.4 || ^6.4"
},
"autoload": {
"psr-4": {
Expand Down
6 changes: 3 additions & 3 deletions src/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
function vr(): Validator\Rule\Valid
{
return new \Validator\Rule\Valid();
return new Validator\Rule\Valid();
}
}

Expand All @@ -20,7 +20,7 @@ function vr(): Validator\Rule\Valid
*/
function fr(): Validator\Rule\Filter
{
return new \Validator\Rule\Filter();
return new Validator\Rule\Filter();
}
}

Expand All @@ -32,6 +32,6 @@ function fr(): Validator\Rule\Filter
*/
function validate($field): Validator\Validator
{
return new \Validator\Validator($field);
return new Validator\Validator($field);
}
}
4 changes: 2 additions & 2 deletions tests/Unit/AddFieldsValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@
});

it('can add field using iterator array', function () {
$fields = new class() implements \IteratorAggregate {
$fields = new class() implements IteratorAggregate {
private $fields = [
'field_1' => 'test',
'field_2' => 'test',
];

public function getIterator(): Traversable
{
return new \ArrayIterator($this->fields);
return new ArrayIterator($this->fields);
}
};

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Filters/BasicTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
});

it('can filter basic_tags', function () {
$fr = new \Validator\Validator(['field' => '<script>link</script>']);
$fr = new Validator\Validator(['field' => '<script>link</script>']);

$fr->filter('field')->basic_tags();

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Filters/Boolean.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
});

it('can filter boolean', function () {
$fr = new \Validator\Validator(
$fr = new Validator\Validator(
[
'field_1' => '1',
'field_2' => 1,
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Filters/HtmlEncode.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
});

it('can filter htmlencode', function () {
$fr = new \Validator\Validator(['field' => '<html>html tag</html>']);
$fr = new Validator\Validator(['field' => '<html>html tag</html>']);

$fr->filter('field')->htmlencode();

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Filters/LowerCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
});

it('can filter lower_case', function () {
$fr = new \Validator\Validator(['field' => 'TEST']);
$fr = new Validator\Validator(['field' => 'TEST']);

$fr->filter('field')->lower_case();

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Filters/MsWordCharacters.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
});

it('can filter ms_word_characters', function () {
$fr = new \Validator\Validator(['field' => '“test”,‘test’,–,…']);
$fr = new Validator\Validator(['field' => '“test”,‘test’,–,…']);

$fr->filter('field')->ms_word_characters();

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Filters/NoiceWords.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
});

it('can filter noice_words', function () {
$fr = new \Validator\Validator(['field' => 'word']);
$fr = new Validator\Validator(['field' => 'word']);

$fr->filter('field')->noise_words();

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Filters/RemovePunctuation.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
});

it('can filter rmpunctuation', function () {
$fr = new \Validator\Validator(['field' => 'is true?']);
$fr = new Validator\Validator(['field' => 'is true?']);

$fr->filter('field')->rmpunctuation();

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Filters/SanitizeEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
});

it('can filter sanitize_email', function () {
$fr = new \Validator\Validator(['field' => 'john(.doe)@exa//mple.com']);
$fr = new Validator\Validator(['field' => 'john(.doe)@exa//mple.com']);

$fr->filter('field')->sanitize_email();

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Filters/SanitizeFloats.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
});

it('can filter sanitize_floats', function () {
$fr = new \Validator\Validator(['field' => '12.3']);
$fr = new Validator\Validator(['field' => '12.3']);

$fr->filter('field')->sanitize_floats();

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Filters/SanitizeNumbers.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
});

it('can filter sanitize_numbers', function () {
$fr = new \Validator\Validator(['field' => '5-2+3pp']);
$fr = new Validator\Validator(['field' => '5-2+3pp']);

$fr->filter('field')->sanitize_numbers();

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Filters/SanitizeString.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
});

it('can filter sanitize_string', function () {
$fr = new \Validator\Validator(['field' => '<h1>Hello World!</h1>']);
$fr = new Validator\Validator(['field' => '<h1>Hello World!</h1>']);

$fr->filter('field')->sanitize_string();

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Filters/Slug.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
});

it('can filter slug', function () {
$fr = new \Validator\Validator(['field' => 'long title tobe url']);
$fr = new Validator\Validator(['field' => 'long title tobe url']);

$fr->filter('field')->slug();

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Filters/Trim.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
});

it('can filter trim', function () {
$fr = new \Validator\Validator(['field' => ' nomore space ']);
$fr = new Validator\Validator(['field' => ' nomore space ']);

$fr->filter('field')->trim();

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Filters/UpperCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
});

it('can filter upper_case', function () {
$fr = new \Validator\Validator(['field' => 'test']);
$fr = new Validator\Validator(['field' => 'test']);

$fr->filter('field')->upper_case();

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Filters/UrlEncode.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
});

it('can filter urlencode', function () {
$fr = new \Validator\Validator(['field' => 'test.com/true/right?one=1#2']);
$fr = new Validator\Validator(['field' => 'test.com/true/right?one=1#2']);

$fr->filter('field')->urlencode();

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Filters/WholeNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
});

it('can filter whole_number', function () {
$fr = new \Validator\Validator(['field' => '123']);
$fr = new Validator\Validator(['field' => '123']);

$fr->filter('field')->whole_number();

Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/Validations/Alpha.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,29 @@

// validate with correct input field
it('can validate alpha with correct input', function () use ($correct) {
$val = new \Validator\Validator($correct);
$val = new Validator\Validator($correct);
$val->test->alpha();

expect($val->is_valid())->toBeTrue();
});

it('can validate alpha (not) with correct input', function () use ($correct) {
$val = new \Validator\Validator($correct);
$val = new Validator\Validator($correct);
$val->test->not()->alpha();

expect($val->is_valid())->toBeFalse();
});

// validate with incorrect input field
it('can validate alpha with incorrect input', function () use ($incorrect) {
$val = new \Validator\Validator($incorrect);
$val = new Validator\Validator($incorrect);
$val->test->alpha();

expect($val->is_valid())->toBeFalse();
});

it('can validate alpha (not) with incorrect input', function () use ($incorrect) {
$val = new \Validator\Validator($incorrect);
$val = new Validator\Validator($incorrect);
$val->test->not()->alpha();

expect($val->is_valid())->toBeTrue();
Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/Validations/AlphaDash.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,29 @@

// validate with correct input field
it('can validate alpha with correct input', function () use ($correct) {
$val = new \Validator\Validator($correct);
$val = new Validator\Validator($correct);
$val->test->alpha_dash();

expect($val->is_valid())->toBeTrue();
});

it('can validate alpha (not) with correct input', function () use ($correct) {
$val = new \Validator\Validator($correct);
$val = new Validator\Validator($correct);
$val->test->not()->alpha_dash();

expect($val->is_valid())->toBeFalse();
});

// validate with incorrect input field
it('can validate alpha with incorrect input', function () use ($incorrect) {
$val = new \Validator\Validator($incorrect);
$val = new Validator\Validator($incorrect);
$val->test->alpha_dash();

expect($val->is_valid())->toBeFalse();
});

it('can validate alpha (not) with incorrect input', function () use ($incorrect) {
$val = new \Validator\Validator($incorrect);
$val = new Validator\Validator($incorrect);
$val->test->not()->alpha_dash();

expect($val->is_valid())->toBeTrue();
Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/Validations/AlphaNumeric.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,29 @@

// validate with correct input field
it('can validate alpha with correct input', function () use ($correct) {
$val = new \Validator\Validator($correct);
$val = new Validator\Validator($correct);
$val->test->alpha_numeric();

expect($val->is_valid())->toBeTrue();
});

it('can validate alpha (not) with correct input', function () use ($correct) {
$val = new \Validator\Validator($correct);
$val = new Validator\Validator($correct);
$val->test->not()->alpha_numeric();

expect($val->is_valid())->toBeFalse();
});

// validate with incorrect input field
it('can validate alpha with incorrect input', function () use ($incorrect) {
$val = new \Validator\Validator($incorrect);
$val = new Validator\Validator($incorrect);
$val->test->alpha_numeric();

expect($val->is_valid())->toBeFalse();
});

it('can validate alpha (not) with incorrect input', function () use ($incorrect) {
$val = new \Validator\Validator($incorrect);
$val = new Validator\Validator($incorrect);
$val->test->not()->alpha_numeric();

expect($val->is_valid())->toBeTrue();
Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/Validations/AlphaNumericDash.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,29 @@

// validate with correct input field
it('can validate alpha with correct input', function () use ($correct) {
$val = new \Validator\Validator($correct);
$val = new Validator\Validator($correct);
$val->test->alpha_numeric_dash();

expect($val->is_valid())->toBeTrue();
});

it('can validate alpha (not) with correct input', function () use ($correct) {
$val = new \Validator\Validator($correct);
$val = new Validator\Validator($correct);
$val->test->not()->alpha_numeric_dash();

expect($val->is_valid())->toBeFalse();
});

// validate with incorrect input field
it('can validate alpha with incorrect input', function () use ($incorrect) {
$val = new \Validator\Validator($incorrect);
$val = new Validator\Validator($incorrect);
$val->test->alpha_numeric_dash();

expect($val->is_valid())->toBeFalse();
});

it('can validate alpha (not) with incorrect input', function () use ($incorrect) {
$val = new \Validator\Validator($incorrect);
$val = new Validator\Validator($incorrect);
$val->test->not()->alpha_numeric_dash();

expect($val->is_valid())->toBeTrue();
Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/Validations/AlphaNumericSpace.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,29 @@

// validate with correct input field
it('can validate alpha with correct input', function () use ($correct) {
$val = new \Validator\Validator($correct);
$val = new Validator\Validator($correct);
$val->test->alpha_numeric_space();

expect($val->is_valid())->toBeTrue();
});

it('can validate alpha (not) with correct input', function () use ($correct) {
$val = new \Validator\Validator($correct);
$val = new Validator\Validator($correct);
$val->test->not()->alpha_numeric_space();

expect($val->is_valid())->toBeFalse();
});

// validate with incorrect input field
it('can validate alpha with incorrect input', function () use ($incorrect) {
$val = new \Validator\Validator($incorrect);
$val = new Validator\Validator($incorrect);
$val->test->alpha_numeric_space();

expect($val->is_valid())->toBeFalse();
});

it('can validate alpha (not) with incorrect input', function () use ($incorrect) {
$val = new \Validator\Validator($incorrect);
$val = new Validator\Validator($incorrect);
$val->test->not()->alpha_numeric_space();

expect($val->is_valid())->toBeTrue();
Expand Down
Loading