-
-
Notifications
You must be signed in to change notification settings - Fork 30
Most constants for paths like are set incorrectly #282
Copy link
Copy link
Closed
Description
Hello there,
I just noticed in vendor/szepeviktor/phpstan-wordpress/bootstrap.php that the constants that describe the paths are incorrect set in this stubs library.
define('WP_PLUGIN_DIR', './');
define('WPMU_PLUGIN_DIR', './');
define('WP_LANG_DIR', './');
define('WP_CONTENT_DIR', './');ABSPATH is set correctly with a trailing slash.
WP_PLUGIN_DIR and WPMU_PLUGIN_DIR and WP_LANG_DIR are set in WP itself without a trailing slash in wp-includes/default-constants.php:
if ( ! defined( 'WP_CONTENT_DIR' ) ) {
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // No trailing slash, full paths only - WP_CONTENT_URL is defined further down.
}
/**
* Allows for the plugins directory to be moved from the default location.
*
* @since 2.6.0
*/
if ( ! defined( 'WP_PLUGIN_DIR' ) ) {
define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // Full path, no trailing slash.
}
/**
* Allows for the mu-plugins directory to be moved from the default location.
*
* @since 2.8.0
*/
if ( ! defined( 'WPMU_PLUGIN_DIR' ) ) {
define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // Full path, no trailing slash.
}
define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' );This results in incorrect reporting in PhpStorm when PHPStan is configured:
IMO, in bootstrap.php the paths should be modified:
define('WP_CONTENT_DIR', './wp-content');
define('WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins');
define('WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins');
define('WP_LANG_DIR', WP_CONTENT_DIR . '/languages');Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels