Skip to content

Commit d8597f4

Browse files
javiereguiluznicolas-grekas
authored andcommitted
[String] Renamed a method argument
1 parent 11c1fc0 commit d8597f4

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

AbstractString.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,11 +404,11 @@ abstract public function lower(): self;
404404
/**
405405
* Matches the string using a regular expression.
406406
*
407-
* Pass PREG_PATTERN_ORDER or PREG_SET_ORDER as $flags to get all occurrences matching the pattern.
407+
* Pass PREG_PATTERN_ORDER or PREG_SET_ORDER as $flags to get all occurrences matching the regular expression.
408408
*
409409
* @return array All matches in a multi-dimensional array ordered according to flags
410410
*/
411-
abstract public function match(string $pattern, int $flags = 0, int $offset = 0): array;
411+
abstract public function match(string $regexp, int $flags = 0, int $offset = 0): array;
412412

413413
/**
414414
* @return static
@@ -455,7 +455,7 @@ abstract public function replace(string $from, string $to): self;
455455
*
456456
* @return static
457457
*/
458-
abstract public function replaceMatches(string $fromPattern, $to): self;
458+
abstract public function replaceMatches(string $fromRegexp, $to): self;
459459

460460
/**
461461
* @return static

AbstractUnicodeString.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,18 +200,18 @@ public function lower(): parent
200200
return $str;
201201
}
202202

203-
public function match(string $pattern, int $flags = 0, int $offset = 0): array
203+
public function match(string $regexp, int $flags = 0, int $offset = 0): array
204204
{
205205
$match = ((\PREG_PATTERN_ORDER | \PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match';
206206

207207
if ($this->ignoreCase) {
208-
$pattern .= 'i';
208+
$regexp .= 'i';
209209
}
210210

211211
set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
212212

213213
try {
214-
if (false === $match($pattern.'u', $this->string, $matches, $flags | PREG_UNMATCHED_AS_NULL, $offset)) {
214+
if (false === $match($regexp.'u', $this->string, $matches, $flags | PREG_UNMATCHED_AS_NULL, $offset)) {
215215
$lastError = preg_last_error();
216216

217217
foreach (get_defined_constants(true)['pcre'] as $k => $v) {
@@ -280,10 +280,10 @@ public function padStart(int $length, string $padStr = ' '): parent
280280
return $this->pad($length, $pad, STR_PAD_LEFT);
281281
}
282282

283-
public function replaceMatches(string $fromPattern, $to): parent
283+
public function replaceMatches(string $fromRegexp, $to): parent
284284
{
285285
if ($this->ignoreCase) {
286-
$fromPattern .= 'i';
286+
$fromRegexp .= 'i';
287287
}
288288

289289
if (\is_array($to) || $to instanceof \Closure) {
@@ -310,7 +310,7 @@ public function replaceMatches(string $fromPattern, $to): parent
310310
set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
311311

312312
try {
313-
if (null === $string = $replace($fromPattern.'u', $to, $this->string)) {
313+
if (null === $string = $replace($fromRegexp.'u', $to, $this->string)) {
314314
$lastError = preg_last_error();
315315

316316
foreach (get_defined_constants(true)['pcre'] as $k => $v) {

ByteString.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,18 +189,18 @@ public function lower(): parent
189189
return $str;
190190
}
191191

192-
public function match(string $pattern, int $flags = 0, int $offset = 0): array
192+
public function match(string $regexp, int $flags = 0, int $offset = 0): array
193193
{
194194
$match = ((\PREG_PATTERN_ORDER | \PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match';
195195

196196
if ($this->ignoreCase) {
197-
$pattern .= 'i';
197+
$regexp .= 'i';
198198
}
199199

200200
set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
201201

202202
try {
203-
if (false === $match($pattern, $this->string, $matches, $flags | PREG_UNMATCHED_AS_NULL, $offset)) {
203+
if (false === $match($regexp, $this->string, $matches, $flags | PREG_UNMATCHED_AS_NULL, $offset)) {
204204
$lastError = preg_last_error();
205205

206206
foreach (get_defined_constants(true)['pcre'] as $k => $v) {
@@ -261,10 +261,10 @@ public function replace(string $from, string $to): parent
261261
return $str;
262262
}
263263

264-
public function replaceMatches(string $fromPattern, $to): parent
264+
public function replaceMatches(string $fromRegexp, $to): parent
265265
{
266266
if ($this->ignoreCase) {
267-
$fromPattern .= 'i';
267+
$fromRegexp .= 'i';
268268
}
269269

270270
if (\is_array($to)) {
@@ -280,7 +280,7 @@ public function replaceMatches(string $fromPattern, $to): parent
280280
set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
281281

282282
try {
283-
if (null === $string = $replace($fromPattern, $to, $this->string)) {
283+
if (null === $string = $replace($fromRegexp, $to, $this->string)) {
284284
$lastError = preg_last_error();
285285

286286
foreach (get_defined_constants(true)['pcre'] as $k => $v) {

UnicodeString.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,9 @@ public function replace(string $from, string $to): AbstractString
250250
return $str;
251251
}
252252

253-
public function replaceMatches(string $fromPattern, $to): AbstractString
253+
public function replaceMatches(string $fromRegexp, $to): AbstractString
254254
{
255-
$str = parent::replaceMatches($fromPattern, $to);
255+
$str = parent::replaceMatches($fromRegexp, $to);
256256
normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
257257

258258
return $str;

0 commit comments

Comments
 (0)