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
tests: add test that validates the callmap in the current runtime #8104
Conversation
This comment was marked as duplicate.
This comment was marked as duplicate.
Might be worth trying to scrape the documentation like #8000 as well. If reflection and documentation disagree we can see whether we need to open a documentation issue or ignore reflection for that case. |
Looking good so far! A lot of these we'll have to look at the documentation or test to see if we need to add a change to one of the version diffs or if the callmap was always incorrect and the historical one needs changed. |
Yeah I'm liking it as well. Just an FYI regarding your comments on the change maps. So I hope someone else is willing to do the manual fixes for the other version diffs. Note that this test code can also be run on PHP8 to identify issues with the callmap (which can then be fixed in the diff). |
It is. Unfortunately, the way callmap works is that changing callmap is not enough. Callmap.php should always match with another Callmap file in which the signature was introduced. So you're forced to either pick the correct version, or to change Callmap_historical (which will break signatures for old versions that didn't change) |
When running on the current version though, the historical file and diffs are not used. They are only used in downgrading the callmap (if i understand correctly). So this will work just fine on php 8.1 and fixing it to work on old version is something someone else will hopefully have motivation for. Note that many (100+ of the fixes in the callmap) changes were already broken to begin with for older PHP versions, we just didn't know. |
Is there some internal psalm function that will tell me if 2 types are compatible? Currently I'm using my own poor man's parser, but im thinking it probably already exists somewhere else. |
You can use UnionTypeComparator::isContainedBy to check if an union is contained completely in another. Type;;parseString should give you an union from a string |
@orklah to get this ready for merged I've chosen the following approach:
If you'd be so kind to add a release label then all tests will pass. Currently this the test file has ~2355 tests (in my docker container that has all possible php extensions enabled), of which 1167 are skipped. Next steps are to incrementally remove functions and prefixes from the ignore list and fix their definitions in the callmap & diff files. This can be done by anyone looking for simple improvements. |
Cool! Could you open an issue explaining how to tackle a function so we can redirect contributors to it when needed? |
We should probably update the callmap guide. |
Test for #8101
I'm aware that more specific return types are won't be validated by this tester; this is still a WIP.
The idea is that we can at least fail on things that are guaranteed to be wrong.