maranovot
maranovot

Reputation: 445

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.

Upvotes: 0

Views: 543

Answers (1)

Peter
Peter

Reputation: 31691

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

Upvotes: 5

Related Questions