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

Fix oci8 stubs for PHP 8 #5478

Merged
merged 1 commit into from
Mar 25, 2021
Merged

Fix oci8 stubs for PHP 8 #5478

merged 1 commit into from
Mar 25, 2021

Conversation

morozov
Copy link
Contributor

@morozov morozov commented Mar 25, 2021

As of php/php-src@74ca2a3, the OCI-Lob and OCI-Collection classes are named as OCILob and OCICollection respectively.

This is related to #5465 but fixes the issue only on PHP 8 and only when the extension is loaded. If I add the difference between PHP 8 and PHP 7.4 to the stubs and run Psalm with php-version=7.3, it will start failing on PHP 8. Fixing this issue is out of the scope of this PR.

It looks like apart from stubbing method signatures, Psalm should stub the OCI-/OCI classes if the runtime version is different from the analyzer version:

if (PHP_VERSION_ID >= 80000 && $codebase->php_major_version < 8) {
    class OCI-Lob { /* ... */}
}

if (PHP_VERSION_ID < 80000 && $codebase->php_major_version >= 8) {
    class OCILob { /* ... */}
}

@muglug
Copy link
Collaborator

muglug commented Mar 25, 2021

@morozov
Copy link
Contributor Author

morozov commented Mar 25, 2021

@muglug please see the description:

If I add the difference between PHP 8 and PHP 7.4 to the stubs and run Psalm with php-version=7.3, it will start failing on PHP 8.

@muglug muglug merged commit b627962 into vimeo:master Mar 25, 2021
@muglug
Copy link
Collaborator

muglug commented Mar 25, 2021

Oh OK sorry. I hate that bloody hyphen.

@morozov morozov deleted the issues/5465 branch March 25, 2021 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants