memio/linter
Memio Linter provides a set of Memio Validator constraints to lint Memio models for syntax and structural issues. Use it standalone or as part of the Memio code generator to validate arguments, methods, contracts, objects, files, and collections.
ContractMethodsCanOnlyBePublic). This creates a fundamental architectural mismatch unless the team is already using Memio’s ecosystem.MethodCannotBeAbstractAndHaveBody) could be extracted and adapted, but this would involve:
Illuminate\Database\Eloquent\Model) rather than Memio’s Model interface.phpstan:baseline, pint, laravel-pint).ContractValidator, ObjectValidator), making it non-plug-and-play for Laravel. Risk of breaking changes if Memio’s API evolves, which could block Laravel integrations.CollectionCannotHaveNameDuplicates may not apply to Laravel’s collections (e.g., Eloquent hasMany relationships), leading to irrelevant validation errors or missed issues.MethodCannotBeAbstractAndHaveBody as a custom PHPStan rule or Laravel trait.make:model: Generates Eloquent models with built-in validation patterns.EnsuresNoAbstractMethodsWithBodies).- name: Run Memio Linter
run: |
docker-compose up -d memio
vendor/bin/memio linter validate app/Models/MemioGenerated/
MethodCannotBeAbstractAndHaveBody) and rewrite them using Laravel’s reflection or custom traits.ContractMethodsCanOnlyBePublic do not apply to Eloquent’s Model class.// Custom trait to replicate a Memio constraint
trait EnsuresNoAbstractMethodsWithBodies {
public static function validate(): void {
foreach (get_class_methods(static::class) as $method) {
$reflection = new ReflectionMethod(static::class, $method);
if ($reflection->isAbstract() && $reflection->getBody()) {
throw new \RuntimeException("Method {$method} cannot be abstract and have a body.");
}
}
}
}
How can I help you explore Laravel packages today?