@@ -363,7 +363,7 @@ public function kebab()
363
363
/**
364
364
* Return the length of the given string.
365
365
*
366
- * @param string $encoding
366
+ * @param string|null $encoding
367
367
* @return int
368
368
*/
369
369
public function length ($ encoding = null )
@@ -502,7 +502,7 @@ public function padRight($length, $pad = ' ')
502
502
* Parse a Class@method style callback into class and method.
503
503
*
504
504
* @param string|null $default
505
- * @return array
505
+ * @return array<int, string|null>
506
506
*/
507
507
public function parseCallback ($ default = null )
508
508
{
@@ -523,7 +523,7 @@ public function pipe(callable $callback)
523
523
/**
524
524
* Get the plural form of an English word.
525
525
*
526
- * @param int $count
526
+ * @param int|array|\Countable $count
527
527
* @return static
528
528
*/
529
529
public function plural ($ count = 2 )
@@ -534,7 +534,7 @@ public function plural($count = 2)
534
534
/**
535
535
* Pluralize the last word of an English, studly caps case string.
536
536
*
537
- * @param int $count
537
+ * @param int|array|\Countable $count
538
538
* @return static
539
539
*/
540
540
public function pluralStudly ($ count = 2 )
@@ -556,7 +556,7 @@ public function prepend(...$values)
556
556
/**
557
557
* Remove any occurrence of the given string in the subject.
558
558
*
559
- * @param string|array <string> $search
559
+ * @param string|iterable <string> $search
560
560
* @param bool $caseSensitive
561
561
* @return static
562
562
*/
@@ -739,11 +739,12 @@ public function singular()
739
739
*
740
740
* @param string $separator
741
741
* @param string|null $language
742
+ * @param array<string, string> $dictionary
742
743
* @return static
743
744
*/
744
- public function slug ($ separator = '- ' , $ language = 'en ' )
745
+ public function slug ($ separator = '- ' , $ language = 'en ' , $ dictionary = [ ' @ ' => ' at ' ] )
745
746
{
746
- return new static (Str::slug ($ this ->value , $ separator , $ language ));
747
+ return new static (Str::slug ($ this ->value , $ separator , $ language, $ dictionary ));
747
748
}
748
749
749
750
/**
@@ -794,13 +795,13 @@ public function substr($start, $length = null)
794
795
* Returns the number of substring occurrences.
795
796
*
796
797
* @param string $needle
797
- * @param int|null $offset
798
+ * @param int $offset
798
799
* @param int|null $length
799
800
* @return int
800
801
*/
801
- public function substrCount ($ needle , $ offset = null , $ length = null )
802
+ public function substrCount ($ needle , $ offset = 0 , $ length = null )
802
803
{
803
- return Str::substrCount ($ this ->value , $ needle , $ offset ?? 0 , $ length );
804
+ return Str::substrCount ($ this ->value , $ needle , $ offset , $ length );
804
805
}
805
806
806
807
/**
@@ -1057,11 +1058,12 @@ public function words($words = 100, $end = '...')
1057
1058
/**
1058
1059
* Get the number of words a string contains.
1059
1060
*
1061
+ * @param string|null $characters
1060
1062
* @return int
1061
1063
*/
1062
- public function wordCount ()
1064
+ public function wordCount ($ characters = null )
1063
1065
{
1064
- return str_word_count ($ this ->value );
1066
+ return Str:: wordCount ($ this ->value , $ characters );
1065
1067
}
1066
1068
1067
1069
/**
0 commit comments