Express: Getting error with setting up template declarations

I’ve been following this guide to make customizable form templates for our site, but am getting an error whenever I go to install my package:

Declaration of Package\Attribute\Context\FrontendFormContext::setLocation(Package\Attribute\Context\TemplateLocator $locator) must be compatible with Concrete\Core\Form\Context\ContextInterface::setLocation(Concrete\Core\Filesystem\TemplateLocator $locator)

I’m no expert on Concrete’s systems and need guidance on why this would be failing. The code in question is this (Package is simply named “package”, naming the template files the same (package.php)):

namespace Package\Attribute\Context;

use Concrete\Core\Attribute\Context\FrontendFormContext as BaseFrontendFormContext;

class FrontendFormContext extends BaseFrontendFormContext
    public function __construct()
        $this->preferTemplateIfAvailable('package', 'package');

    public function setLocation(TemplateLocator $locator)
        $locator->setTemplate(['package', 'package']);
        return $locator;

Running on 8.5.9. Guidance/assistance greatly appreciated.

You are probably missing this code just after first (and your only) use statement.

use Concrete\Core\Filesystem\TemplateLocator;

Without this, PHP is trying to load “TemplateLocator” class from path relative to current namespace (but should use absolute path as described above).

Thank you! That’s exactly what was wrong. Much appreciated!