nette / schema

📐 Validating data structures against a given Schema.
https://doc.nette.org/schema
Other
905 stars 26 forks source link

`Expect::anyOf` should not disable `before()` #18

Closed ViliamKopecky closed 3 years ago

ViliamKopecky commented 4 years ago

Version: v1.0.2

Bug Description

before() helper is not called on things nested in Expect::anyOf.

Steps To Reproduce

test(function() { // normalization through anyOf
    $schema = Expect::anyOf(Expect::string()->before(function($v) {
        return (string) $v;
    }));
    Assert::same('1',  $schema->normalize(1, new Context));
});

Expected Behavior

before() should work consistently inside anyOf.