flow-development-collection: Pointcut method designator does not allow to intercept private methods

Description

Pointcut method designator does not allow to intercept private methods, only protected or public methods can be intercepted.

This is actually somewhat documented at https://flowframework.readthedocs.io/en/stable/TheDefinitiveGuide/PartIII/AspectOrientedProgramming.html#method

since it only mentions public and protected methods but not private methods.

Steps to Reproduce

  1. create a class with a private method that is called.
  2. Create an Aspect with an annotation like @Flow\AfterReturning("method(Foo\Bar\Service\MyService->getResponse())") pointing to the private method.

Expected behavior

The Aspect to be called when the private method returns something.

Actual behavior

Nothing happens.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (16 by maintainers)

Commits related to this issue

Most upvoted comments

right, grrrr 😉

@albe I finally came around to take a closer look on to your implementation (#2035) but I couldn’t get it to work.

So I recreated my fix (#2131) with the 5.3 target branch, tweaked it a little, copied some of your exception message and added doc comments…

Hey guys, how should we proceed with this one?

I would consider #2036 (or #2035) an improvement to the current situation. We could always still add support for proxied private methods if we figure out a good way to implement this. Personally, I won’t take care of that because I still think that it should™ not be required. But obviously I’d be happy if someone else took care. Otherwise I’d go ahead an add documentation and tests to my PR

You can only ever relax the visibility in a subclass

You are correct 😃

for now, let’s just throw an exception as a BUGFIX to improve the DX.

Repeating myself just to get the point across 😃