api
api copied to clipboard
Reintroduce PHPStan
This reintroduces a modern version of PHPStan.
I made some mostly straightforward fixes to get PHPStan to pass Level 2 with no ignored errors.
Most of the changes are adding more specific return types and fixes to PHPDoc types. There are a few fixes to methods that fail to return anything in unexpected cases.
There's one clear code removal that I made in lib/Tmdb/Factory/TvFactory.php. It had a getContentRatingsFactory(), setContentRatingsFactory(), and $contentRatingsFactory property, but it seems like that was never actually used and the type it used (ContentRatingsFactory) doesn't exist.
I would like to increase the PHPStan Level to something greater in the future, but this was relatively low effort.
I also suspect that dropping PHP 7 would make further improvements easier (e.g. less DocBlock comments and more native typehints).
Codecov Report
Merging #257 (a84c9a4) into 4.1 (af52c60) will increase coverage by
0.02%. The diff coverage is74.28%.
@@ Coverage Diff @@
## 4.1 #257 +/- ##
============================================
+ Coverage 81.46% 81.49% +0.02%
+ Complexity 2251 2249 -2
============================================
Files 202 202
Lines 5515 5516 +1
============================================
+ Hits 4493 4495 +2
+ Misses 1022 1021 -1
| Impacted Files | Coverage Δ | |
|---|---|---|
| lib/Tmdb/Api/Authentication.php | 26.92% <0.00%> (-2.25%) |
:arrow_down: |
| lib/Tmdb/Client.php | 90.00% <0.00%> (ø) |
|
| lib/Tmdb/Event/HydrationEvent.php | 52.00% <ø> (ø) |
|
| ...mdb/Event/Listener/Logger/LogHydrationListener.php | 100.00% <ø> (ø) |
|
| lib/Tmdb/Event/RequestEvent.php | 77.27% <ø> (ø) |
|
| lib/Tmdb/Event/ResponseEvent.php | 100.00% <ø> (ø) |
|
| lib/Tmdb/Exception/TmdbApiException.php | 100.00% <ø> (ø) |
|
| lib/Tmdb/Factory/Common/VideoFactory.php | 30.00% <0.00%> (-1.58%) |
:arrow_down: |
| lib/Tmdb/Factory/TvEpisodeGroupFactory.php | 0.00% <0.00%> (ø) |
|
| lib/Tmdb/Factory/TvEpisodeGroupsFactory.php | 0.00% <0.00%> (ø) |
|
| ... and 104 more |
:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more
Cheers @neildaniels , sorry it took me a while again as usual :-)