Skip to content

ParseError on PHP 7.4 #304

@krollobrocket

Description

@krollobrocket

Using PHP 7.4 I am getting the following error when running phpstan with the phpstan-wordpress extension enabled:

ParseError thrown in vendor/php-stubs/wordpress-stubs/wordpress-stubs.php on line 7343 while loading bootstrap file vendor/php-stubs/wordpress-stubs/wordpress-stubs.php: syntax error, unexpected '{', expecting variable (T_VARIABLE)

This is my phpstan.neon file:

parameters:
	level: 2
	bootstrapFiles:
		- bootstrap.php
	paths:
		- src
	excludePaths:
	    - src/Vendor/
	ignoreErrors:
		- '#Using self outside of class scope.#'
		- '#WP_CLI#'
		- '#Variable \$\w+ might not be defined.#'
		- '#Calling self::\w+\(\) outside of class scope.#'
		- '#Function pll_(.*) not found.#'
includes:
	- vendor/szepeviktor/phpstan-wordpress/extension.neon

and this is my output from php -v:

PHP 7.4.33 (cli) (built: Oct 11 2025 23:03:42) ( NTS )

I am using the following:

  • phpstan 2.1.32
  • phpstan-wordpress 2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions