Skip to content
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

Fileinfo resources have been converted to objects #6402

Closed
Tracked by #6395
weirdan opened this issue Sep 4, 2021 · 5 comments · Fixed by #6566
Closed
Tracked by #6395

Fileinfo resources have been converted to objects #6402

weirdan opened this issue Sep 4, 2021 · 5 comments · Fixed by #6566
Assignees
Labels
easy problems Issues that can be fixed without background knowledge of Psalm good first issue Help wanted internal stubs/callmap
Milestone

Comments

@weirdan
Copy link
Collaborator

weirdan commented Sep 4, 2021

The fileinfo functions now accept and return, respectively, finfo objects instead of resources.

Guide to editing callmaps: Editing callmaps.
Example of conversion: #6421

@weirdan weirdan added this to the PHP 8.1 milestone Sep 4, 2021
@weirdan weirdan added easy problems Issues that can be fixed without background knowledge of Psalm good first issue Help wanted internal stubs/callmap labels Sep 4, 2021
@tomasnorre
Copy link
Contributor

I would be happy to try doing this.

How can I verify that I'm done and have done it correctly?

@orklah
Copy link
Collaborator

orklah commented Oct 1, 2021

There are tests that checks the integrity of the callmap itself so don't be afraid to break things.
We usually don't add tests for to check for the callmap changes but you totally can if you want. Just add an entry in FunctionCallTest::providerValidCodeParse. You can look for examples where a specific PHP version is set, so when the version is <8.1, fileinfo functions should return a resource (check at the assertions array), but for 8.1, they should return objects.

@tomasnorre
Copy link
Contributor

Thanks, will give it a spin.

@tomasnorre
Copy link
Contributor

Reading the diff, for the example with FTP Functions that is referred.

I don't quite get why the Callmap.php have a change like this.

- 'ftp_alloc' => ['bool', 'ftp'=>'resource', 'size'=>'int', '&w_response='=>'string'],
+ 'ftp_alloc' => ['bool', 'ftp'=>'FTP\Connection', 'size'=>'int', '&w_response='=>'string'],

I would have expected this only to be in the CallMap_81_delta.php.

as I read the https://github.com/vimeo/psalm/blob/master/docs/contributing/editing_callmaps.md#delta-file-format changes should be done in the respective delta version of the callmap e.g. (CallMap_81_delta.php)and not in the CallMap.php itself.

Can you explain this to me?

@orklah
Copy link
Collaborator

orklah commented Oct 2, 2021

CallMap.php contains up to date changes.

Then we take delta files to incrementally replace or remove newer signature by their old ones (when they exist). Then, once every delta file has been applied, we should be left with the exact content of CallMap_historical

So yeah, changes must be made in the two files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy problems Issues that can be fixed without background knowledge of Psalm good first issue Help wanted internal stubs/callmap
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants