Skip to content

Issue with latest release 6.8.3 #405

@OlegApanovich

Description

@OlegApanovich

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.

  1. In wordpress installation, create a new plugin with wpcli command
    wp scaffold plugin temp-plugin

  2. Go to the newly created plugin directory
    cd wp-content/plugins/temp-plugin

  3. Create a composer.json file there
    touch composer.json

  4. Insert into the composer.json file

{
  "require-dev": {
    "phpstan/phpstan": "^2.1",
    "php-stubs/wordpress-stubs": "^6.8"
  }
}
  1. Create phpstan.neon file
    touch phpstan.neon

  2. Insert into the phpstan.neon file

parameters:
    level: 1
    paths:
        - temp-plugin.php
    scanFiles:
        - vendor/php-stubs/wordpress-stubs/wordpress-stubs.php
  1. Insert into temp-plugin.php file for testing purposes one new line
    wp_get_available_translations();

  2. Run the command
    composer install

  3. Right now, launch the php stan check
    php vendor/bin/phpstan analyse

  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions