mirror of
https://github.com/Respect/Validation.git
synced 2026-03-16 15:25:45 +01:00
Extract CodeGen namespace from LintMixinCommand
Replace hardcoded validator class lists with a declarative #[Mixin] attribute and extract the mixin generation logic into a reusable CodeGen namespace under src-dev/CodeGen/. The new MixinGenerator discovers prefix definitions and filtering rules by scanning #[Mixin] attributes on the target namespace's classes, removing the need for hardcoded configuration. It supports configurable interface types (Builder for __callStatic, Chain for __call) with custom suffixes, return types, and root extends. This is the first step toward extracting the code generation into a standalone package that can map __call/__callStatic to any namespace, possibly for Respect/StringFormatter and any kind of project in the future.
This commit is contained in:
parent
317ffef4b7
commit
91fb70fd11
44 changed files with 671 additions and 334 deletions
28
src-dev/CodeGen/InterfaceConfig.php
Normal file
28
src-dev/CodeGen/InterfaceConfig.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-License-Identifier: MIT
|
||||
* SPDX-FileCopyrightText: (c) Respect Project Contributors
|
||||
* SPDX-FileContributor: Alexandre Gomes Gaigalas <alganet@gmail.com>
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Respect\Dev\CodeGen;
|
||||
|
||||
final readonly class InterfaceConfig
|
||||
{
|
||||
/**
|
||||
* @param array<string> $rootExtends
|
||||
* @param array<string> $rootUses
|
||||
*/
|
||||
public function __construct(
|
||||
public string $suffix,
|
||||
public string $returnType,
|
||||
public bool $static = false,
|
||||
public array $rootExtends = [],
|
||||
public string|null $rootComment = null,
|
||||
public array $rootUses = [],
|
||||
) {
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue