diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 7dc03f6..f8cc085 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -2,10 +2,12 @@ declare(strict_types=1); -$header = <<<'EOF' +$currentYear = \date('Y'); + +$header = << + (c) 2023-$currentYear Eric Sizemore For the full copyright and license information, please view the LICENSE file that was distributed with this source code. @@ -22,7 +24,6 @@ 'php_unit_internal_class' => ['types' => ['normal', 'final']], 'php_unit_namespaced' => true, 'php_unit_expectation' => true, - //'php_unit_strict' => ['assertions' => ['assertAttributeEquals', 'assertAttributeNotEquals', 'assertEquals', 'assertNotEquals']], 'php_unit_set_up_tear_down_visibility' => true, 'phpdoc_align' => true, 'phpdoc_indent' => true, @@ -56,14 +57,35 @@ '=>' => 'align_single_space_minimal', ], ], - 'heredoc_to_nowdoc' => true, - 'ordered_imports' => ['imports_order' => ['class', 'function', 'const',]], - 'declare_equal_normalize' => ['space' => 'none'], - 'declare_parentheses' => true, - 'declare_strict_types' => true, - //'global_namespace_import' => ['import_classes' => true, 'import_constants' => true, 'import_functions' => true], - 'header_comment' => ['comment_type' => 'PHPDoc', 'header' => $header, 'separate' => 'top'], - 'ordered_class_elements' => ['order' => ['use_trait', 'case', 'constant_public', 'constant_protected', 'constant_private', 'property_public', 'property_protected', 'property_private', 'construct', 'destruct', 'magic', 'phpunit', 'method_public', 'method_protected', 'method_private'], 'sort_algorithm' => 'alpha'], + 'heredoc_to_nowdoc' => true, + 'ordered_imports' => ['imports_order' => ['class', 'function', 'const',]], + 'no_unused_imports' => true, + 'single_import_per_statement' => true, + 'declare_equal_normalize' => ['space' => 'none'], + 'declare_parentheses' => true, + 'declare_strict_types' => true, + //'global_namespace_import' => ['import_classes' => true, 'import_constants' => true, 'import_functions' => true], + 'header_comment' => ['comment_type' => 'PHPDoc', 'header' => $header, 'separate' => 'top'], + 'ordered_class_elements' => [ + 'order' => [ + 'use_trait', + 'case', + 'constant_public', + 'constant_protected', + 'constant_private', + 'property_public', + 'property_protected', + 'property_private', + 'construct', + 'destruct', + 'magic', + 'phpunit', + 'method_public', + 'method_protected', + 'method_private', + ], + 'sort_algorithm' => 'alpha', + ], ]) ->setLineEnding("\n") ->setFinder( diff --git a/composer.lock b/composer.lock index 3250caa..e61f059 100644 --- a/composer.lock +++ b/composer.lock @@ -1327,16 +1327,16 @@ }, { "name": "amphp/parser", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/amphp/parser.git", - "reference": "ff1de4144726c5dad5fab97f66692ebe8de3e151" + "reference": "3cf1f8b32a0171d4b1bed93d25617637a77cded7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/parser/zipball/ff1de4144726c5dad5fab97f66692ebe8de3e151", - "reference": "ff1de4144726c5dad5fab97f66692ebe8de3e151", + "url": "https://api.github.com/repos/amphp/parser/zipball/3cf1f8b32a0171d4b1bed93d25617637a77cded7", + "reference": "3cf1f8b32a0171d4b1bed93d25617637a77cded7", "shasum": "" }, "require": { @@ -1377,7 +1377,7 @@ ], "support": { "issues": "https://github.com/amphp/parser/issues", - "source": "https://github.com/amphp/parser/tree/v1.1.0" + "source": "https://github.com/amphp/parser/tree/v1.1.1" }, "funding": [ { @@ -1385,7 +1385,7 @@ "type": "github" } ], - "time": "2022-12-30T18:08:47+00:00" + "time": "2024-03-21T19:16:53+00:00" }, { "name": "amphp/pipeline", @@ -1514,16 +1514,16 @@ }, { "name": "amphp/sync", - "version": "v2.1.0", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/amphp/sync.git", - "reference": "50ddc7392cc8034b3e4798cef3cc90d3f4c0441c" + "reference": "375ef5b54a0d12c38e12728dde05a55e30f2fbec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/sync/zipball/50ddc7392cc8034b3e4798cef3cc90d3f4c0441c", - "reference": "50ddc7392cc8034b3e4798cef3cc90d3f4c0441c", + "url": "https://api.github.com/repos/amphp/sync/zipball/375ef5b54a0d12c38e12728dde05a55e30f2fbec", + "reference": "375ef5b54a0d12c38e12728dde05a55e30f2fbec", "shasum": "" }, "require": { @@ -1537,7 +1537,7 @@ "amphp/php-cs-fixer-config": "^2", "amphp/phpunit-util": "^3", "phpunit/phpunit": "^9", - "psalm/phar": "^5.4" + "psalm/phar": "5.23" }, "type": "library", "autoload": { @@ -1577,7 +1577,7 @@ ], "support": { "issues": "https://github.com/amphp/sync/issues", - "source": "https://github.com/amphp/sync/tree/v2.1.0" + "source": "https://github.com/amphp/sync/tree/v2.2.0" }, "funding": [ { @@ -1585,7 +1585,7 @@ "type": "github" } ], - "time": "2023-08-19T13:53:40+00:00" + "time": "2024-03-12T01:00:01+00:00" }, { "name": "composer/package-versions-deprecated", @@ -1662,16 +1662,16 @@ }, { "name": "composer/pcre", - "version": "3.1.2", + "version": "3.1.3", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "4775f35b2d70865807c89d32c8e7385b86eb0ace" + "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/4775f35b2d70865807c89d32c8e7385b86eb0ace", - "reference": "4775f35b2d70865807c89d32c8e7385b86eb0ace", + "url": "https://api.github.com/repos/composer/pcre/zipball/5b16e25a5355f1f3afdfc2f954a0a80aec4826a8", + "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8", "shasum": "" }, "require": { @@ -1713,7 +1713,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.2" + "source": "https://github.com/composer/pcre/tree/3.1.3" }, "funding": [ { @@ -1729,7 +1729,7 @@ "type": "tidelift" } ], - "time": "2024-03-07T15:38:35+00:00" + "time": "2024-03-19T10:26:25+00:00" }, { "name": "composer/semver", @@ -2130,12 +2130,12 @@ "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "5cfa1f91f4ade750269c4643455fe7230a96aee1" + "reference": "e980ab222217a7efa19bcaec3c12d4a1a5592803" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/5cfa1f91f4ade750269c4643455fe7230a96aee1", - "reference": "5cfa1f91f4ade750269c4643455fe7230a96aee1", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/e980ab222217a7efa19bcaec3c12d4a1a5592803", + "reference": "e980ab222217a7efa19bcaec3c12d4a1a5592803", "shasum": "" }, "require": { @@ -2215,7 +2215,7 @@ "type": "github" } ], - "time": "2024-03-14T07:17:20+00:00" + "time": "2024-03-22T15:39:09+00:00" }, { "name": "myclabs/deep-copy", @@ -2673,16 +2673,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.26.0", + "version": "1.27.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "231e3186624c03d7e7c890ec662b81e6b0405227" + "reference": "86e4d5a4b036f8f0be1464522f4c6b584c452757" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/231e3186624c03d7e7c890ec662b81e6b0405227", - "reference": "231e3186624c03d7e7c890ec662b81e6b0405227", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/86e4d5a4b036f8f0be1464522f4c6b584c452757", + "reference": "86e4d5a4b036f8f0be1464522f4c6b584c452757", "shasum": "" }, "require": { @@ -2714,9 +2714,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.26.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.27.0" }, - "time": "2024-02-23T16:05:55+00:00" + "time": "2024-03-21T13:14:53+00:00" }, { "name": "phpstan/phpstan", @@ -2724,12 +2724,12 @@ "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "5b77cb3070b7ca25fcdb964583cef15cddcfc926" + "reference": "8ec2a944d80bd7eae2e3b88e02250d6bafaf993c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5b77cb3070b7ca25fcdb964583cef15cddcfc926", - "reference": "5b77cb3070b7ca25fcdb964583cef15cddcfc926", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8ec2a944d80bd7eae2e3b88e02250d6bafaf993c", + "reference": "8ec2a944d80bd7eae2e3b88e02250d6bafaf993c", "shasum": "" }, "require": { @@ -2779,7 +2779,7 @@ "type": "tidelift" } ], - "time": "2024-03-13T14:17:45+00:00" + "time": "2024-03-24T14:21:48+00:00" }, { "name": "phpstan/phpstan-phpunit", @@ -2840,12 +2840,12 @@ "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-strict-rules.git", - "reference": "85fdc5057e6876961d98e61fb2ff262f9f2fc7c2" + "reference": "d0dc2f0a6caf4ca2fcb837fb071e7452759a4847" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/85fdc5057e6876961d98e61fb2ff262f9f2fc7c2", - "reference": "85fdc5057e6876961d98e61fb2ff262f9f2fc7c2", + "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/d0dc2f0a6caf4ca2fcb837fb071e7452759a4847", + "reference": "d0dc2f0a6caf4ca2fcb837fb071e7452759a4847", "shasum": "" }, "require": { @@ -2882,7 +2882,7 @@ "issues": "https://github.com/phpstan/phpstan-strict-rules/issues", "source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.6.x" }, - "time": "2024-02-26T13:34:21+00:00" + "time": "2024-03-24T08:12:48+00:00" }, { "name": "phpunit/php-code-coverage", @@ -3863,16 +3863,16 @@ }, { "name": "sebastian/environment", - "version": "7.0.0", + "version": "7.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "100d8b855d7180f79f9a9a5c483f2d960581c3ea" + "reference": "4eb3a442574d0e9d141aab209cd4aaf25701b09a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/100d8b855d7180f79f9a9a5c483f2d960581c3ea", - "reference": "100d8b855d7180f79f9a9a5c483f2d960581c3ea", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4eb3a442574d0e9d141aab209cd4aaf25701b09a", + "reference": "4eb3a442574d0e9d141aab209cd4aaf25701b09a", "shasum": "" }, "require": { @@ -3887,7 +3887,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "7.0-dev" + "dev-main": "7.1-dev" } }, "autoload": { @@ -3915,7 +3915,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", "security": "https://github.com/sebastianbergmann/environment/security/policy", - "source": "https://github.com/sebastianbergmann/environment/tree/7.0.0" + "source": "https://github.com/sebastianbergmann/environment/tree/7.1.0" }, "funding": [ { @@ -3923,7 +3923,7 @@ "type": "github" } ], - "time": "2024-02-02T05:57:54+00:00" + "time": "2024-03-23T08:56:34+00:00" }, { "name": "sebastian/exporter", diff --git a/src/AbstractClient.php b/src/AbstractClient.php index 0922816..8bb1313 100644 --- a/src/AbstractClient.php +++ b/src/AbstractClient.php @@ -21,24 +21,19 @@ use GuzzleHttp\Exception\InvalidArgumentException; use GuzzleHttp\Handler\MockHandler; use GuzzleHttp\HandlerStack; -use Kevinrob\GuzzleCache\{ - CacheMiddleware, - Storage\Psr6CacheStorage, - Strategy\PrivateCacheStrategy -}; +use Kevinrob\GuzzleCache\CacheMiddleware; +use Kevinrob\GuzzleCache\Storage\Psr6CacheStorage; +use Kevinrob\GuzzleCache\Strategy\PrivateCacheStrategy; use Psr\Http\Message\ResponseInterface; -use RuntimeException; use SensitiveParameter; use Symfony\Component\Cache\Adapter\FilesystemAdapter; use function array_filter; use function array_merge; -use function assert; use function is_array; use function is_dir; use function is_writable; use function preg_match; -use function sprintf; use const ARRAY_FILTER_USE_BOTH; @@ -58,8 +53,8 @@ abstract class AbstractClient /** * @param string $apiKey Your Libraries.io API Key * @param ?string $cachePath The path to your cache on the filesystem - * @param array $clientOptions An associative array with options to set in the initial config of the Guzzle - * client. + * @param array $clientOptions An associative array with options to set in the initial config + * of the Guzzle client. * * @see https://docs.guzzlephp.org/en/stable/request-options.html * diff --git a/src/Exception/RateLimitExceededException.php b/src/Exception/RateLimitExceededException.php index 7612030..ff5c20b 100644 --- a/src/Exception/RateLimitExceededException.php +++ b/src/Exception/RateLimitExceededException.php @@ -14,7 +14,6 @@ namespace Esi\LibrariesIO\Exception; use GuzzleHttp\Exception\ClientException; -use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use RuntimeException; diff --git a/src/LibrariesIO.php b/src/LibrariesIO.php index 3ce6091..95ef791 100644 --- a/src/LibrariesIO.php +++ b/src/LibrariesIO.php @@ -16,11 +16,8 @@ use Esi\LibrariesIO\Exception\InvalidApiKeyException; use Esi\LibrariesIO\Exception\InvalidEndpointException; use Esi\LibrariesIO\Exception\RateLimitExceededException; -use GuzzleHttp\Exception\{ - ClientException, - GuzzleException -}; -use InvalidArgumentException; +use GuzzleHttp\Exception\ClientException; +use GuzzleHttp\Exception\GuzzleException; use Psr\Http\Message\ResponseInterface; use SensitiveParameter; diff --git a/src/Utils.php b/src/Utils.php index c1c2dc3..274f8b4 100644 --- a/src/Utils.php +++ b/src/Utils.php @@ -15,7 +15,6 @@ use Esi\LibrariesIO\Exception\InvalidEndpointException; use Esi\LibrariesIO\Exception\InvalidEndpointOptionsException; -use InvalidArgumentException; use JsonException; use Psr\Http\Message\ResponseInterface; use stdClass; diff --git a/tests/src/LibrariesIOTest.php b/tests/src/LibrariesIOTest.php index 6048bd9..7a28791 100644 --- a/tests/src/LibrariesIOTest.php +++ b/tests/src/LibrariesIOTest.php @@ -20,22 +20,17 @@ use Esi\LibrariesIO\Exception\RateLimitExceededException; use Esi\LibrariesIO\LibrariesIO; use Esi\LibrariesIO\Utils; -use GuzzleHttp\{ - Exception\ClientException, - HandlerStack, - Handler\MockHandler, - Psr7\Request, - Psr7\Response -}; +use GuzzleHttp\Exception\ClientException; +use GuzzleHttp\Handler\MockHandler; +use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Response; use InvalidArgumentException; use Iterator; -use PHPUnit\Framework\{ - Attributes\CoversClass, - Attributes\DataProvider, - Attributes\TestDox, - MockObject\MockObject, - TestCase -}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\TestDox; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; use stdClass; use function sys_get_temp_dir; @@ -44,6 +39,7 @@ * LibrariesIO Tests. * * @internal + * * @psalm-internal Esi\LibrariesIO\Tests */ #[CoversClass(LibrariesIO::class)]