Skip to content

Commit

Permalink
StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
inxilpro committed May 27, 2021
1 parent 1808581 commit f917417
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 26 deletions.
5 changes: 0 additions & 5 deletions src/Illuminate/Support/Traits/Conditional.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

namespace Illuminate\Support\Traits;

use BadMethodCallException;
use Closure;
use ReflectionClass;
use ReflectionMethod;

trait Conditional
{
/**
Expand Down
4 changes: 2 additions & 2 deletions tests/Validation/ValidationDimensionsRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public function testItCorrectlyFormatsAStringVersionOfTheRule()
$this->assertSame('dimensions:min_width=300,min_height=400', (string) $rule);

$rule = Rule::dimensions()
->when(true, function($rule) {
->when(true, function ($rule) {
$rule->height('100');
})
->unless(true, function($rule) {
->unless(true, function ($rule) {
$rule->width('200');
});
$this->assertSame('dimensions:height=100', (string) $rule);
Expand Down
26 changes: 13 additions & 13 deletions tests/Validation/ValidationExistsRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,29 +119,29 @@ public function testItChoosesValidRecordsUsingWhereNotInRule()
public function testItChoosesValidRecordsUsingConditionalModifiers()
{
$rule = new Exists('users', 'id');
$rule->when(true, function($rule) {
$rule->whereNotIn('type', [ 'foo', 'bar' ]);
$rule->when(true, function ($rule) {
$rule->whereNotIn('type', ['foo', 'bar']);
});
$rule->unless(true, function($rule) {
$rule->whereNotIn('type', [ 'baz', 'other' ]);
$rule->unless(true, function ($rule) {
$rule->whereNotIn('type', ['baz', 'other']);
});

User::create([ 'id' => '1', 'type' => 'foo' ]);
User::create([ 'id' => '2', 'type' => 'bar' ]);
User::create([ 'id' => '3', 'type' => 'baz' ]);
User::create([ 'id' => '4', 'type' => 'other' ]);
User::create(['id' => '1', 'type' => 'foo']);
User::create(['id' => '2', 'type' => 'bar']);
User::create(['id' => '3', 'type' => 'baz']);
User::create(['id' => '4', 'type' => 'other']);

$trans = $this->getIlluminateArrayTranslator();
$v = new Validator($trans, [], [ 'id' => $rule ]);
$v = new Validator($trans, [], ['id' => $rule]);
$v->setPresenceVerifier(new DatabasePresenceVerifier(Eloquent::getConnectionResolver()));

$v->setData([ 'id' => 1 ]);
$v->setData(['id' => 1]);
$this->assertFalse($v->passes());
$v->setData([ 'id' => 2 ]);
$v->setData(['id' => 2]);
$this->assertFalse($v->passes());
$v->setData([ 'id' => 3 ]);
$v->setData(['id' => 3]);
$this->assertTrue($v->passes());
$v->setData([ 'id' => 4 ]);
$v->setData(['id' => 4]);
$this->assertTrue($v->passes());
}

Expand Down
8 changes: 4 additions & 4 deletions tests/Validation/ValidationPasswordRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,20 @@ public function testMin()
public function testConditional()
{
$is_privileged_user = true;
$rule = (new Password(8))->when($is_privileged_user, function($rule) {
$rule = (new Password(8))->when($is_privileged_user, function ($rule) {
$rule->symbols();
});

$this->fails($rule, [ 'aaaaaaaa', '11111111' ], [
$this->fails($rule, ['aaaaaaaa', '11111111'], [
'The my password must contain at least one symbol.',
]);

$is_privileged_user = false;
$rule = (new Password(8))->when($is_privileged_user, function($rule) {
$rule = (new Password(8))->when($is_privileged_user, function ($rule) {
$rule->symbols();
});

$this->passes($rule, [ 'aaaaaaaa', '11111111' ]);
$this->passes($rule, ['aaaaaaaa', '11111111']);
}

public function testMixedCase()
Expand Down
4 changes: 2 additions & 2 deletions tests/Validation/ValidationUniqueRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ public function testItCorrectlyFormatsAStringVersionOfTheRule()

$rule = new Unique(EloquentModelStub::class, 'column');
$rule->where('foo', 'bar');
$rule->when(true, function($rule) {
$rule->when(true, function ($rule) {
$rule->ignore('Taylor, Otwell', 'id_column');
});
$rule->unless(true, function($rule) {
$rule->unless(true, function ($rule) {
$rule->ignore('Chris', 'id_column');
});
$this->assertSame('unique:table,column,"Taylor, Otwell",id_column,foo,"bar"', (string) $rule);
Expand Down

0 comments on commit f917417

Please sign in to comment.