*/ public readonly array $constants; /** * @param string $area Area label for reports (the Divi integration: DiviAreas). * @param list $calls Functions and static methods the adapter calls. * @param list $constants Constants it reads; a plain name stands for a * ConstantRequirement without features of its own. * @param list $postTypes Post types it needs registered. * @param list $taxonomies Taxonomies it needs registered. * @param list $blockTypes Block types it needs (registered or known * to the ManifestCheck knowsBlock closure). * @param list $keys Other names it uses as strings: meta keys, options, * internal post types that need no registration check, * query arguments. * @param list $mirrors Functions whose storage logic it repeats. * @param list $features The features of every call, mirror and constant that names * none itself (featuresOf()). * @param list $globals Global variables it reads (isset check). */ public function __construct( public readonly string $area, public readonly array $calls = [], array $constants = [], public readonly array $postTypes = [], public readonly array $taxonomies = [], public readonly array $blockTypes = [], public readonly array $keys = [], public readonly array $mirrors = [], public readonly array $features = [], public readonly array $globals = [] ) { $this->constants = array_map( static fn (string|ConstantRequirement $constant): ConstantRequirement => is_string($constant) ? new ConstantRequirement($constant) : $constant, array_values($constants) ); } /** @return list Calls, constants, mirrors and globals – everything the release gate checks as code. */ public function requirements(): array { return [...$this->calls, ...$this->constants, ...$this->mirrors, ...$this->globals]; } /** @return list The features $requirement names itself, else this manifest's default. */ public function featuresOf(Requirement $requirement): array { $own = $requirement->features(); return $own !== [] ? $own : $this->features; } /** * @return list Every external name the adapter's code may contain (DiviBoundaryTest): called functions and * classes, constants, globals, post types, taxonomies, keys and the names of mirrored functions. */ public function names(): array { $names = []; foreach ($this->calls as $call) { $names[] = $call->className() ?? $call->member(); } $constants = array_map(static fn (ConstantRequirement $constant): string => $constant->name, $this->constants); $mirrored = array_map(static fn (Mirror $mirror): string => $mirror->function, $this->mirrors); return array_values(array_unique(array_merge( $names, $constants, array_map(static fn (GlobalRequirement $global): string => $global->name, $this->globals), $this->postTypes, $this->taxonomies, $this->keys, $mirrored ))); } }