You could create an "Empty" interface (or rather, Emptiable since I don't
think you can use Empty):

interface Emptiable
{
    public function isEmpty();
}

Then make your validator accept Emptiable objects along with strings,
arrays, ints, etc.

Maybe you can come up with a better name than Emptiable :)

--
Hector


On Thu, Mar 4, 2010 at 7:29 AM, Alayn Gortazar <al...@irontec.com> wrote:

> El jue, 04-03-2010 a las 16:20 +0100, Giorgio Sironi escribió:
>
> >
> >         I'll take advantage of this thread and ask:
> >         How do you test if an object is empty or not??
> >
> > Actually empty object should not exist as testing for one would break
> > encapsulation. An "empty" object is actually a Null Object pattern:
> > http://en.wikipedia.org/wiki/Null_Object_pattern
> >
>
> So it looks like it has sense not being able to test it with the
> NotEmpty validator...
> :)
>
> --
> Alayn Gortazar
> Irontec, Internet y Sistemas sobre GNU/LinuX - http://www.irontec.com
> +34 94.404.81.82
>
>
>

Reply via email to