Skip to content

Commit 17a8364

Browse files
Fix capitalization of proper names and nouns (#10451)
1 parent d62aa21 commit 17a8364

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

‎collections.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
The `Illuminate\Support\Collection` class provides a fluent, convenient wrapper for working with arrays of data. For example, check out the following code. We'll use the `collect` helper to create a new collection instance from the array, run the `strtoupper` function on each element, and then remove all empty elements:
1818

1919
```php
20-
$collection = collect(['taylor', 'abigail', null])->map(function (?string $name) {
20+
$collection = collect(['Taylor', 'Abigail', null])->map(function (?string $name) {
2121
return strtoupper($name);
2222
})->reject(function (string $name) {
2323
return empty($name);
@@ -1152,17 +1152,17 @@ The `flatten` method flattens a multi-dimensional collection into a single dimen
11521152

11531153
```php
11541154
$collection = collect([
1155-
'name' => 'taylor',
1155+
'name' => 'Taylor',
11561156
'languages' => [
1157-
'php', 'javascript'
1157+
'PHP', 'JavaScript'
11581158
]
11591159
]);
11601160

11611161
$flattened = $collection->flatten();
11621162

11631163
$flattened->all();
11641164

1165-
// ['taylor', 'php', 'javascript'];
1165+
// ['Taylor', 'PHP', 'JavaScript'];
11661166
```
11671167

11681168
If necessary, you may pass the `flatten` method a "depth" argument:
@@ -1203,13 +1203,13 @@ In this example, calling `flatten` without providing the depth would have also f
12031203
The `flip` method swaps the collection's keys with their corresponding values:
12041204

12051205
```php
1206-
$collection = collect(['name' => 'taylor', 'framework' => 'laravel']);
1206+
$collection = collect(['name' => 'Taylor', 'framework' => 'Laravel']);
12071207

12081208
$flipped = $collection->flip();
12091209

12101210
$flipped->all();
12111211

1212-
// ['taylor' => 'name', 'laravel' => 'framework']
1212+
// ['Taylor' => 'name', 'Laravel' => 'framework']
12131213
```
12141214

12151215
<a name="method-forget"></a>
@@ -1218,12 +1218,12 @@ $flipped->all();
12181218
The `forget` method removes an item from the collection by its key:
12191219

12201220
```php
1221-
$collection = collect(['name' => 'taylor', 'framework' => 'laravel']);
1221+
$collection = collect(['name' => 'Taylor', 'framework' => 'Laravel']);
12221222

12231223
// Forget a single key...
12241224
$collection->forget('name');
12251225

1226-
// ['framework' => 'laravel']
1226+
// ['framework' => 'Laravel']
12271227

12281228
// Forget multiple keys...
12291229
$collection->forget(['name', 'framework']);
@@ -1272,17 +1272,17 @@ $collection = Collection::fromJson($json);
12721272
The `get` method returns the item at a given key. If the key does not exist, `null` is returned:
12731273

12741274
```php
1275-
$collection = collect(['name' => 'taylor', 'framework' => 'laravel']);
1275+
$collection = collect(['name' => 'Taylor', 'framework' => 'Laravel']);
12761276

12771277
$value = $collection->get('name');
12781278

1279-
// taylor
1279+
// Taylor
12801280
```
12811281

12821282
You may optionally pass a default value as the second argument:
12831283

12841284
```php
1285-
$collection = collect(['name' => 'taylor', 'framework' => 'laravel']);
1285+
$collection = collect(['name' => 'Taylor', 'framework' => 'Laravel']);
12861286

12871287
$value = $collection->get('age', 34);
12881288

@@ -3651,20 +3651,20 @@ For the inverse of `whenEmpty`, see the [whenNotEmpty](#method-whennotempty) met
36513651
The `whenNotEmpty` method will execute the given callback when the collection is not empty:
36523652

36533653
```php
3654-
$collection = collect(['michael', 'tom']);
3654+
$collection = collect(['Michael', 'Tom']);
36553655

36563656
$collection->whenNotEmpty(function (Collection $collection) {
3657-
return $collection->push('adam');
3657+
return $collection->push('Adam');
36583658
});
36593659

36603660
$collection->all();
36613661

3662-
// ['michael', 'tom', 'adam']
3662+
// ['Michael', 'Tom', 'Adam']
36633663

36643664
$collection = collect();
36653665

36663666
$collection->whenNotEmpty(function (Collection $collection) {
3667-
return $collection->push('adam');
3667+
return $collection->push('Adam');
36683668
});
36693669

36703670
$collection->all();
@@ -3678,14 +3678,14 @@ A second closure may be passed to the `whenNotEmpty` method that will be execute
36783678
$collection = collect();
36793679

36803680
$collection->whenNotEmpty(function (Collection $collection) {
3681-
return $collection->push('adam');
3681+
return $collection->push('Adam');
36823682
}, function (Collection $collection) {
3683-
return $collection->push('taylor');
3683+
return $collection->push('Taylor');
36843684
});
36853685

36863686
$collection->all();
36873687

3688-
// ['taylor']
3688+
// ['Taylor']
36893689
```
36903690

36913691
For the inverse of `whenNotEmpty`, see the [whenEmpty](#method-whenempty) method.

‎helpers.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -566,11 +566,11 @@ The `Arr::hasAll` method determines if all of the specified keys exist in the gi
566566
```php
567567
use Illuminate\Support\Arr;
568568

569-
$array = ['name' => 'Taylor', 'language' => 'php'];
569+
$array = ['name' => 'Taylor', 'language' => 'PHP'];
570570

571571
Arr::hasAll($array, ['name']); // true
572572
Arr::hasAll($array, ['name', 'language']); // true
573-
Arr::hasAll($array, ['name', 'ide']); // false
573+
Arr::hasAll($array, ['name', 'IDE']); // false
574574
```
575575

576576
<a name="method-array-hasany"></a>
@@ -2298,7 +2298,7 @@ $traits = class_uses_recursive(App\Models\User::class);
22982298
The `collect` function creates a [collection](/docs/{{version}}/collections) instance from the given value:
22992299

23002300
```php
2301-
$collection = collect(['taylor', 'abigail']);
2301+
$collection = collect(['Taylor', 'Abigail']);
23022302
```
23032303

23042304
<a name="method-config"></a>
@@ -2844,7 +2844,7 @@ The `tap` function accepts two arguments: an arbitrary `$value` and a closure. T
28442844

28452845
```php
28462846
$user = tap(User::first(), function (User $user) {
2847-
$user->name = 'taylor';
2847+
$user->name = 'Taylor';
28482848

28492849
$user->save();
28502850
});

0 commit comments

Comments
 (0)