-
-
Notifications
You must be signed in to change notification settings - Fork 21
Description
For some reason, latest wordpress-stubs 6.8.3 started not to see all worpress functions in php version 7.4. Working fine with php 8.0 and above or wordpress-stubs 6.8.2 or below.
Environment:
PHP 7.4 version
Wordpress 6.8.3 version
Path to recreate.
-
In wordpress installation, create a new plugin with wpcli command
wp scaffold plugin temp-plugin -
Go to the newly created plugin directory
cd wp-content/plugins/temp-plugin -
Create a composer.json file there
touch composer.json -
Insert into the composer.json file
{
"require-dev": {
"phpstan/phpstan": "^2.1",
"php-stubs/wordpress-stubs": "^6.8"
}
}
-
Create phpstan.neon file
touch phpstan.neon -
Insert into the phpstan.neon file
parameters:
level: 1
paths:
- temp-plugin.php
scanFiles:
- vendor/php-stubs/wordpress-stubs/wordpress-stubs.php
-
Insert into temp-plugin.php file for testing purposes one new line
wp_get_available_translations(); -
Run the command
composer install -
Right now, launch the php stan check
php vendor/bin/phpstan analyse -
Observe the issue, there is an error in phpstan analysis
Note: Using configuration file /var/www/html/wp-content/plugins/temp-plugin/phpstan.neon.
1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
------ ----------------------------------------------------------------------
Line temp-plugin.php
------ ----------------------------------------------------------------------
18 Function wp_get_available_translations not found.
🪪 function.notFound
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols