diff --git a/composer.json b/composer.json index 03e9fd47..1820989a 100644 --- a/composer.json +++ b/composer.json @@ -13,18 +13,24 @@ } ], "require": { - "php": "^7.3|^8.0", - "webmozart/assert": "^1.2", - "guzzlehttp/guzzle": "^6.3|^7.0.1", - "rize/uri-template": "^0.3.5|^0.4.0" + "php": "^8.2", + "webmozart/assert": "^2.0", + "guzzlehttp/guzzle": "^7.0", + "rize/uri-template": "^0.4.0" }, "require-dev": { - "phpunit/phpunit": "^8.4", + "phpunit/phpunit": "^10.0", "phpstan/phpstan": "^1.10", "friendsofphp/php-cs-fixer": "^3.4", "mockery/mockery": "^1.1", "ramsey/uuid": "^4.1" }, + "replace": { + "symfony/polyfill-php74": "*", + "symfony/polyfill-php80": "*", + "symfony/polyfill-php81": "*", + "symfony/polyfill-php82": "*" + }, "autoload": { "psr-4": { "HelpScout\\Api\\": "src/" } }, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 38ed5ef8..7e27d2b1 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,25 +1,24 @@ - - - - - ./tests - - - - - - ./src - - - - - - - - - - - - + + + + + + + + + + ./tests + + + + + + + + + + ./src + + diff --git a/src/Assert/Assert.php b/src/Assert/Assert.php index 00b09015..7c40d3ba 100644 --- a/src/Assert/Assert.php +++ b/src/Assert/Assert.php @@ -12,9 +12,9 @@ class Assert extends BaseAssert /** * {@inheritdoc} * - * @return InvalidArgumentException + * @throws InvalidArgumentException */ - protected static function reportInvalidArgument($message) + protected static function reportInvalidArgument(string $message): never { throw new InvalidArgumentException($message); } diff --git a/tests/Conversations/ConversationFiltersTest.php b/tests/Conversations/ConversationFiltersTest.php index e76739bd..64e714f5 100644 --- a/tests/Conversations/ConversationFiltersTest.php +++ b/tests/Conversations/ConversationFiltersTest.php @@ -99,7 +99,7 @@ public function testWithValidSortField($sortField) ], $filters->getParams()); } - public function sortFieldProvider(): array + public static function sortFieldProvider(): array { return [ ['createdAt'], @@ -133,7 +133,7 @@ public function testWithValidSortOrder($sortOrder, $sortOrderParam) ], $filters->getParams()); } - public function sortOrderProvider(): array + public static function sortOrderProvider(): array { return [ ['asc', 'asc'], diff --git a/tests/Conversations/ConversationRequestTest.php b/tests/Conversations/ConversationRequestTest.php index 4acdac5e..a3a99816 100644 --- a/tests/Conversations/ConversationRequestTest.php +++ b/tests/Conversations/ConversationRequestTest.php @@ -23,7 +23,7 @@ public function testAddsLinks($rel) $this->assertTrue($request->hasLink($rel)); } - public function linkProvider() + public static function linkProvider() { return [ [ConversationLinks::MAILBOX], diff --git a/tests/Customers/CustomerFiltersTest.php b/tests/Customers/CustomerFiltersTest.php index 25c49d26..47ea6a87 100644 --- a/tests/Customers/CustomerFiltersTest.php +++ b/tests/Customers/CustomerFiltersTest.php @@ -60,7 +60,7 @@ public function testWithValidSortField($sortField) ], $filters->getParams()); } - public function sortFieldProvider(): array + public static function sortFieldProvider(): array { return [ ['score'], @@ -90,7 +90,7 @@ public function testWithValidSortOrder($sortOrder, $sortOrderParam) ], $filters->getParams()); } - public function sortOrderProvider(): array + public static function sortOrderProvider(): array { return [ ['asc', 'asc'], diff --git a/tests/Customers/CustomerRequestTest.php b/tests/Customers/CustomerRequestTest.php index 7e742cf1..adaa1044 100644 --- a/tests/Customers/CustomerRequestTest.php +++ b/tests/Customers/CustomerRequestTest.php @@ -23,7 +23,7 @@ public function testAddsLinks($rel) $this->assertTrue($request->hasLink($rel)); } - public function linkProvider() + public static function linkProvider() { return [ [CustomerLinks::ADDRESS], diff --git a/tests/Http/AuthenticatorTest.php b/tests/Http/AuthenticatorTest.php index e66badbc..a5a9a21c 100644 --- a/tests/Http/AuthenticatorTest.php +++ b/tests/Http/AuthenticatorTest.php @@ -188,7 +188,7 @@ public function testIdentifiesWhenToAutoRefreshToken(array $args) ); } - public function autoRefreshAccessTokenProvider(): \Generator + public static function autoRefreshAccessTokenProvider(): \Generator { $typesThatCanRefreshTokens = [ ClientCredentials::TYPE, diff --git a/tests/Http/RestClientTest.php b/tests/Http/RestClientTest.php index 50db2199..bafb8afd 100644 --- a/tests/Http/RestClientTest.php +++ b/tests/Http/RestClientTest.php @@ -193,7 +193,7 @@ public function testDeciderDoesNotRetry(...$params) $this->assertFalse($shouldRetry); } - public function noRetryParamProvider(): \Generator + public static function noRetryParamProvider(): \Generator { $request = new Request( 'POST', @@ -272,7 +272,7 @@ public function testDeciderDoesRetry(...$params) $this->assertTrue($shouldRetry); } - public function retryParamProvider(): \Generator + public static function retryParamProvider(): \Generator { $request = new Request( 'POST', diff --git a/tests/Mailboxes/MailboxRequestTest.php b/tests/Mailboxes/MailboxRequestTest.php index 1d52f873..745f7f8b 100644 --- a/tests/Mailboxes/MailboxRequestTest.php +++ b/tests/Mailboxes/MailboxRequestTest.php @@ -23,7 +23,7 @@ public function testAddsLinks($rel) $this->assertTrue($request->hasLink($rel)); } - public function linkProvider() + public static function linkProvider() { return [ [MailboxLinks::FIELDS], diff --git a/tests/ReflectionTestTrait.php b/tests/ReflectionTestTrait.php index f1ccdd1f..77444f6e 100644 --- a/tests/ReflectionTestTrait.php +++ b/tests/ReflectionTestTrait.php @@ -19,7 +19,6 @@ public function invokeMethod($object, string $method, array $parameters = []) $reflection = new \ReflectionClass($class); $reflectedMethod = $reflection->getMethod($method); - $reflectedMethod->setAccessible(true); return $reflectedMethod->invokeArgs($object, $parameters); } @@ -35,7 +34,6 @@ public function getAttribute($object, string $attributeName) { $reflection = new \ReflectionClass($object); $property = $reflection->getProperty($attributeName); - $property->setAccessible(true); return $property->getValue($object); } @@ -51,7 +49,6 @@ public function setAttribute($object, string $attributeName, $value): void $class = $this->getClassName($object); $reflection = new \ReflectionProperty($class, $attributeName); - $reflection->setAccessible(true); $reflection->setValue($object, $value); } diff --git a/tests/Reports/ReportTest.php b/tests/Reports/ReportTest.php index 7e9c67e1..20e7d7a3 100644 --- a/tests/Reports/ReportTest.php +++ b/tests/Reports/ReportTest.php @@ -9,7 +9,7 @@ class ReportTest extends TestCase { - public function reportTypeProvider(): array + public static function reportTypeProvider(): array { return [ [Reports\Company\Overall::class],