Skip to content

Commit d26770d

Browse files
Add Missing Type Hints (#10402)
1 parent 14e9dae commit d26770d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

collections.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,7 +1492,7 @@ The `intersectUsing` method removes any values from the original collection that
14921492
```php
14931493
$collection = collect(['Desk', 'Sofa', 'Chair']);
14941494

1495-
$intersect = $collection->intersectUsing(['desk', 'chair', 'bookcase'], function ($a, $b) {
1495+
$intersect = $collection->intersectUsing(['desk', 'chair', 'bookcase'], function (string $a, string $b) {
14961496
return strcasecmp($a, $b);
14971497
});
14981498

@@ -1540,7 +1540,7 @@ $intersect = $collection->intersectAssocUsing([
15401540
'color' => 'blue',
15411541
'size' => 'M',
15421542
'material' => 'polyester',
1543-
], function ($a, $b) {
1543+
], function (string $a, string $b) {
15441544
return strcasecmp($a, $b);
15451545
});
15461546

@@ -2110,15 +2110,15 @@ The `percentage` method may be used to quickly determine the percentage of items
21102110
```php
21112111
$collection = collect([1, 1, 2, 2, 2, 3]);
21122112

2113-
$percentage = $collection->percentage(fn ($value) => $value === 1);
2113+
$percentage = $collection->percentage(fn (int $value) => $value === 1);
21142114

21152115
// 33.33
21162116
```
21172117

21182118
By default, the percentage will be rounded to two decimal places. However, you may customize this behavior by providing a second argument to the method:
21192119

21202120
```php
2121-
$percentage = $collection->percentage(fn ($value) => $value === 1, precision: 3);
2121+
$percentage = $collection->percentage(fn (int $value) => $value === 1, precision: 3);
21222122

21232123
// 33.333
21242124
```

0 commit comments

Comments
 (0)