diff --git a/packages/php/compat-checker/src/Checker.php b/packages/php/compat-checker/src/Checker.php index 68d52710..26177f27 100644 --- a/packages/php/compat-checker/src/Checker.php +++ b/packages/php/compat-checker/src/Checker.php @@ -71,14 +71,15 @@ public function get_plugin_data( $plugin_file, $file_version ) { * @return bool */ public function is_compatible( $plugin_file_path, $file_version ) { - $checks = array( + $checks = array( WPCompatibility::class, WCCompatibility::class, ); - $plugin_data = $this->get_plugin_data( $plugin_file_path, $file_version ); + $plugin_data = $this->get_plugin_data( $plugin_file_path, $file_version ); + $plugin_basename = plugin_basename( $plugin_file_path ); foreach ( $checks as $compatibility ) { - if ( ! $compatibility::instance()->is_compatible( $plugin_data ) ) { + if ( ! $compatibility::instance( $plugin_basename )->is_compatible( $plugin_data ) ) { return false; } } diff --git a/packages/php/compat-checker/src/Checks/CompatCheck.php b/packages/php/compat-checker/src/Checks/CompatCheck.php index 67d48cba..9e01f037 100644 --- a/packages/php/compat-checker/src/Checks/CompatCheck.php +++ b/packages/php/compat-checker/src/Checks/CompatCheck.php @@ -47,15 +47,17 @@ abstract protected function run_checks(); /** * Get the instance of the CompatCheck object. * + * @param string $plugin_basename The basename of the plugin. + * * @return CompatCheck */ - public static function instance() { + public static function instance( $plugin_basename ) { $class = get_called_class(); - if ( ! isset( self::$instances[ $class ] ) ) { - self::$instances[ $class ] = new $class(); + if ( ! isset( self::$instances[ $class ][ $plugin_basename ] ) ) { + self::$instances[ $class ][ $plugin_basename ] = new $class(); } - return self::$instances[ $class ]; + return self::$instances[ $class ][ $plugin_basename ]; } /**