Hi Mike,
Your suggested solution would certainly improve the situation in my
view. But I see two drawbacks:
1. The syntax is nicely simple but somewhat counter-intuitive. The
docs can explain it, of course.
It's just not the sort of obvious feature which everyone would expect
to be there and work they way it does.
2. Stubbing all calls to "foo()" with a first arg of 'bar' regardless
of any further args will still require
a completely different and rather lengthy syntax, althogh in fact it
is just a variation of the "any call to foo"
case.
I didn't know Mockito, let alone that Phake was based on it (my
exposure to Java mostly dates back to the last millennium, and I've
been more of a C++-guy anyway... :-).
I respect your wish to mimic Mockito as closely as practicable in PHP.
But I also believe that modelling something new
after a good existing project provides the unique chance of making it
even better in ways that cannot be applied to the
original project because of backwards compatibility requirements. A
good example for this might be Twig, which is based on an early
version of the Django template engine.
So I would raise the question, whether the behaviour criticized in my
last post is actually a flaw in Mockito
and whether Phake could do better...
Cheers,
Stan