Search code examples
phphhvmhacklang

Hacklang unexpected interface error


I am learning hacklang and having issues with using interface in different files. Here is my code.

IpAuthorizedController.php

<?hh
namespace App\Controller\Interface;

interface IpAuthorizedController {

}

HomeController.php

<?hh
namespace App\controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use App\Controller\Interface\IpAuthorizedController;

class HomeController extends Controller
{
  /**
   * @Route("/", name="index")
   *
   */
  public function index()
  {
    die(var_dump(return $this->render('index.html.twig')));
  }
}

Error message

FatalThrowableError

syntax error, unexpected T_INTERFACE, expecting '{'
in HomeController.hh (line 5)

I am new to this language so any help is much appreciated, thanks.


Solution

  • "Interface" is a reserved word and cannot be used as a namespace.