Skip to content

Commit d0d3978

Browse files
committed
Merge pull request laravel#1562 from yadakhov/put-namespace-on-its-own-line
Put all namespace on it's on line as reflective of PSR coding style
2 parents f2f7048 + c183ef4 commit d0d3978

36 files changed

+327
-109
lines changed

artisan.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ The `handle` method will be called when your command is executed. You may place
4444

4545
Note that we are able to inject any dependencies we need into the command's constructor. The Laravel [service container](/docs/{{version}}/container) will automatically inject all dependencies type-hinted in the constructor. For greater code reusability, it is good practice to keep your console commands light and let them defer to application services to accomplish their tasks.
4646

47-
<?php namespace App\Console\Commands;
47+
<?php
48+
49+
namespace App\Console\Commands;
4850

4951
use App\User;
5052
use App\DripEmailer;

authentication.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ You may access the authenticated user via the `Auth` facade:
141141

142142
Alternatively, once a user is authenticated, you may access the authenticated user via an `Illuminate\Http\Request` instance:
143143

144-
<?php namespace App\Http\Controllers;
144+
<?php
145+
146+
namespace App\Http\Controllers;
145147

146148
use Illuminate\Http\Request;
147149
use Illuminate\Routing\Controller;
@@ -204,7 +206,9 @@ Of course, you are not required to use the authentication controllers included w
204206

205207
We will access Laravel's authentication services via the `Auth` [facade](/docs/{{version}}/facades), so we'll need to make sure to import the `Auth` facade at the top of the class. Next, let's check out the `attempt` method:
206208

207-
<?php namespace App\Http\Controllers;
209+
<?php
210+
211+
namespace App\Http\Controllers;
208212

209213
use Auth;
210214
use Illuminate\Routing\Controller;
@@ -470,7 +474,9 @@ You will also need to add credentials for the OAuth services your application ut
470474

471475
Next, you are ready to authenticate users! You will need two routes: one for redirecting the user to the OAuth provider, and another for receiving the callback from the provider after authentication. We will access Socialite using the `Socialite` [facade](/docs/{{version}}/facades):
472476

473-
<?php namespace App\Http\Controllers;
477+
<?php
478+
479+
namespace App\Http\Controllers;
474480

475481
use Illuminate\Routing\Controller;
476482

@@ -529,7 +535,9 @@ Once you have a user instance, you can grab a few more details about the user:
529535

530536
If you are not using a traditional relational database to store your users, you will need to extend Laravel with your own authentication driver. We will use the `extend` method on the `Auth` facade to define a custom driver. You should place this call to `extend` within a [service provider](/docs/{{version}}/providers):
531537

532-
<?php namespace App\Providers;
538+
<?php
539+
540+
namespace App\Providers;
533541

534542
use Auth;
535543
use App\Extensions\RiakUserProvider;

billing.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ Since Stripe webhooks need to bypass Laravel's [CSRF verification](/docs/{{versi
251251

252252
If you have additional Stripe webhook events you would like to handle, simply extend the Webhook controller. Your method names should correspond to Cashier's expected convention, specifically, methods should be prefixed with `handle` and the "camel case" name of the Stripe webhook you wish to handle. For example, if you wish to handle the `invoice.payment_succeeded` webhook, you should add a `handleInvoicePaymentSucceeded` method to the controller.
253253

254-
<?php namespace App\Http\Controller;
254+
<?php
255+
256+
namespace App\Http\Controller;
255257

256258
use Laravel\Cashier\WebhookController as BaseController;
257259

blade.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ Blade even allows you to define your own custom directives. You can use the `dir
206206

207207
The following example creates a `@datetime($var)` directive which formats a given `$var`:
208208

209-
<?php namespace App\Providers;
209+
<?php
210+
211+
namespace App\Providers;
210212

211213
use Blade;
212214
use Illuminate\Support\ServiceProvider;

cache.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ However, you may also use the `Cache` facade, which is what we will use througho
6969

7070
For example, let's import the `Cache` facade into a controller:
7171

72-
<?php namespace App\Http\Controllers;
72+
<?php
73+
74+
namespace App\Http\Controllers;
7375

7476
use Cache;
7577
use Illuminate\Routing\Controller;
@@ -190,7 +192,9 @@ To extend the Laravel cache with a custom driver, we will use the `extend` metho
190192

191193
For example, to register a new cache driver named "mongo":
192194

193-
<?php namespace App\Providers;
195+
<?php
196+
197+
namespace App\Providers;
194198

195199
use Cache;
196200
use App\Extensions\MongoStore;
@@ -227,7 +231,9 @@ The call to `Cache::extend` could be done in the `boot` method of the default `A
227231

228232
To create our custom cache driver, we first need to implement the `Illuminate\Contracts\Cache\Store` [contract](/docs/{{version}}/contracts) contract. So, our MongoDB cache implementation would look something like this:
229233

230-
<?php namespace App\Extensions;
234+
<?php
235+
236+
namespace App\Extensions;
231237

232238
class MongoStore implements \Illuminate\Contracts\Cache\Store
233239
{

container.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ The Laravel service container is a powerful tool for managing class dependencies
1515

1616
Let's look at a simple example:
1717

18-
<?php namespace App\Jobs;
18+
<?php
19+
20+
namespace App\Jobs;
1921

2022
use App\User;
2123
use Illuminate\Contracts\Mail\Mailer;
@@ -158,7 +160,9 @@ Lastly, but most importantly, you may simply "type-hint" the dependency in the c
158160

159161
The container will automatically inject dependencies for the classes it resolves. For example, you may type-hint a repository defined by your application in a controller's constructor. The repository will automatically be resolved and injected into the class:
160162

161-
<?php namespace App\Http\Controllers;
163+
<?php
164+
165+
namespace App\Http\Controllers;
162166

163167
use Illuminate\Routing\Controller;
164168
use App\Users\Repository as UserRepository;

contracts.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ You may have several questions regarding contracts. Why use interfaces at all? I
2727

2828
First, let's review some code that is tightly coupled to a cache implementation. Consider the following:
2929

30-
<?php namespace App\Orders;
30+
<?php
31+
32+
namespace App\Orders;
3133

3234
class Repository
3335
{
@@ -67,7 +69,9 @@ Likewise, if we want to replace our underlying cache technology (Memcached) with
6769

6870
**Instead of this approach, we can improve our code by depending on a simple, vendor agnostic interface:**
6971

70-
<?php namespace App\Orders;
72+
<?php
73+
74+
namespace App\Orders;
7175

7276
use Illuminate\Contracts\Cache\Repository as Cache;
7377

@@ -143,7 +147,9 @@ Many types of classes in Laravel are resolved through the [service container](/d
143147

144148
For example, take a look at this event listener:
145149

146-
<?php namespace App\Listeners;
150+
<?php
151+
152+
namespace App\Listeners;
147153

148154
use App\User;
149155
use App\Events\NewUserRegistered;

controllers.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ Instead of defining all of your request handling logic in a single `routes.php`
2222

2323
Here is an example of a basic controller class. All Laravel controllers should extend the base controller class included with the default Laravel installation:
2424

25-
<?php namespace App\Http\Controllers;
25+
<?php
26+
27+
namespace App\Http\Controllers;
2628

2729
use App\Http\Controllers\Controller;
2830

@@ -152,7 +154,9 @@ Sometimes you may need to define routes to a "nested" resource. For example, a p
152154

153155
This route will register a "nested" resource that may be accessed with URLs like the following: `photos/{photos}/comments/{comments}`.
154156

155-
<?php namespace App\Http\Controllers;
157+
<?php
158+
159+
namespace App\Http\Controllers;
156160

157161
use App\Http\Controllers\Controller;
158162

@@ -190,7 +194,9 @@ Laravel allows you to easily define a single route to handle every action in a c
190194

191195
Next, just add methods to your controller. The method names should begin with the HTTP verb they respond to followed by the title case version of the URI:
192196

193-
<?php namespace App\Http\Controllers;
197+
<?php
198+
199+
namespace App\Http\Controllers;
194200

195201
class UserController extends Controller
196202
{
@@ -244,7 +250,9 @@ If you would like to [name](/docs/{{version}}/routing#named-routes) some of the
244250

245251
The Laravel [service container](/docs/{{version}}/container) is used to resolve all Laravel controllers. As a result, you are able to type-hint any dependencies your controller may need in its constructor. The dependencies will automatically be resolved and injected into the controller instance:
246252

247-
<?php namespace App\Http\Controllers;
253+
<?php
254+
255+
namespace App\Http\Controllers;
248256

249257
use Illuminate\Routing\Controller;
250258
use App\Repositories\UserRepository;
@@ -274,7 +282,9 @@ Of course, you may also type-hint any [Laravel contract](/docs/{{version}}/contr
274282

275283
In addition to constructor injection, you may also type-hint dependencies on your controller's action methods. For example, let's type-hint the `Illuminate\Http\Request` instance on one of our methods:
276284

277-
<?php namespace App\Http\Controllers;
285+
<?php
286+
287+
namespace App\Http\Controllers;
278288

279289
use Illuminate\Http\Request;
280290
use Illuminate\Routing\Controller;
@@ -297,7 +307,9 @@ In addition to constructor injection, you may also type-hint dependencies on you
297307

298308
If your controller method is also expecting input from a route parameter, simply list your route arguments after your other dependencies:
299309

300-
<?php namespace App\Http\Controllers;
310+
<?php
311+
312+
namespace App\Http\Controllers;
301313

302314
use Illuminate\Http\Request;
303315
use Illuminate\Routing\Controller;

database.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ Once you have configured your database connection, you may run queries using the
5959

6060
To run a basic query, we can use the `select` method on the `DB` facade:
6161

62-
<?php namespace App\Http\Controllers;
62+
<?php
63+
64+
namespace App\Http\Controllers;
6365

6466
use DB;
6567
use App\Http\Controllers\Controller;
@@ -122,7 +124,9 @@ Some database statements should not return any value. For these types of operati
122124

123125
If you would like to receive each SQL query executed by your application, you may use the `listen` method. This method is useful for logging queries or debugging. You may register your query listener in a [service provider](/docs/{{version}}/providers):
124126

125-
<?php namespace App\Providers;
127+
<?php
128+
129+
namespace App\Providers;
126130

127131
use DB;
128132
use Illuminate\Support\ServiceProvider;

eloquent-collections.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ All Eloquent collections extend the base [Laravel collection](/docs/{{version}}/
106106

107107
If you need to use a custom `Collection` object with your own extension methods, you may override the `newCollection` method on your model:
108108

109-
<?php namespace App;
109+
<?php
110+
111+
namespace App;
110112

111113
use App\CustomCollection;
112114
use Illuminate\Database\Eloquent\Model;

0 commit comments

Comments
 (0)