Allow PHP-8.2 and up Compatibility instead of just PHP-8.4

This commit is contained in:
johnnyq
2026-06-12 17:06:10 -04:00
parent 2204bd52f4
commit d3a93652f3
220 changed files with 7198 additions and 2635 deletions

View File

@@ -222,6 +222,18 @@ class Stringable implements JsonSerializable, ArrayAccess, BaseStringable
return Str::containsAll($this->value, $needles, $ignoreCase);
}
/**
* Determine if a given string doesn't contain a given substring.
*
* @param string|iterable<string> $needles
* @param bool $ignoreCase
* @return bool
*/
public function doesntContain($needles, $ignoreCase = false)
{
return Str::doesntContain($this->value, $needles, $ignoreCase);
}
/**
* Convert the case of a string.
*
@@ -237,12 +249,12 @@ class Stringable implements JsonSerializable, ArrayAccess, BaseStringable
/**
* Replace consecutive instances of a given character with a single character.
*
* @param string $character
* @param array<string>|string $characters
* @return static
*/
public function deduplicate(string $character = ' ')
public function deduplicate(array|string $characters = ' ')
{
return new static(Str::deduplicate($this->value, $character));
return new static(Str::deduplicate($this->value, $characters));
}
/**
@@ -879,6 +891,16 @@ class Stringable implements JsonSerializable, ArrayAccess, BaseStringable
return new static(Str::headline($this->value));
}
/**
* Convert the given string to only its initials.
*
* @return static
*/
public function initials()
{
return new static(Str::initials($this->value));
}
/**
* Convert the given string to APA-style title case.
*
@@ -1045,7 +1067,7 @@ class Stringable implements JsonSerializable, ArrayAccess, BaseStringable
/**
* Trim the string of the given characters.
*
* @param string $characters
* @param string|null $characters
* @return static
*/
public function trim($characters = null)
@@ -1056,7 +1078,7 @@ class Stringable implements JsonSerializable, ArrayAccess, BaseStringable
/**
* Left trim the string of the given characters.
*
* @param string $characters
* @param string|null $characters
* @return static
*/
public function ltrim($characters = null)
@@ -1067,7 +1089,7 @@ class Stringable implements JsonSerializable, ArrayAccess, BaseStringable
/**
* Right trim the string of the given characters.
*
* @param string $characters
* @param string|null $characters
* @return static
*/
public function rtrim($characters = null)
@@ -1095,6 +1117,17 @@ class Stringable implements JsonSerializable, ArrayAccess, BaseStringable
return new static(Str::ucfirst($this->value));
}
/**
* Capitalize the first character of each word in a string.
*
* @param string $separators
* @return static
*/
public function ucwords($separators = " \t\r\n\f\v")
{
return new static(Str::ucwords($this->value, $separators));
}
/**
* Split a string by uppercase characters.
*
@@ -1470,7 +1503,7 @@ class Stringable implements JsonSerializable, ArrayAccess, BaseStringable
*/
public function toFloat()
{
return floatval($this->value);
return (float) $this->value;
}
/**