Why are there so many assertions in Zurmo and why are the assertions sometimes in quotes and sometimes not?

The main purpose of adding assertions:

1.  Forces stronger type casting.

2. Tightens methods by ensuring the parameters are correctly passed

3. Adds a form of documentation that is easy for someone looking at them to understand more about the method.

Additional information about assertions:

1.  The assertions are in strings because… (From the php reference: ”The advantages of a string assertion are less overhead when assertion checking is off and messages containing the assertion expression when an assertion fails.”)

2.  Asserts are NOT for error handling.

3.  On top of the usual uses, we use assertions to test whether parameter argument types are correct where php cannot do it for us. When php type hinting is possible, it this method is preferred over assertions.

This will run only with debug set to true:

assert('$account instanceof Account')

This will run always:

assert($account instanceof Account)

Two reference links where you can get more information on assertions:

Leave a Comment

  • Theuns Coetzee

    Ran into a conflict using the apache (2.2.21) running php 5.3.8 included in Xampp (1.7.7) on a Windows 7 64-Bit when trying to use the memcache extension from the link provided in 10.3 as the memcache dll was compiled in VC6 and not VC9.

     I’ve searched around and found this VC9 version of memcache that worked for me:

  • Puspharaj47

    hg clone ssh://
    cd zurmo ./setup

    remote: Permission denied (publickey)
    abort: no suitable response from remote hg!