From 528c90e274883e390b8117be01c16b84e87340c8 Mon Sep 17 00:00:00 2001 From: Jesse Donat Date: Sun, 8 Sep 2024 23:28:16 -0500 Subject: [PATCH 1/4] Add TooManyRequestsException --- README.md | 8 ++++++++ .../ClientError/TooManyRequestsException.php | 14 ++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/Exceptions/ClientError/TooManyRequestsException.php diff --git a/README.md b/README.md index 863dc52..1e50afa 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,14 @@ function getHttpStatusCode() : int function getHttpStatusCode() : int ``` +### Class: Corpus\Http\Exceptions\ClientError\TooManyRequestsException + +#### Method: TooManyRequestsException->getHttpStatusCode + +```php +function getHttpStatusCode() : int +``` + ### Class: Corpus\Http\Exceptions\ClientError\UnauthorizedException #### Method: UnauthorizedException->getHttpStatusCode diff --git a/src/Exceptions/ClientError/TooManyRequestsException.php b/src/Exceptions/ClientError/TooManyRequestsException.php new file mode 100644 index 0000000..bfb4034 --- /dev/null +++ b/src/Exceptions/ClientError/TooManyRequestsException.php @@ -0,0 +1,14 @@ + Date: Mon, 9 Sep 2024 17:06:02 -0500 Subject: [PATCH 2/4] Adds a little ExceptionNamingTest --- test/ExceptionNamingTest.php | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 test/ExceptionNamingTest.php diff --git a/test/ExceptionNamingTest.php b/test/ExceptionNamingTest.php new file mode 100644 index 0000000..c4511a7 --- /dev/null +++ b/test/ExceptionNamingTest.php @@ -0,0 +1,45 @@ +isAbstract()) { + continue; + } + + $inst = $this->getMockBuilder($className) + ->onlyMethods([]) + ->disableOriginalConstructor() + ->getMock(); + + assert($inst instanceof AbstractHttpException); + + $shortName = $reflect->getShortName(); + $constName = preg_replace('/Exception$/', '', $shortName); + + $this->assertSame( + constant(Status::class . '::' . $constName), + $inst->getHttpStatusCode() + ); + } + } + +} From 336a3c601ee51c268aeaa5897fc739edd54b5cb3 Mon Sep 17 00:00:00 2001 From: Jesse Donat Date: Mon, 9 Sep 2024 17:11:50 -0500 Subject: [PATCH 3/4] Update to PHP 7.3 minimum --- .github/workflows/ci.yml | 2 +- README.md | 2 +- composer.json | 2 +- phpstan.neon | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7df4b27..e04e046 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: operating-system: [ubuntu-latest] - php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] + php-versions: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] runs-on: ${{ matrix.operating-system }} diff --git a/README.md b/README.md index 1e50afa..3e6f1dc 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ HTTP Status Codes and Exceptions ## Requirements -- **php**: ^7.2 | ^8.0 +- **php**: ^7.3 | ^8.0 ## Installing diff --git a/composer.json b/composer.json index 74e2430..e9120bd 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ } ], "require": { - "php": "^7.2 | ^8.0" + "php": "^7.3 | ^8.0" }, "autoload": { "psr-4": { diff --git a/phpstan.neon b/phpstan.neon index d66b4c1..3b01fc9 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,4 +2,4 @@ parameters: level: 9 paths: - src - phpVersion: 70200 + phpVersion: 70300 From 4fcfacd630ce390ba83a4aa1bbf536fadbe11d6a Mon Sep 17 00:00:00 2001 From: Jesse Donat Date: Mon, 9 Sep 2024 17:21:22 -0500 Subject: [PATCH 4/4] Generally upgrade dev dependencies --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index e9120bd..90c9337 100644 --- a/composer.json +++ b/composer.json @@ -18,11 +18,11 @@ } }, "require-dev": { - "phpunit/phpunit": "~7.5 | ~9.0", - "squizlabs/php_codesniffer": "^3.5", "corpus/coding-standard": "^0.6.0", - "friendsofphp/php-cs-fixer": "^2.17", - "phpstan/phpstan": "^1.12" + "friendsofphp/php-cs-fixer": "^3.4", + "phpstan/phpstan": "^1.12", + "phpunit/phpunit": "^9.6", + "squizlabs/php_codesniffer": "^3.5" }, "config": { "allow-plugins": {