serializer icon indicating copy to clipboard operation
serializer copied to clipboard

Non-internal SerializationVisitorInterface implements internal VisitorInterface

Open boesing opened this issue 4 years ago • 0 comments

Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? kinda

Hey there,

currently switching over from phpstan to psalm and realized that psalm addresses my SerializationVisitorInterface implementation of using internal methods from jms/serializer.

I had to verify that and stumbled on the @internal annotation within the VisitorInterface.

I think, this is due to the fact, that no one should directly depend on that interface (as already addressed in other issues). Sadly, there is no way of not implementing the methods of VisitorInterface when implementing SerializationVisitorInterface.

I had some similar issues in another package of mine and fixed it, by also adding the methods to the depending interface.

Before

https://3v4l.org/JrKgU https://psalm.dev/r/5212ac11f7

After

https://3v4l.org/a0HPa https://psalm.dev/r/7f54d8996a

I wonder if this might be a scenario for this package without having a BC break?

I've seen https://github.com/schmittjoh/serializer/issues/1161 but not sure if this is related. I just want to get rid of psalms error that we are using internal methods which are actually not internal.

Steps required to reproduce the problem

https://3v4l.org/JrKgU

Expected Result

https://psalm.dev/r/7f54d8996a

Actual Result

https://psalm.dev/r/5212ac11f7

boesing avatar Feb 18 '21 19:02 boesing