news
news copied to clipboard
Fix/php8.1 depreciation
This is supposed to fix all the deprication warnings of php 8.1 that I can find. It seems like mainly to be that you can't pass null to a method that expects a string. Old behaviour of these methods was to interpret null as ""
which then is usually also the output.
This will change the api behavior same like the change for the author did. Even though it was never declared I think it is fair to put this into news 19.0.0 as major change.
To fix the docs gap I also checked which attributes of an item are exposed via the api sorted alphabetically and added default + type info. Most types default will probably be null. But I didn't want to put that because I wasn't sure.
Codecov Report
Merging #1861 (be4cf4e) into master (fca05d5) will decrease coverage by
0.13%
. The diff coverage is89.70%
.
@@ Coverage Diff @@
## master #1861 +/- ##
============================================
- Coverage 91.62% 91.49% -0.14%
- Complexity 778 793 +15
============================================
Files 65 65
Lines 2724 2776 +52
============================================
+ Hits 2496 2540 +44
- Misses 228 236 +8
Impacted Files | Coverage Δ | |
---|---|---|
lib/Db/ItemMapperV2.php | 98.51% <60.00%> (-1.49%) |
:arrow_down: |
lib/Service/FeedServiceV2.php | 97.80% <81.81%> (-2.20%) |
:arrow_down: |
lib/Fetcher/FeedFetcher.php | 80.62% <95.00%> (+0.89%) |
:arrow_up: |
lib/Db/Item.php | 100.00% <100.00%> (ø) |
|
lib/Utility/OPMLExporter.php | 100.00% <100.00%> (ø) |
|
lib/Command/ExploreGenerator.php | 100.00% <0.00%> (ø) |
|
lib/Explore/RecommendedSites.php | 0.00% <0.00%> (ø) |
|
lib/Controller/FeedController.php | 100.00% <0.00%> (ø) |
|
lib/Controller/PageController.php | 100.00% <0.00%> (ø) |
|
lib/Fetcher/Client/FeedIoClient.php | 100.00% <0.00%> (ø) |
|
... and 4 more |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
While doing some research I found that phpstan can also scan for deprecation declarations. So I added that, quite useful for nextcloud server deprecations.
I think now I fixed every php deprecation warning I found regarding null as input for a function that expexts string doesn't make the code prettier but ok.
I'm thinking that the json that we export should maybe only contain strings and just convert null into empty strings.
I'm thinking that the json that we export should maybe only contain strings and just convert null into empty strings.
In my opinion null
is fine (and a valid JSON type) and the importing software could convert it itself into an empty string if necessary. Replacing all null values would also conflict with our own import (e.g. should the field be NULL or just empty in the database).
In fact, we have recently switched from an empty string to null in the API ourself.
Okay then we keep it this way :)
You apparently overwrote some changes while force-pushing .. the latest suggested changes in OPMLExporter.php and Item.php are missing in the merged commit.
Oh unlucky I guess my rebase was not correct :( I will try to fix it.