-
-
Notifications
You must be signed in to change notification settings - Fork 114
WIP #284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.1
Are you sure you want to change the base?
WIP #284
Conversation
This commit addresses several issues to make the test suite compatible with PHPUnit 12: 1. Fixed the 'Empty response body with status code 0' error by providing a proper empty JSON response body in TestCase::getClientWithMockedHttpClient(). The mock response now includes a valid JSON body to prevent parse errors. 2. Updated AccountTest.php to use PHPUnit attributes (#[Test]) instead of annotations (@test) while maintaining the original test structure and assertions. 3. Upgraded API test assertions to work with PSR-18 client and response objects. All tests are now passing successfully with PHPUnit 12.
- Updated PHP requirement from ^8.2 to ^8.3 to align with PHPUnit 12 requirements - Updated PHPUnit requirement from ^11.0 to ^12.1 to get latest features and bug fixes - Updated GitHub workflows to test with PHP 8.3 and 8.4 instead of 8.2 and 8.3
- Add return type declarations to improve type safety - Add #[\Override] attributes to methods that override parent methods - Update property type declarations with proper typehints - Fix mixed type hints for properties that need flexibility in tests - Address dynamic property deprecation warnings in PHP 8.3 - Fix type compatibility issues between collections and test mocks - Maintain backward compatibility with existing test suite
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR modernizes the TMDB PHP client by introducing strict types and explicit return type hints across API classes, updating the PHP requirement and dependencies to recent versions, and revising CI workflows to test on PHP 8.3/8.4 with the latest GitHub Actions.
- Added
declare(strict_types=1)
and return types to API methods - Bumped PHP requirement to
^8.3
, updated composer dependencies, and moved PHPUnit versions - Updated GitHub Actions workflows to use PHP 8.3/8.4 and upgraded action versions
Reviewed Changes
Copilot reviewed 385 out of 385 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
composer.json | Bumped php requirement, updated dependencies and mistakenly moved PHPUnit to require |
lib/Tmdb/Api/AbstractApi.php | Introduced strict types, property promotion, and revamped decodeResponse with exceptions |
.github/workflows/continuous-integration.yml | Updated PHP matrix to 8.3/8.4 and upgraded actions/checkout , actions/cache , and codecov |
lib/Tmdb/Api/GuestSession.php | Added strict types and return type for getRatedMovies , but docblock lacks @return array |
Comments suppressed due to low confidence (2)
lib/Tmdb/Api/AbstractApi.php:161
- Add tests for empty and
'0'
response bodies to ensure correct handling for 204 No Content and valid numeric zero responses.
if ($body === '' || $body === '0') {
composer.json:47
- PHPUnit is a development tool and should be declared under
require-dev
, not in the mainrequire
section.
"phpunit/phpunit": "^12.1"
* @param array $headers | ||
* @return mixed | ||
* @throws MissingSessionTokenException when the guest session token was not set on the client. | ||
* @throws MissingSessionTokenException when the guest session token was not set on the client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the docblock to include a @return array
annotation to match the new return type.
* @throws MissingSessionTokenException when the guest session token was not set on the client | |
* @throws MissingSessionTokenException when the guest session token was not set on the client | |
* @return array An array containing the list of rated movies. |
Copilot uses AI. Check for mistakes.
No description provided.