在Symfony2上调用未定义的方法isMethod

Here is my problem I'm following the symfony tutorial (Handling form submission) but I've the error "Call to undefined method Symfony\Component\HttpFoundation\Request::isMethod()" and I can't fix it. I read in some website that isMethod was suppressed, but I can't find another way to perform my check. Thanks.

use Symfony\Component\HttpFoundation\Request;

public function contactusAction(Request $request)
    {   
    $contact = new ContactUs(); 
    $form = $this->createFormBuilder($contact)
        ->add('nom', 'text')
        ->add('mail', 'email')
        ->add('sujet', 'choice', array('choices' => array('pt' => 'Problemes techniques', 'bi' => 'Boite a idees', 'd' => 'Divers')))
        ->add('msg', 'textarea')
        ->getForm();

    if ($request->isMethod('post')) 
    {
        $form->bind($request);

        if ($form->isValid()) 
        {
            echo 'OK!';         
            //return $this->redirect($this->generateUrl('task_success'));
        }
        else
            echo 'KO!!';
        }

    return $this->render('MyCoreBundle:Info:contactus.html.twig', array('form' => $form->createView()));
        //return array();
    }}

Update Symfony to the recent version or use

if ('POST' === $request->getMethod())

Also, be aware that the compared method string should be in uppercase.