Skip to content

@Declareparents annotation throws UnexpectedValueException #21

@Yoshiro-Sasagawa

Description

@Yoshiro-Sasagawa

I'm trying to use inter-type declarations with this nice package but I can't make it work and almost gave up unfortunately.

I've read the documentation of original framework at http://go.aopphp.com/docs/pointcuts-and-advices/ then I wrote some codes but I've got UnexpectedValueException like following.

Unexpected token in the TestController before App\Aspect\FooAspect->introduction, defined in projectroot/app/Aspect/FooAspect.php:0. Expected one of: ->, nsSeparator, )

Go\Core\AbstractAspectLoaderExtension::parseTokenStream vendor/goaop/framework/src/Core/AbstractAspectLoaderExtension.php:139

I dig into jakubledl/dissect package that throws actual error and it says "$eof is undefind" but I can't figure out what that means exactly.

Another example like @LoggerInterface annotation works fine as it was documented.

However, does @Declareparents work with laravel ?

My envornment is like

PHP: 7.3.28  
"goaop/framework": "2.3.4",
"goaop/goaop-laravel-bridge": "^1.1.1",
"laravel/framework": "8.0",
"nikic/php-parser": "4.6.0",
"jakubledl/dissect": "v1.0.1"

Aspect

class FooAspect implements Aspect
{
    /**
     * @DeclareParents(value="TestController", interface="FooInterface", defaultImpl="FooImpl")
     * @var null
     */
    protected $introduction = null;
}

Controller

class TestController extends Controller {
	public function index() {
		echo 'foo';
	}
}

Interface

Interface FooInterface {
  public function foo ();
}

Trait

trait FooImpl {
        public function foo() {
                echo 'foo';
        }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions