symfony: Making `ExtensionInterface`s extending `\Throwable` is a BC break

Symfony version(s) affected: 4.1

Description #26702 introduces an annoying BC break: when using Prophecy, it’s not possible to prohesize our interfaces anymore.

How to reproduce

    $serializerException = $this->prophesize(ExceptionInterface::class);
    $serializerException->willExtend(\Exception::class);

    $serializerException->reveal();

Was working before, now throws Prophecy\Exception\Doubler\MethodNotExtendableException: Method getMessage is not extendable, so can not be added.

Possible Solution
Reverting #26702. (I’m trying to figure another solution).

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (17 by maintainers)

Commits related to this issue

Most upvoted comments

@curry684 but that does not mean you cannot have an interface extending it. Traversable already works that way. It only means that classes which want to implement this interface must extend Exception or Error (like classes implementing an interface extending Traversable must implement either Iterator or IteratorAggregate)

Maybe it could be merged again after the issue with Prophecy is fixed?

@nicolas-grekas @fabpot Do you consider re-merging #26702 ? It actually looks like a bug not related to Symfony and \Throwable.

It seems like a bug in Prophecy, here’s the WIP PR: https://github.com/phpspec/prophecy/pull/412