-
Notifications
You must be signed in to change notification settings - Fork 282
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
Use readonly properties for model classes #217
Conversation
oschwald
commented
Oct 31, 2023
- Drop 8.0 support. Test on 8.2.
- Use readonly properties
- Only include set fields in jsonSerlialize output
- Upgrade to phpunit 10
- Use vendor/autoload.php to bootstrap directly
- Do not include name in JSON output
- Make ipAddress and network nullable
This is more similar to the previous version and the output is much more usable, particularly for things like Country.
a3c8dbf
to
ee920df
Compare
This makes is more similar to the web-service response.
This is needed for minFraud.
Previously this was not possible as we were using magic methods.
ee920df
to
59aab5d
Compare
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.
Just had a few comments.
phpunit.xml.dist
Outdated
</testsuite> | ||
</testsuites> | ||
<logging/> | ||
<source> |
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.
I don't think there is a <source>
tag. Did you mean <coverage>
? https://docs.phpunit.de/en/10.0/configuration.html#the-include-element
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.
Given that phpunit
generated it, I assume it is valid, but I'll see if I can clean it up.
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.
There is an example of its usage in their repo.
See this issue.
phpunit.xml.dist
Outdated
<logging/> | ||
<source> | ||
<include> | ||
<directory suffix=".php">./src/GeoIp2/</directory> |
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.
Is the ..../GeoIp2
extra in here ? I can't see the directory within src
.
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.
I think that predates our switch to PSR-4. I'll clean it up.
new \GeoIp2\Record\Subdivision($sub, $locales) | ||
; | ||
} | ||
|
||
// Not using end as we don't want to modify internal pointer. |
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.
Would array_key_last
help with this ?
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.
Yes, but that would just turn it to $subdivisions[\array_key_last($subdivisions)]
. I am not sure that is a big improvement. I am guessing it would be slower and might make people think it is an associative array as opposed to an indexed one.
phpunit.xml.dist
Outdated
<directory suffix="Test.php">./tests/GeoIp2/Test/</directory> | ||
</testsuite> | ||
</testsuites> | ||
<logging/> |
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.
Do we need this tag if it doesn't configure anything ?
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 are the result of phpunit --migrate-configuration
. I didn't modify the file by hand.