[String] Renamed a method argument
This commit is contained in:
parent
7df0b6caf6
commit
1648c0e12d
@ -404,11 +404,11 @@ abstract class AbstractString implements \JsonSerializable
|
||||
/**
|
||||
* Matches the string using a regular expression.
|
||||
*
|
||||
* Pass PREG_PATTERN_ORDER or PREG_SET_ORDER as $flags to get all occurrences matching the pattern.
|
||||
* Pass PREG_PATTERN_ORDER or PREG_SET_ORDER as $flags to get all occurrences matching the regular expression.
|
||||
*
|
||||
* @return array All matches in a multi-dimensional array ordered according to flags
|
||||
*/
|
||||
abstract public function match(string $pattern, int $flags = 0, int $offset = 0): array;
|
||||
abstract public function match(string $regexp, int $flags = 0, int $offset = 0): array;
|
||||
|
||||
/**
|
||||
* @return static
|
||||
@ -455,7 +455,7 @@ abstract class AbstractString implements \JsonSerializable
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
abstract public function replaceMatches(string $fromPattern, $to): self;
|
||||
abstract public function replaceMatches(string $fromRegexp, $to): self;
|
||||
|
||||
/**
|
||||
* @return static
|
||||
|
@ -200,18 +200,18 @@ abstract class AbstractUnicodeString extends AbstractString
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function match(string $pattern, int $flags = 0, int $offset = 0): array
|
||||
public function match(string $regexp, int $flags = 0, int $offset = 0): array
|
||||
{
|
||||
$match = ((\PREG_PATTERN_ORDER | \PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match';
|
||||
|
||||
if ($this->ignoreCase) {
|
||||
$pattern .= 'i';
|
||||
$regexp .= 'i';
|
||||
}
|
||||
|
||||
set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
|
||||
|
||||
try {
|
||||
if (false === $match($pattern.'u', $this->string, $matches, $flags | PREG_UNMATCHED_AS_NULL, $offset)) {
|
||||
if (false === $match($regexp.'u', $this->string, $matches, $flags | PREG_UNMATCHED_AS_NULL, $offset)) {
|
||||
$lastError = preg_last_error();
|
||||
|
||||
foreach (get_defined_constants(true)['pcre'] as $k => $v) {
|
||||
@ -280,10 +280,10 @@ abstract class AbstractUnicodeString extends AbstractString
|
||||
return $this->pad($length, $pad, STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
public function replaceMatches(string $fromPattern, $to): parent
|
||||
public function replaceMatches(string $fromRegexp, $to): parent
|
||||
{
|
||||
if ($this->ignoreCase) {
|
||||
$fromPattern .= 'i';
|
||||
$fromRegexp .= 'i';
|
||||
}
|
||||
|
||||
if (\is_array($to) || $to instanceof \Closure) {
|
||||
@ -310,7 +310,7 @@ abstract class AbstractUnicodeString extends AbstractString
|
||||
set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
|
||||
|
||||
try {
|
||||
if (null === $string = $replace($fromPattern.'u', $to, $this->string)) {
|
||||
if (null === $string = $replace($fromRegexp.'u', $to, $this->string)) {
|
||||
$lastError = preg_last_error();
|
||||
|
||||
foreach (get_defined_constants(true)['pcre'] as $k => $v) {
|
||||
|
@ -189,18 +189,18 @@ class ByteString extends AbstractString
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function match(string $pattern, int $flags = 0, int $offset = 0): array
|
||||
public function match(string $regexp, int $flags = 0, int $offset = 0): array
|
||||
{
|
||||
$match = ((\PREG_PATTERN_ORDER | \PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match';
|
||||
|
||||
if ($this->ignoreCase) {
|
||||
$pattern .= 'i';
|
||||
$regexp .= 'i';
|
||||
}
|
||||
|
||||
set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
|
||||
|
||||
try {
|
||||
if (false === $match($pattern, $this->string, $matches, $flags | PREG_UNMATCHED_AS_NULL, $offset)) {
|
||||
if (false === $match($regexp, $this->string, $matches, $flags | PREG_UNMATCHED_AS_NULL, $offset)) {
|
||||
$lastError = preg_last_error();
|
||||
|
||||
foreach (get_defined_constants(true)['pcre'] as $k => $v) {
|
||||
@ -261,10 +261,10 @@ class ByteString extends AbstractString
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function replaceMatches(string $fromPattern, $to): parent
|
||||
public function replaceMatches(string $fromRegexp, $to): parent
|
||||
{
|
||||
if ($this->ignoreCase) {
|
||||
$fromPattern .= 'i';
|
||||
$fromRegexp .= 'i';
|
||||
}
|
||||
|
||||
if (\is_array($to)) {
|
||||
@ -280,7 +280,7 @@ class ByteString extends AbstractString
|
||||
set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
|
||||
|
||||
try {
|
||||
if (null === $string = $replace($fromPattern, $to, $this->string)) {
|
||||
if (null === $string = $replace($fromRegexp, $to, $this->string)) {
|
||||
$lastError = preg_last_error();
|
||||
|
||||
foreach (get_defined_constants(true)['pcre'] as $k => $v) {
|
||||
|
@ -250,9 +250,9 @@ class UnicodeString extends AbstractUnicodeString
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function replaceMatches(string $fromPattern, $to): AbstractString
|
||||
public function replaceMatches(string $fromRegexp, $to): AbstractString
|
||||
{
|
||||
$str = parent::replaceMatches($fromPattern, $to);
|
||||
$str = parent::replaceMatches($fromRegexp, $to);
|
||||
normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
|
||||
|
||||
return $str;
|
||||
|
Reference in New Issue
Block a user