From 6afd276ab2766b1e31ddb76195f8eeffb8bc9f17 Mon Sep 17 00:00:00 2001 From: Philippe Dirx Date: Fri, 2 Sep 2022 12:11:24 +0200 Subject: [PATCH] Rename reserved keyword Match class to SRLMatch class to make SRL work with PHP 8.0+ --- src/Interfaces/TestMethodProvider.php | 14 ++++++-------- src/{Match.php => SRLMatch.php} | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) rename src/{Match.php => SRLMatch.php} (98%) diff --git a/src/Interfaces/TestMethodProvider.php b/src/Interfaces/TestMethodProvider.php index 298c044..3ce8f68 100644 --- a/src/Interfaces/TestMethodProvider.php +++ b/src/Interfaces/TestMethodProvider.php @@ -3,7 +3,7 @@ namespace SRL\Interfaces; use SRL\Exceptions\PregException; -use SRL\Match; +use SRL\SRLMatch; /** * Provider for methods that can be applied to the built regular expression by the user. @@ -92,11 +92,10 @@ public function filter($replacement, $haystack, int $limit = -1, &$count = null) /** * Match regular expression against string and return all matches. - * * @param string $string * @param int $offset - * @throws PregException - * @return Match[]|array + * @return SRLMatch[]|array + *@throws PregException */ public function getMatches(string $string, int $offset = 0) : array { @@ -107,7 +106,7 @@ public function getMatches(string $string, int $offset = 0) : array $matchObjects = []; foreach ($matches as $match) { - $matchObjects[] = new Match($match); + $matchObjects[] = new SRLMatch($match); } return $matchObjects; @@ -115,11 +114,10 @@ public function getMatches(string $string, int $offset = 0) : array /** * Match regular expression against string and return first match object. - * * @param string $string * @param int $offset - * @throws PregException - * @return null|Match + * @return null|SRLMatch + *@throws PregException */ public function getMatch(string $string, int $offset = 0) { diff --git a/src/Match.php b/src/SRLMatch.php similarity index 98% rename from src/Match.php rename to src/SRLMatch.php index c898427..2f852d8 100644 --- a/src/Match.php +++ b/src/SRLMatch.php @@ -2,7 +2,7 @@ namespace SRL; -class Match +class SRLMatch { /** @var string[] */ protected $rawData = [];