syntax error, unexpected token “{”, expecting variable

Description

With the last comma in the signature of the method, PHP expects another parameter after it, or the end of the signature with a closing parenthesis.

Example

<?php

class A {
    public function __construct($b,
     { }
}
?>

Solutions

  • Add a closing parenthesis.

  • Add another parameter, then a closing parenthesis.