membrane-php / membrane-core

Membrane is a general purpose input validation library, supports both PHP Attributes and OpenAPI specifications
Other
1 stars 2 forks source link

Filters, Processors and Validators can be cast to PHP code #86

Closed charjr closed 1 year ago

charjr commented 1 year ago

Work towards #80

merge https://github.com/membrane-php/membrane-core/pull/84 and https://github.com/membrane-php/membrane-core/pull/85 first

Filter, Validator interfaces now must have the __toPHP() method.

carnage commented 1 year ago

Has many conflicts :/

I think it would also be worth writing some functional tests which test that the generated php code is valid eg

$sut = new Validator();
$code = $sut->__toPHP();
$result = eval($code);

self::assertEquals($sut, $result);