symfony/symfony — pull request #4713 by jeanmonod (2012-07-03 05:35:41+00:00)
Title: Config component: Add a new expression ->ifFalse() to the ExprBuilder

This PR allow to write validator like this:

->scalarNode('foo')
->validate()
->ifFalse(function($v){return is_int($v)})
->thenInvalid('Must be an integer')
->end()
->end()

Instead of the actual double negation:

->scalarNode('foo')
->validate()
->ifTrue(function($v){return ! is_int($v)})
->thenInvalid('Must be an integer')
->end()
->end()