syntax error, unexpected token “}”, expecting “;” or “{”

Description

PHP found a closing curly bracket, but did not encounter its opening equivalent. Since the problem appears in the signature of a method, there are two suggestions: make the method abstract, with a semi-colon ‘;’, or give the method a full body, with the opening curly bracket.

Example

<?php

class A
{
    public function __construct()
    }
}
?>

Solutions

  • Add an opening curly bracket ‘{’ before the closing one. Possibly, fill the body of the method.

  • Replace the closing curly bracket with a semi colon. The method, and possibly the class, must now be abstract.