-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add phpstan-phpunit phpstan-strict-rules to phpstan analysis #90
Conversation
Codecov Report
@@ Coverage Diff @@
## master #90 +/- ##
==========================================
- Coverage 98.80% 97.72% -1.09%
==========================================
Files 1 1
Lines 168 176 +8
==========================================
+ Hits 166 172 +6
- Misses 2 4 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
I will have a go at refactoring these. But it often seems a bit painful to remove use of |
if you don't see value in changing existing code, or don't have time todo it now, feel free to create a baseline for them. |
cc7f6f2
to
a94f34d
Compare
$authority = $parts['host']; | ||
if (!empty($parts['user'])) { | ||
if (isset($parts['user'])) { |
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.
These changes from !empty()
to isset()
now allow the value to be "0".
I added unit test cases for ways that I could see that the value of these things might be "reasonably" passed in as the value "0". For example, a user "name" might be the string "0"! Or the query string could be just ?0
(very edge case - an application that just sends a number in the query string). Or the fragment could be #0
. All of those unit test cases fail with the !empty()
check, and pass with isset()
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.
Note: we need to use isset()
because the $parts
array passed to build()
may not have all the component keys set.
In other places we could compare directly to null
because resolve()
, normalize()
etc. we guarantee that all the URI components are actually set in the array (and "missing" components are set to value null
@staabm please review. |
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.
lgtm - except a few nits
thank you
I broke a heap of unit tests - I will look... |
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.
lgtm
see my comments - fixes a few edge-cases when a URI component might be the string "0" (path, username, query, fragment...). These are not really common in everyday use!
Gets the strict phpstan rules passing.