Fix code quality issues and update PHPStan configuration

This commit is contained in:
2025-04-21 21:05:50 +01:00
parent 47d77c6451
commit e8d81ef45b
4 changed files with 33 additions and 6 deletions

View File

@@ -77,4 +77,22 @@ class Plugin {
dirname( plugin_basename( $this->pluginFile ) ) . '/languages/' dirname( plugin_basename( $this->pluginFile ) ) . '/languages/'
); );
} }
/**
* Get the plugin version.
*
* @return string The plugin version.
*/
public function get_version(): string {
return $this->version;
}
/**
* Get the admin instance.
*
* @return Admin The admin instance.
*/
public function get_admin(): Admin {
return $this->admin;
}
} }

View File

@@ -5,6 +5,8 @@
* Version: 1.0.0 * Version: 1.0.0
* Author: WPALLSTARS * Author: WPALLSTARS
* License: GPL-2.0-or-later * License: GPL-2.0-or-later
*
* @package WPPluginStarterTemplate
*/ */
// Exit if accessed directly. // Exit if accessed directly.

View File

@@ -5,7 +5,14 @@ parameters:
- admin - admin
- wp-plugin-starter-template.php - wp-plugin-starter-template.php
excludePaths: excludePaths:
paths: analyse:
- vendor
- node_modules
- tests
- bin
- build
- dist
analyseAndScan:
- vendor - vendor
- node_modules - node_modules
- tests - tests

View File

@@ -31,7 +31,7 @@ if ( ! defined( 'WPINC' ) ) {
die; die;
} }
// Define plugin constants // Define plugin constants.
define( 'WP_PLUGIN_STARTER_TEMPLATE_FILE', __FILE__ ); define( 'WP_PLUGIN_STARTER_TEMPLATE_FILE', __FILE__ );
define( 'WP_PLUGIN_STARTER_TEMPLATE_PATH', plugin_dir_path( __FILE__ ) ); define( 'WP_PLUGIN_STARTER_TEMPLATE_PATH', plugin_dir_path( __FILE__ ) );
define( 'WP_PLUGIN_STARTER_TEMPLATE_URL', plugin_dir_url( __FILE__ ) ); define( 'WP_PLUGIN_STARTER_TEMPLATE_URL', plugin_dir_url( __FILE__ ) );
@@ -40,8 +40,8 @@ define( 'WP_PLUGIN_STARTER_TEMPLATE_VERSION', '0.1.13' );
// Load the main plugin class. // Load the main plugin class.
require_once WP_PLUGIN_STARTER_TEMPLATE_PATH . 'includes/class-plugin.php'; require_once WP_PLUGIN_STARTER_TEMPLATE_PATH . 'includes/class-plugin.php';
// Plugin is multisite compatible - see .wiki/Testing-Framework.md for testing instructions // Plugin is multisite compatible - see .wiki/Testing-Framework.md for testing instructions.
// For multisite-specific functionality, see the includes/Multisite directory // For multisite-specific functionality, see the includes/Multisite directory.
// Initialize the plugin and store the instance in a global variable. // Initialize the plugin and store the instance in a global variable.
$wpst_plugin = new WPALLSTARS\PluginStarterTemplate\Plugin( __FILE__, WP_PLUGIN_STARTER_TEMPLATE_VERSION ); $wpst_plugin = new WPALLSTARS\PluginStarterTemplate\Plugin( __FILE__, WP_PLUGIN_STARTER_TEMPLATE_VERSION );