Request->getHeader() should always return a string#7813
Conversation
| } | ||
|
|
||
| return null; | ||
| return ''; |
There was a problem hiding this comment.
Not really - the public API says: @return string
There was a problem hiding this comment.
Actually this fixes the public API, because you can see, that many apps use it like it will always return a string.
There was a problem hiding this comment.
apart from apps that checked the actual return instead of trusting the docs :D
There was a problem hiding this comment.
well we should communicate all this properly. But at some point we want to fix the code. I would vote to actually cleanup the code. It is not like we have a million apps that depend on all this.
There was a problem hiding this comment.
sure, I was just saying that "communicate" is the important word.
I'd really like to use @nextcloud/maintainers or something like that to mention such important cases.
There was a problem hiding this comment.
Let us collect this in a separate ticket for 14. Because I guess there will be more to come.
b0bf116 to
fc576cd
Compare
Codecov Report
@@ Coverage Diff @@
## master #7813 +/- ##
============================================
+ Coverage 51.23% 51.23% +<.01%
Complexity 24919 24919
============================================
Files 1604 1604
Lines 94966 94969 +3
Branches 1376 1376
============================================
+ Hits 48656 48659 +3
Misses 46310 46310
|
|
still fail ;) |
fe4ab92 to
90495c1
Compare
PHPDoc (of the public API) says that this method returns string but it also returns null, which is not allowed in some method calls. This fixes that behaviour and returns an empty string and fixes all code paths that explicitly checked for null to be still compliant. Found while enabling the strict_typing for lib/private for the PHP7+ migration. Signed-off-by: Morris Jobke <[email protected]>
90495c1 to
4ef302c
Compare
|
Fixed the tests. |
PHPDoc (of the public API) says that this method returns string but it also returns null, which is not allowed in some method calls. This fixes that behaviour and returns an empty string and fixes all code paths that explicitly checked for null to be still compliant.
Found while enabling the strict_typing for lib/private for the PHP7+ migration. (#7392)
The only app that uses this as well is activity and I will create a PR for that as well.