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

PHP8.1 "readonly" function #20

Closed
kkmuffme opened this issue Nov 16, 2021 · 3 comments
Closed

PHP8.1 "readonly" function #20

kkmuffme opened this issue Nov 16, 2021 · 3 comments

Comments

@kkmuffme
Copy link

As of PHP 8.1 "readonly" is a reserved keyword.

WP has a "function readonly" (as of WP 5.9/trunk it will be moved to the php-compat file and renamed in the main file).

Problem however:
the "readonly" function will be there in WP 5.9 stubs still (since it's still in WP core, just in php-compat file).

if you run psalm (phpstan?) with phpVersion=8.1, this will however trigger multiple ParseError for the stubs
(e.g. Syntax error, unexpected ')' on line 98413)

@szepeviktor
Copy link
Member

szepeviktor commented Nov 16, 2021

Hello @kkmuffme!
As you may know WordPress and this package are not 100% PHP 8 compatible.

All I have for you is as follows.

sed -i -e 's#function readonly#function __readonly#' vendor/php-stubs/wordpress-stubs/wordpress-stubs.php

@szepeviktor
Copy link
Member

the "readonly" function will be there in WP 5.9 stubs still

Good news! All compat files are excluded.
I pre-exclude php-compat for you.

@szepeviktor
Copy link
Member

szepeviktor commented Nov 16, 2021

Thank you for opening this issue!

48bb8a3

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

No branches or pull requests

2 participants