Skip to content

Commit

Permalink
Skip brakcets when new. (laravel#26061)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmichot authored and taylorotwell committed Oct 10, 2018
1 parent e47252d commit ba06144
Show file tree
Hide file tree
Showing 31 changed files with 99 additions and 99 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Session/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function all()
*/
public function exists($key)
{
$placeholder = new stdClass();
$placeholder = new stdClass;

return ! collect(is_array($key) ? $key : func_get_args())->contains(function ($key) use ($placeholder) {
return $this->get($key, $placeholder) === $placeholder;
Expand Down
2 changes: 1 addition & 1 deletion tests/Auth/AuthAccessGateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ public function notCallableDataProvider()
{
return [
[1],
[new stdClass()],
[new stdClass],
[[]],
[1.1],
];
Expand Down
2 changes: 1 addition & 1 deletion tests/Auth/AuthAccessResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function testStringMethodWillReturnString()
$response = new Response('some data');
$this->assertSame('some data', (string) $response);

$response = new Response();
$response = new Response;
$this->assertSame('', (string) $response);
}
}
4 changes: 2 additions & 2 deletions tests/Auth/AuthDatabaseUserProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function testRetrieveByIDReturnsNullWhenUserIsNotFound()

public function testRetrieveByTokenReturnsUser()
{
$mockUser = new stdClass();
$mockUser = new stdClass;
$mockUser->remember_token = 'a';

$conn = m::mock(Connection::class);
Expand All @@ -73,7 +73,7 @@ public function testRetrieveTokenWithBadIdentifierReturnsNull()

public function testRetrieveByBadTokenReturnsNull()
{
$mockUser = new stdClass();
$mockUser = new stdClass;
$mockUser->remember_token = null;

$conn = m::mock(Connection::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testWillExecuted()
$user->method('hasVerifiedEmail')->willReturn(false);
$user->expects($this->once())->method('sendEmailVerificationNotification');

$listener = new SendEmailVerificationNotification();
$listener = new SendEmailVerificationNotification;

$listener->handle(new Registered($user));
}
Expand All @@ -32,7 +32,7 @@ public function testUserIsNotInstanceOfMustVerifyEmail()
$user = $this->getMockBuilder(User::class)->getMock();
$user->expects($this->never())->method('sendEmailVerificationNotification');

$listener = new SendEmailVerificationNotification();
$listener = new SendEmailVerificationNotification;

$listener->handle(new Registered($user));
}
Expand All @@ -46,7 +46,7 @@ public function testHasVerifiedEmailAsTrue()
$user->method('hasVerifiedEmail')->willReturn(true);
$user->expects($this->never())->method('sendEmailVerificationNotification');

$listener = new SendEmailVerificationNotification();
$listener = new SendEmailVerificationNotification;

$listener->handle(new Registered($user));
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Auth/AuthenticatableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ class AuthenticatableTest extends TestCase
{
public function testItReturnsSameRememberTokenForString()
{
$user = new User();
$user = new User;
$user->setRememberToken('sample_token');
$this->assertSame('sample_token', $user->getRememberToken());
}

public function testItReturnsStringAsRememberTokenWhenItWasSetToTrue()
{
$user = new User();
$user = new User;
$user->setRememberToken(true);
$this->assertSame('1', $user->getRememberToken());
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Database/DatabaseEloquentBelongsToTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testBelongsToWithDefault()

$this->builder->shouldReceive('first')->once()->andReturnNull();

$newModel = new EloquentBelongsToModelStub(); //ie Blog
$newModel = new EloquentBelongsToModelStub; //ie Blog

$this->related->shouldReceive('newInstance')->once()->andReturn($newModel);

Expand All @@ -41,7 +41,7 @@ public function testBelongsToWithDynamicDefault()

$this->builder->shouldReceive('first')->once()->andReturnNull();

$newModel = new EloquentBelongsToModelStub();
$newModel = new EloquentBelongsToModelStub;

$this->related->shouldReceive('newInstance')->once()->andReturn($newModel);

Expand All @@ -56,7 +56,7 @@ public function testBelongsToWithArrayDefault()

$this->builder->shouldReceive('first')->once()->andReturnNull();

$newModel = new EloquentBelongsToModelStub();
$newModel = new EloquentBelongsToModelStub;

$this->related->shouldReceive('newInstance')->once()->andReturn($newModel);

Expand Down
2 changes: 1 addition & 1 deletion tests/Database/DatabaseEloquentCastsDatabaseStringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function testSavingCastedAttributesToDatabase()
$this->assertSame(['json_key'=>'json_value'], $model->getAttribute('json_attributes'));

$this->assertSame('{"json_key":"json_value"}', $model->getOriginal('object_attributes'));
$stdClass = new stdClass();
$stdClass = new stdClass;
$stdClass->json_key = 'json_value';
$this->assertEquals($stdClass, $model->getAttribute('object_attributes'));
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Database/DatabaseEloquentCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ public function testQueueableCollectionImplementationThrowsExceptionOnMultipleMo

public function testEmptyCollectionStayEmptyOnFresh()
{
$c = new Collection();
$c = new Collection;
$this->assertEquals($c, $c->fresh());
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Database/DatabaseEloquentIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ public function testFreshMethodOnCollection()

$this->assertEquals($users->map->fresh(), $users->fresh());

$users = new Collection();
$users = new Collection;
$this->assertEquals($users->map->fresh(), $users->fresh());
}

Expand Down
6 changes: 3 additions & 3 deletions tests/Database/DatabaseEloquentMorphToTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function testMorphToWithDefault()

$this->builder->shouldReceive('first')->once()->andReturnNull();

$newModel = new EloquentMorphToModelStub();
$newModel = new EloquentMorphToModelStub;

$this->related->shouldReceive('newInstance')->once()->andReturn($newModel);

Expand All @@ -66,7 +66,7 @@ public function testMorphToWithDynamicDefault()

$this->builder->shouldReceive('first')->once()->andReturnNull();

$newModel = new EloquentMorphToModelStub();
$newModel = new EloquentMorphToModelStub;

$this->related->shouldReceive('newInstance')->once()->andReturn($newModel);

Expand All @@ -81,7 +81,7 @@ public function testMorphToWithArrayDefault()

$this->builder->shouldReceive('first')->once()->andReturnNull();

$newModel = new EloquentMorphToModelStub();
$newModel = new EloquentMorphToModelStub;

$this->related->shouldReceive('newInstance')->once()->andReturn($newModel);

Expand Down
8 changes: 4 additions & 4 deletions tests/Database/DatabaseEloquentPivotTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function testDeleteMethodDeletesModelByKeys()

public function testPivotModelTableNameIsSingular()
{
$pivot = new Pivot();
$pivot = new Pivot;

$this->assertEquals('pivot', $pivot->getTable());
}
Expand All @@ -135,7 +135,7 @@ public function testPivotModelWithParentReturnsParentsTimestampColumns()
$parent->shouldReceive('getCreatedAtColumn')->andReturn('parent_created_at');
$parent->shouldReceive('getUpdatedAtColumn')->andReturn('parent_updated_at');

$pivotWithParent = new Pivot();
$pivotWithParent = new Pivot;
$pivotWithParent->pivotParent = $parent;

$this->assertEquals('parent_created_at', $pivotWithParent->getCreatedAtColumn());
Expand All @@ -144,9 +144,9 @@ public function testPivotModelWithParentReturnsParentsTimestampColumns()

public function testPivotModelWithoutParentReturnsModelTimestampColumns()
{
$model = new DummyModel();
$model = new DummyModel;

$pivotWithoutParent = new Pivot();
$pivotWithoutParent = new Pivot;

$this->assertEquals($model->getCreatedAtColumn(), $pivotWithoutParent->getCreatedAtColumn());
$this->assertEquals($model->getUpdatedAtColumn(), $pivotWithoutParent->getUpdatedAtColumn());
Expand Down
2 changes: 1 addition & 1 deletion tests/Database/DatabaseEloquentRelationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public function testIgnoredModelsStateIsResetWhenThereAreExceptions()
$this->assertTrue($related::isIgnoringTouch());
$this->assertTrue($relatedChild::isIgnoringTouch());

throw new Exception();
throw new Exception;
});

$this->fail('Exception was not thrown');
Expand Down
6 changes: 3 additions & 3 deletions tests/Database/DatabaseSchemaBlueprintIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,23 @@ public function testRenameIndexWorks()

$this->assertEquals($expected, $queries);

$queries = $blueprint->toSql($this->db->connection(), new SqlServerGrammar());
$queries = $blueprint->toSql($this->db->connection(), new SqlServerGrammar);

$expected = [
'sp_rename N\'"users"."index1"\', "index2", N\'INDEX\'',
];

$this->assertEquals($expected, $queries);

$queries = $blueprint->toSql($this->db->connection(), new MySqlGrammar());
$queries = $blueprint->toSql($this->db->connection(), new MySqlGrammar);

$expected = [
'alter table `users` rename index `index1` to `index2`',
];

$this->assertEquals($expected, $queries);

$queries = $blueprint->toSql($this->db->connection(), new PostgresGrammar());
$queries = $blueprint->toSql($this->db->connection(), new PostgresGrammar);

$expected = [
'alter index "index1" rename to "index2"',
Expand Down
2 changes: 1 addition & 1 deletion tests/Filesystem/FilesystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ public function testAllFilesReturnsFileInfoObjects()

public function testCreateFtpDriver()
{
$filesystem = new FilesystemManager(new Application());
$filesystem = new FilesystemManager(new Application);

$driver = $filesystem->createFtpDriver([
'host' => 'ftp.example.com',
Expand Down
4 changes: 2 additions & 2 deletions tests/Foundation/FoundationTestResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public function testAssertJsonFragment()

$response->assertJsonFragment(['foo' => 'bar 0', 'bar' => ['foo' => 'bar 0', 'bar' => 'foo 0']]);

$response = TestResponse::fromBaseResponse(new Response(new JsonSerializableSingleResourceWithIntegersStub()));
$response = TestResponse::fromBaseResponse(new Response(new JsonSerializableSingleResourceWithIntegersStub));

$response->assertJsonFragment(['id' => 10]);
}
Expand All @@ -203,7 +203,7 @@ public function testAssertJsonFragmentCanFail()
{
$this->expectException(AssertionFailedError::class);

$response = TestResponse::fromBaseResponse(new Response(new JsonSerializableSingleResourceWithIntegersStub()));
$response = TestResponse::fromBaseResponse(new Response(new JsonSerializableSingleResourceWithIntegersStub));

$response->assertJsonFragment(['id' => 1]);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Http/HttpJsonResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ public function jsonErrorDataProvider()
$resource = tmpfile();

// Recursion can't be encoded
$recursiveObject = new stdClass();
$objectB = new stdClass();
$recursiveObject = new stdClass;
$objectB = new stdClass;
$recursiveObject->b = $objectB;
$objectB->a = $recursiveObject;

Expand Down
20 changes: 10 additions & 10 deletions tests/Http/Middleware/CacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ class CacheTest extends TestCase
{
public function testDoNotSetHeaderWhenMethodNotCacheable()
{
$request = new Request();
$request = new Request;
$request->setMethod('PUT');

$response = (new Cache())->handle($request, function () {
$response = (new Cache)->handle($request, function () {
return new Response('Hello Laravel');
}, 'max_age=120;s_maxage=60');

Expand All @@ -23,8 +23,8 @@ public function testDoNotSetHeaderWhenMethodNotCacheable()

public function testDoNotSetHeaderWhenNoContent()
{
$response = (new Cache())->handle(new Request(), function () {
return new Response();
$response = (new Cache)->handle(new Request, function () {
return new Response;
}, 'max_age=120;s_maxage=60');

$this->assertNull($response->getMaxAge());
Expand All @@ -33,7 +33,7 @@ public function testDoNotSetHeaderWhenNoContent()

public function testAddHeaders()
{
$response = (new Cache())->handle(new Request(), function () {
$response = (new Cache)->handle(new Request, function () {
return new Response('some content');
}, 'max_age=100;s_maxage=200;etag=ABC');

Expand All @@ -43,7 +43,7 @@ public function testAddHeaders()

public function testAddHeadersUsingArray()
{
$response = (new Cache())->handle(new Request(), function () {
$response = (new Cache)->handle(new Request, function () {
return new Response('some content');
}, ['max_age' => 100, 's_maxage' => 200, 'etag' => 'ABC']);

Expand All @@ -53,7 +53,7 @@ public function testAddHeadersUsingArray()

public function testGenerateEtag()
{
$response = (new Cache())->handle(new Request(), function () {
$response = (new Cache)->handle(new Request, function () {
return new Response('some content');
}, 'etag;max_age=100;s_maxage=200');

Expand All @@ -63,10 +63,10 @@ public function testGenerateEtag()

public function testIsNotModified()
{
$request = new Request();
$request = new Request;
$request->headers->set('If-None-Match', '"9893532233caff98cd083a116b013c0b"');

$response = (new Cache())->handle($request, function () {
$response = (new Cache)->handle($request, function () {
return new Response('some content');
}, 'etag;max_age=100;s_maxage=200');

Expand All @@ -78,7 +78,7 @@ public function testIsNotModified()
*/
public function testInvalidOption()
{
(new Cache())->handle(new Request(), function () {
(new Cache)->handle(new Request, function () {
return new Response('some content');
}, 'invalid');
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/Database/EloquentPushTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function setUp()

public function testPushMethodSavesTheRelationshipsRecursively()
{
$user = new UserX();
$user = new UserX;
$user->name = 'Test';
$user->save();
$user->posts()->create(['title' => 'Test title']);
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/Events/EventFakeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function testNonFakedEventGetsProperlyDispatched()
Event::fake(NonImportantEvent::class);
Post::observe([PostObserver::class]);

$post = new Post();
$post = new Post;
$post->title = 'xyz';
$post->save();

Expand Down
Loading

0 comments on commit ba06144

Please sign in to comment.