From 25b9bc7d2039b1889930d21575afd5d09d8e0f24 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Tue, 24 May 2022 16:00:36 +1000 Subject: [PATCH] replace first class callables with comments --- broadcasting.md | 12 ++++++------ cache.md | 2 +- database.md | 2 +- errors.md | 2 +- http-client.md | 26 +++++++++++++------------- logging.md | 2 +- mail.md | 2 +- queries.md | 4 ++-- queues.md | 12 ++++++------ upgrade.md | 2 +- validation.md | 2 +- 11 files changed, 34 insertions(+), 34 deletions(-) diff --git a/broadcasting.md b/broadcasting.md index 57a61d1c616..c4023c28b05 100644 --- a/broadcasting.md +++ b/broadcasting.md @@ -748,9 +748,9 @@ If you would like to listen for events on a private channel, use the `private` m ```js Echo.private(`orders.${this.order.id}`) - .listen(...) - .listen(...) - .listen(...); + .listen(/* ... */) + .listen(/* ... */) + .listen(/* ... */); ``` @@ -865,9 +865,9 @@ As typical of other types of events, you may listen for events sent to presence ```js Echo.join(`chat.${roomId}`) - .here(...) - .joining(...) - .leaving(...) + .here(/* ... */) + .joining(/* ... */) + .leaving(/* ... */) .listen('NewMessage', (e) => { // }); diff --git a/cache.md b/cache.md index 6848361b9f6..0c58d55bac0 100644 --- a/cache.md +++ b/cache.md @@ -141,7 +141,7 @@ The `Cache` facade's `get` method is used to retrieve items from the cache. If t You may even pass a closure as the default value. The result of the closure will be returned if the specified item does not exist in the cache. Passing a closure allows you to defer the retrieval of default values from a database or other external service: $value = Cache::get('key', function () { - return DB::table(...)->get(); + return DB::table(/* ... */)->get(); }); diff --git a/database.md b/database.md index f55dfbce2d7..9f43cf69922 100644 --- a/database.md +++ b/database.md @@ -231,7 +231,7 @@ If your application defines multiple connections in your `config/database.php` c use Illuminate\Support\Facades\DB; - $users = DB::connection('sqlite')->select(...); + $users = DB::connection('sqlite')->select(/* ... */); You may access the raw, underlying PDO instance of a connection using the `getPdo` method on a connection instance: diff --git a/errors.md b/errors.md index 513c6965dfb..e9a5ea44d57 100644 --- a/errors.md +++ b/errors.md @@ -229,7 +229,7 @@ Instead of type-checking exceptions in the exception handler's `register` method */ public function render($request) { - return response(...); + return response(/* ... */); } } diff --git a/http-client.md b/http-client.md index 41bfd85bd8b..3d48063f415 100644 --- a/http-client.md +++ b/http-client.md @@ -148,43 +148,43 @@ For convenience, you may use the `acceptJson` method to quickly specify that you You may specify basic and digest authentication credentials using the `withBasicAuth` and `withDigestAuth` methods, respectively: // Basic authentication... - $response = Http::withBasicAuth('taylor@laravel.com', 'secret')->post(...); + $response = Http::withBasicAuth('taylor@laravel.com', 'secret')->post(/* ... */); // Digest authentication... - $response = Http::withDigestAuth('taylor@laravel.com', 'secret')->post(...); + $response = Http::withDigestAuth('taylor@laravel.com', 'secret')->post(/* ... */); #### Bearer Tokens If you would like to quickly add a bearer token to the request's `Authorization` header, you may use the `withToken` method: - $response = Http::withToken('token')->post(...); + $response = Http::withToken('token')->post(/* ... */); ### Timeout The `timeout` method may be used to specify the maximum number of seconds to wait for a response: - $response = Http::timeout(3)->get(...); + $response = Http::timeout(3)->get(/* ... */); If the given timeout is exceeded, an instance of `Illuminate\Http\Client\ConnectionException` will be thrown. You may specify the maximum number of seconds to wait while trying to connect to a server using the `connectTimeout` method: - $response = Http::connectTimeout(3)->get(...); + $response = Http::connectTimeout(3)->get(/* ... */); ### Retries If you would like HTTP client to automatically retry the request if a client or server error occurs, you may use the `retry` method. The `retry` method accepts the maximum number of times the request should be attempted and the number of milliseconds that Laravel should wait in between attempts: - $response = Http::retry(3, 100)->post(...); + $response = Http::retry(3, 100)->post(/* ... */); If needed, you may pass a third argument to the `retry` method. The third argument should be a callable that determines if the retries should actually be attempted. For example, you may wish to only retry the request if the initial request encounters an `ConnectionException`: $response = Http::retry(3, 100, function ($exception, $request) { return $exception instanceof ConnectionException; - })->post(...); + })->post(/* ... */); If a request attempt fails, you may wish to make a change to the request before a new attempt is made. You can achieve this by modifying request argument provided to the callable you provided to the `retry` method. For example, you might want to retry the request with a new authorization token if the first attempt returned an authentication error: @@ -196,11 +196,11 @@ If a request attempt fails, you may wish to make a change to the request before $request->withToken($this->getNewToken()); return true; - })->post(...); + })->post(/* ... */); If all of the requests fail, an instance of `Illuminate\Http\Client\RequestException` will be thrown. If you would like to disable this behavior, you may provide a `throw` argument with a value of `false`. When disabled, the last response received by the client will be returned after all retries have been attempted: - $response = Http::retry(3, 100, throw: false)->post(...); + $response = Http::retry(3, 100, throw: false)->post(/* ... */); > {note} If all of the requests fail because of a connection issue, a `Illuminate\Http\Client\ConnectionException` will still be thrown even when the `throw` argument is set to `false`. @@ -229,7 +229,7 @@ Unlike Guzzle's default behavior, Laravel's HTTP client wrapper does not throw e If you have a response instance and would like to throw an instance of `Illuminate\Http\Client\RequestException` if the response status code indicates a client or server error, you may use the `throw` or `throwIf` methods: - $response = Http::post(...); + $response = Http::post(/* ... */); // Throw an exception if a client or server error occurred... $response->throw(); @@ -243,11 +243,11 @@ The `Illuminate\Http\Client\RequestException` instance has a public `$response` The `throw` method returns the response instance if no error occurred, allowing you to chain other operations onto the `throw` method: - return Http::post(...)->throw()->json(); + return Http::post(/* ... */)->throw()->json(); If you would like to perform some additional logic before the exception is thrown, you may pass a closure to the `throw` method. The exception will be thrown automatically after the closure is invoked, so you do not need to re-throw the exception from within the closure: - return Http::post(...)->throw(function ($response, $e) { + return Http::post(/* ... */)->throw(function ($response, $e) { // })->json(); @@ -336,7 +336,7 @@ For example, to instruct the HTTP client to return empty, `200` status code resp Http::fake(); - $response = Http::post(...); + $response = Http::post(/* ... */); #### Faking Specific URLs diff --git a/logging.md b/logging.md index 7b9783b5ccd..e7b905a9d34 100644 --- a/logging.md +++ b/logging.md @@ -406,6 +406,6 @@ Once you have configured the `custom` driver channel, you're ready to define the */ public function __invoke(array $config) { - return new Logger(...); + return new Logger(/* ... */); } } diff --git a/mail.md b/mail.md index 6bfa50c767d..8628200c6be 100644 --- a/mail.md +++ b/mail.md @@ -987,7 +987,7 @@ Once you've defined your custom transport, you may register it via the `extend` public function boot() { Mail::extend('mailchimp', function (array $config = []) { - return new MailchimpTransport(...); + return new MailchimpTransport(/* ... */); }) } diff --git a/queries.md b/queries.md index 7f3970e13db..64ded76de61 100644 --- a/queries.md +++ b/queries.md @@ -258,7 +258,7 @@ Instead of using the `DB::raw` method, you may also use the following methods to #### `selectRaw` -The `selectRaw` method can be used in place of `addSelect(DB::raw(...))`. This method accepts an optional array of bindings as its second argument: +The `selectRaw` method can be used in place of `addSelect(DB::raw(/* ... */))`. This method accepts an optional array of bindings as its second argument: $orders = DB::table('orders') ->selectRaw('price * ? as price_with_tax', [1.0825]) @@ -348,7 +348,7 @@ You may also specify more advanced join clauses. To get started, pass a closure DB::table('users') ->join('contacts', function ($join) { - $join->on('users.id', '=', 'contacts.user_id')->orOn(...); + $join->on('users.id', '=', 'contacts.user_id')->orOn(/* ... */); }) ->get(); diff --git a/queues.md b/queues.md index 5dc0e8f3eb5..fdcec3966e7 100644 --- a/queues.md +++ b/queues.md @@ -622,7 +622,7 @@ Once you have written your job class, you may dispatch it using the `dispatch` m */ public function store(Request $request) { - $podcast = Podcast::create(...); + $podcast = Podcast::create(/* ... */); // ... @@ -660,7 +660,7 @@ If you would like to specify that a job should not be immediately available for */ public function store(Request $request) { - $podcast = Podcast::create(...); + $podcast = Podcast::create(/* ... */); // ... @@ -713,7 +713,7 @@ If you would like to dispatch a job immediately (synchronously), you may use the */ public function store(Request $request) { - $podcast = Podcast::create(...); + $podcast = Podcast::create(/* ... */); // Create podcast... @@ -775,7 +775,7 @@ In addition to chaining job class instances, you may also chain closures: new ProcessPodcast, new OptimizePodcast, function () { - Podcast::update(...); + Podcast::update(/* ... */); }, ])->dispatch(); @@ -835,7 +835,7 @@ By pushing jobs to different queues, you may "categorize" your queued jobs and e */ public function store(Request $request) { - $podcast = Podcast::create(...); + $podcast = Podcast::create(/* ... */); // Create podcast... @@ -894,7 +894,7 @@ If your application interacts with multiple queue connections, you may specify w */ public function store(Request $request) { - $podcast = Podcast::create(...); + $podcast = Podcast::create(/* ... */); // Create podcast... diff --git a/upgrade.md b/upgrade.md index b94b96741ce..d8948234762 100644 --- a/upgrade.md +++ b/upgrade.md @@ -449,7 +449,7 @@ The [HTTP client](/docs/{{version}}/http-client) now has a default timeout of 30 If you wish to specify a longer timeout for a given request, you may do so using the `timeout` method: - $response = Http::timeout(120)->get(...); + $response = Http::timeout(120)->get(/* ... */); #### HTTP Fake & Middleware diff --git a/validation.md b/validation.md index 1252bb8272b..7f5baa4bc07 100644 --- a/validation.md +++ b/validation.md @@ -590,7 +590,7 @@ Many of Laravel's built-in error messages include an `:attribute` placeholder th You may also attach callbacks to be run after validation is completed. This allows you to easily perform further validation and even add more error messages to the message collection. To get started, call the `after` method on a validator instance: - $validator = Validator::make(...); + $validator = Validator::make(/* ... */); $validator->after(function ($validator) { if ($this->somethingElseIsInvalid()) {