refactor(compat): Capability-Interface, DiviFeature implementiert es

Grundlage der generischen Kompatibilitätsschicht für Fremd-Plugins mit inoffiziellen Schnittstellen (Plan docs/superpowers/plans/2026-11-06-kompatibilitaetsschicht.md).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jan-Niclas Loosen
2026-11-06 12:03:30 +01:00
co-authored by Claude Opus 5.5
parent 691231f776
commit 9beb55e228
4 changed files with 147 additions and 1 deletions
+23
View File
@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace LIT\MCP\Compatibility;
defined('ABSPATH') || exit;
/**
* One capability of an integration that a third-party plugin update may break separately. id() is unique across all
* integrations, so a bare ID is enough to find its capability.
*/
interface Capability
{
/** Stable, globally unique ID such as 'page-read' or 'pods-field-write'. */
public function id(): string;
/** Name for messages and the admin tab (German). */
public function label(): string;
/** Whether the capability changes data. */
public function isWrite(): bool;
}
@@ -4,6 +4,8 @@ declare(strict_types=1);
namespace LIT\MCP\Integrations\Divi\Release;
use LIT\MCP\Compatibility\Capability;
defined('ABSPATH') || exit;
// The installed PHPCompatibility sniffs predate enums (PHP 8.1) and read their methods as plain functions.
@@ -13,7 +15,7 @@ defined('ABSPATH') || exit;
* What the plugin can do with Divi, as far as a Divi update may break it separately: every manifest entry (call,
* mirror, constant) belongs to one or more features, and the release gate decides per feature.
*/
enum DiviFeature: string
enum DiviFeature: string implements Capability
{
case PageRead = 'page-read';
case PageWrite = 'page-write';
@@ -32,6 +34,11 @@ enum DiviFeature: string
case ThemeBuilderRead = 'tb-read';
case ThemeBuilderWrite = 'tb-write';
public function id(): string
{
return $this->value;
}
/** Whether the feature changes data (the seven *Write cases and FontUpload). */
public function isWrite(): bool
{