Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Declareparents annotation throws UnexpectedValueException #21

Open
Yoshiro-Sasagawa opened this issue May 29, 2021 · 0 comments
Open

Comments

@Yoshiro-Sasagawa
Copy link

Yoshiro-Sasagawa commented May 29, 2021

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';
        }
}
@Yoshiro-Sasagawa Yoshiro-Sasagawa changed the title Declareparents annotation Declareparents annotation throws UnexpectedValueException May 29, 2021
@Yoshiro-Sasagawa Yoshiro-Sasagawa changed the title Declareparents annotation throws UnexpectedValueException @Declareparents annotation throws UnexpectedValueException May 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant