Created
November 9, 2009 21:10
-
-
Save tobiastom/230279 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
interface Validator { | |
function validate($value, Error &$error = null); | |
} | |
class ValidatorA implements Validator {} | |
class ValidatorB implements Validator {} | |
class SimpleObject { | |
function foo($baz) { | |
$error = null; | |
foreach($this->validatorList AS $validator) { | |
$validator->validate($baz, $error); | |
} | |
var_dump($error); | |
// type Error | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment