From e58f3a6c5fe7bcad0c9b08981697e689cb883dc1 Mon Sep 17 00:00:00 2001 From: Jah-yee <166608075+Jah-yee@users.noreply.github.com> Date: Sat, 8 Aug 2026 14:11:19 +0800 Subject: [PATCH] fix: correct 'occured' to 'occurred' typo in user-facing error messages Corrects spelling in 8 files across src/ and tests/ directories. All instances of 'occured' in error messages and test assertions updated to 'occurred'. --- src/BrowscapUpdater.php | 28 ++++++++++++++-------------- src/Cache/BrowscapCache.php | 6 +++--- src/Helper/Converter.php | 12 ++++++------ src/Helper/Quoter.php | 2 +- src/IniParser/IniParser.php | 2 +- src/Parser/Helper/GetData.php | 4 ++-- src/Parser/Helper/GetPattern.php | 4 ++-- tests/BrowscapUpdaterTest.php | 4 ++-- 8 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/BrowscapUpdater.php b/src/BrowscapUpdater.php index 7825f17a..fcc3a2a9 100644 --- a/src/BrowscapUpdater.php +++ b/src/BrowscapUpdater.php @@ -100,7 +100,7 @@ public function convertFile(string $iniFile): void $iniString = file_get_contents($iniFile); if ($iniString === false) { - throw new ErrorReadingFileException('an error occured while converting the local file into the cache'); + throw new ErrorReadingFileException('an error occurred while converting the local file into the cache'); } $this->convertString($iniString); @@ -116,7 +116,7 @@ public function convertString(string $iniString): void try { $cachedVersion = $this->cache->getItem('browscap.version', false, $success); } catch (InvalidArgumentException $e) { - $this->logger->error(new \InvalidArgumentException('an error occured while reading the data version from the cache', 0, $e)); + $this->logger->error(new \InvalidArgumentException('an error occurred while reading the data version from the cache', 0, $e)); return; } @@ -161,7 +161,7 @@ public function fetch(string $file, string $remoteFile = IniLoaderInterface::PHP } catch (GuzzleException $e) { throw new FetcherException( sprintf( - 'an error occured while fetching remote data from URI %s', + 'an error occurred while fetching remote data from URI %s', $uri, ), 0, @@ -172,7 +172,7 @@ public function fetch(string $file, string $remoteFile = IniLoaderInterface::PHP if ($response->getStatusCode() !== 200) { throw new FetcherException( sprintf( - 'an error occured while fetching remote data from URI %s: StatusCode was %d', + 'an error occurred while fetching remote data from URI %s: StatusCode was %d', $uri, $response->getStatusCode(), ), @@ -182,7 +182,7 @@ public function fetch(string $file, string $remoteFile = IniLoaderInterface::PHP try { $content = $response->getBody()->getContents(); } catch (Throwable $e) { - throw new FetcherException('an error occured while fetching remote data', 0, $e); + throw new FetcherException('an error occurred while fetching remote data', 0, $e); } if (empty($content)) { @@ -194,7 +194,7 @@ public function fetch(string $file, string $remoteFile = IniLoaderInterface::PHP throw FetcherException::httpError( $uri, - 'an error occured while fetching remote data, but no error was raised', + 'an error occurred while fetching remote data, but no error was raised', ); } @@ -212,7 +212,7 @@ public function fetch(string $file, string $remoteFile = IniLoaderInterface::PHP try { $fs->dumpFile($file, $content); } catch (IOException $exception) { - throw new FetcherException('an error occured while writing fetched data to local file', 0, $exception); + throw new FetcherException('an error occurred while writing fetched data to local file', 0, $exception); } } @@ -253,7 +253,7 @@ public function update(string $remoteFile = IniLoaderInterface::PHP_INI): void } catch (GuzzleException $e) { throw new FetcherException( sprintf( - 'an error occured while fetching remote data from URI %s', + 'an error occurred while fetching remote data from URI %s', $uri, ), 0, @@ -264,7 +264,7 @@ public function update(string $remoteFile = IniLoaderInterface::PHP_INI): void if ($response->getStatusCode() !== 200) { throw new FetcherException( sprintf( - 'an error occured while fetching remote data from URI %s: StatusCode was %d', + 'an error occurred while fetching remote data from URI %s: StatusCode was %d', $uri, $response->getStatusCode(), ), @@ -274,7 +274,7 @@ public function update(string $remoteFile = IniLoaderInterface::PHP_INI): void try { $content = $response->getBody()->getContents(); } catch (Throwable $e) { - throw new FetcherException('an error occured while fetching remote data', 0, $e); + throw new FetcherException('an error occurred while fetching remote data', 0, $e); } if (empty($content)) { @@ -309,7 +309,7 @@ public function checkUpdate(): ?int try { $cachedVersion = $this->cache->getItem('browscap.version', false, $success); } catch (InvalidArgumentException $e) { - throw new ErrorCachedVersionException('an error occured while reading the data version from the cache', 0, $e); + throw new ErrorCachedVersionException('an error occurred while reading the data version from the cache', 0, $e); } assert($cachedVersion === null || is_int($cachedVersion)); @@ -327,7 +327,7 @@ public function checkUpdate(): ?int } catch (GuzzleException $e) { throw new FetcherException( sprintf( - 'an error occured while fetching version data from URI %s', + 'an error occurred while fetching version data from URI %s', $uri, ), 0, @@ -338,7 +338,7 @@ public function checkUpdate(): ?int if ($response->getStatusCode() !== 200) { throw new FetcherException( sprintf( - 'an error occured while fetching version data from URI %s: StatusCode was %d', + 'an error occurred while fetching version data from URI %s: StatusCode was %d', $uri, $response->getStatusCode(), ), @@ -350,7 +350,7 @@ public function checkUpdate(): ?int } catch (Throwable $e) { throw new FetcherException( sprintf( - 'an error occured while fetching version data from URI %s: StatusCode was %d', + 'an error occurred while fetching version data from URI %s: StatusCode was %d', $uri, $response->getStatusCode(), ), diff --git a/src/Cache/BrowscapCache.php b/src/Cache/BrowscapCache.php index 4aa1d1e7..25439414 100644 --- a/src/Cache/BrowscapCache.php +++ b/src/Cache/BrowscapCache.php @@ -68,7 +68,7 @@ public function getVersion(): ?int try { $cachedVersion = $this->getItem('browscap.version', false, $success); } catch (InvalidArgumentException $e) { - $this->logger->error(new \InvalidArgumentException('an error occured while reading the data version from the cache', 0, $e)); + $this->logger->error(new \InvalidArgumentException('an error occurred while reading the data version from the cache', 0, $e)); $cachedVersion = null; } @@ -95,7 +95,7 @@ public function getReleaseDate(): ?string try { $releaseDate = $this->getItem('browscap.releaseDate', false, $success); } catch (InvalidArgumentException $e) { - $this->logger->error(new \InvalidArgumentException('an error occured while reading the data release date from the cache', 0, $e)); + $this->logger->error(new \InvalidArgumentException('an error occurred while reading the data release date from the cache', 0, $e)); $releaseDate = null; } @@ -122,7 +122,7 @@ public function getType(): ?string try { $type = $this->getItem('browscap.type', false, $success); } catch (InvalidArgumentException $e) { - $this->logger->error(new \InvalidArgumentException('an error occured while reading the data type from the cache', 0, $e)); + $this->logger->error(new \InvalidArgumentException('an error occurred while reading the data type from the cache', 0, $e)); $type = null; } diff --git a/src/Helper/Converter.php b/src/Helper/Converter.php index d7363f2b..5cdb294b 100644 --- a/src/Helper/Converter.php +++ b/src/Helper/Converter.php @@ -110,7 +110,7 @@ public function convertString(string $iniString): void $this->logger->error('could not write pattern data "' . $subkey . '" to the cache'); } } catch (InvalidArgumentException $e) { - $this->logger->error(new \InvalidArgumentException('an error occured while writing pattern data into the cache', 0, $e)); + $this->logger->error(new \InvalidArgumentException('an error occurred while writing pattern data into the cache', 0, $e)); } } @@ -129,23 +129,23 @@ public function convertString(string $iniString): void $this->logger->error('could not write property data "' . $subkey . '" to the cache'); } } catch (InvalidArgumentException $e) { - $this->logger->error(new \InvalidArgumentException('an error occured while writing property data into the cache', 0, $e)); + $this->logger->error(new \InvalidArgumentException('an error occurred while writing property data into the cache', 0, $e)); } } } catch (OutOfRangeException | UnexpectedValueException | JsonException | \InvalidArgumentException $e) { - $this->logger->error(new \InvalidArgumentException('an error occured while writing property data into the cache', 0, $e)); + $this->logger->error(new \InvalidArgumentException('an error occurred while writing property data into the cache', 0, $e)); } try { $this->cache->setItem('browscap.releaseDate', $this->getIniReleaseDate($iniString), false); } catch (InvalidArgumentException $e) { - $this->logger->error(new \InvalidArgumentException('an error occured while writing data release date into the cache', 0, $e)); + $this->logger->error(new \InvalidArgumentException('an error occurred while writing data release date into the cache', 0, $e)); } try { $this->cache->setItem('browscap.type', $this->getIniType($iniString), false); } catch (InvalidArgumentException $e) { - $this->logger->error(new \InvalidArgumentException('an error occured while writing the data type into the cache', 0, $e)); + $this->logger->error(new \InvalidArgumentException('an error occurred while writing the data type into the cache', 0, $e)); } $this->logger->info('finished creating data from the ini data'); @@ -192,7 +192,7 @@ public function storeVersion(): void try { $this->cache->setItem('browscap.version', $this->iniVersion, false); } catch (InvalidArgumentException $e) { - $this->logger->error(new \InvalidArgumentException('an error occured while writing the data version into the cache', 0, $e)); + $this->logger->error(new \InvalidArgumentException('an error occurred while writing the data version into the cache', 0, $e)); } } diff --git a/src/Helper/Quoter.php b/src/Helper/Quoter.php index 8d2687c0..21226f55 100644 --- a/src/Helper/Quoter.php +++ b/src/Helper/Quoter.php @@ -54,7 +54,7 @@ public function pregUnQuote(string $pattern): string if ($pattern === null) { throw new UnexpectedValueException( - sprintf('an error occured while handling pattern %s', $origPattern), + sprintf('an error occurred while handling pattern %s', $origPattern), ); } diff --git a/src/IniParser/IniParser.php b/src/IniParser/IniParser.php index 8e1e759b..69d45978 100644 --- a/src/IniParser/IniParser.php +++ b/src/IniParser/IniParser.php @@ -74,7 +74,7 @@ public function createIniParts(string $content): Generator // pattern (filtered in the previous step) $iniParts = preg_split('/\[[^\r\n]+\]/', $content); if ($iniParts === false) { - throw new UnexpectedValueException('an error occured while splitting content into parts'); + throw new UnexpectedValueException('an error occurred while splitting content into parts'); } $contents = []; diff --git a/src/Parser/Helper/GetData.php b/src/Parser/Helper/GetData.php index 5da15a8e..fbf44555 100644 --- a/src/Parser/Helper/GetData.php +++ b/src/Parser/Helper/GetData.php @@ -132,7 +132,7 @@ private function getIniPart(string $pattern): array $this->logger->error( new \InvalidArgumentException( sprintf( - 'an error occured while checking inipart "browscap.iniparts.%s" in the cache', + 'an error occurred while checking inipart "browscap.iniparts.%s" in the cache', $subkey, ), 0, @@ -151,7 +151,7 @@ private function getIniPart(string $pattern): array $this->logger->error( new \InvalidArgumentException( sprintf( - 'an error occured while reading inipart "browscap.iniparts.%s" from the cache', + 'an error occurred while reading inipart "browscap.iniparts.%s" from the cache', $subkey, ), 0, diff --git a/src/Parser/Helper/GetPattern.php b/src/Parser/Helper/GetPattern.php index 494bfada..a8b719ad 100644 --- a/src/Parser/Helper/GetPattern.php +++ b/src/Parser/Helper/GetPattern.php @@ -79,7 +79,7 @@ public function getPatterns(string $userAgent): Generator $this->logger->error( new \InvalidArgumentException( sprintf( - 'an error occured while checking pattern "browscap.patterns.%s" in the cache', + 'an error occurred while checking pattern "browscap.patterns.%s" in the cache', $tmpSubkey, ), 0, @@ -98,7 +98,7 @@ public function getPatterns(string $userAgent): Generator $this->logger->error( new \InvalidArgumentException( sprintf( - 'an error occured while reading pattern "browscap.patterns.%s" from the cache', + 'an error occurred while reading pattern "browscap.patterns.%s" from the cache', $tmpSubkey, ), 0, diff --git a/tests/BrowscapUpdaterTest.php b/tests/BrowscapUpdaterTest.php index 11200308..fef8905d 100644 --- a/tests/BrowscapUpdaterTest.php +++ b/tests/BrowscapUpdaterTest.php @@ -372,7 +372,7 @@ public function testFetchFail(): void $this->expectException(BrowscapException\FetcherException::class); $this->expectExceptionMessage( - 'an error occured while fetching version data from URI http://browscap.org/version-number: StatusCode was 500', + 'an error occurred while fetching version data from URI http://browscap.org/version-number: StatusCode was 500', ); $this->object->fetch(IniLoaderInterface::PHP_INI); } @@ -1099,7 +1099,7 @@ public function testCheckUpdateWithException(): void $this->expectException(BrowscapException\FetcherException::class); $this->expectExceptionMessage( - 'an error occured while fetching version data from URI http://browscap.org/version-number: StatusCode was 200', + 'an error occurred while fetching version data from URI http://browscap.org/version-number: StatusCode was 200', ); $this->object->checkUpdate(); }