refactor(compat): Prüfbausteine nach src/Compatibility, Matrix und ManifestCheck generisch
Requirement, Call, ConstantRequirement, Mirror, Problem, FeatureStatus, CompatibilityMatrix, Manifest, ManifestCheck sowie Fingerprints und LineDiff liegen jetzt im divi-freien Kern. Neu: GlobalRequirement, CompatibilityMatrix::fromProblems(), ManifestCheck-Option signatures, DiviManifestCheck::create() und DiviAreas. Divi-Verhalten unverändert. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9beb55e228
commit
b511ef6348
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace LIT\MCP\Compatibility;
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
/**
|
||||
* A function of a third-party plugin or theme whose logic an adapter repeats instead of calling it (spec §4.1
|
||||
* "mirrors"). Its fingerprint (SourceFingerprint) must match the one in fingerprints.json, else the third-party code
|
||||
* changed what we copy.
|
||||
*/
|
||||
final class Mirror implements Requirement
|
||||
{
|
||||
/**
|
||||
* @param string $id Key in fingerprints.json and name of its reference source (the Divi integration
|
||||
* keeps them in tests/Fixtures/divi/reference/<id>.txt – an example, not a rule).
|
||||
* @param string $file File of the third-party code, relative to its plugin or theme directory.
|
||||
* @param string $function Function or method name.
|
||||
* @param string|null $class Class of a method – the short name is enough (the file fixes where it
|
||||
* lives, and a short name is no external name for DiviBoundaryTest); null for a
|
||||
* function.
|
||||
* @param string $what What the plugin repeats (German, for reports).
|
||||
* @param list<Capability> $features [] = the default of the manifest.
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly string $id,
|
||||
public readonly string $file,
|
||||
public readonly string $function,
|
||||
public readonly ?string $class,
|
||||
public readonly string $what,
|
||||
private readonly array $features = []
|
||||
) {
|
||||
}
|
||||
|
||||
public function features(): array
|
||||
{
|
||||
return $this->features;
|
||||
}
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
$class = $this->class === null ? '' : SourceFingerprint::shortName($this->class) . '::';
|
||||
|
||||
return $class . $this->function . '()';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user