From 3424b4d8b08835c075dcc8f4a1bf386e8fcc2180 Mon Sep 17 00:00:00 2001 From: SpazzMarticus Date: Tue, 29 Apr 2025 08:21:16 +0200 Subject: [PATCH] Fix return types for Doctrine\Persistence\Proxy implementations PHP Fatal error: Declaration of DeepCopyTest\Matcher\Doctrine\FooProxy::__load() must be compatible with Doctrine\Persistence\Proxy::__load(): void --- fixtures/f013/A.php | 6 ++++-- fixtures/f013/B.php | 6 ++++-- .../Matcher/Doctrine/DoctrineProxyMatcherTest.php | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/fixtures/f013/A.php b/fixtures/f013/A.php index aa0393d..ac70988 100644 --- a/fixtures/f013/A.php +++ b/fixtures/f013/A.php @@ -2,6 +2,7 @@ namespace DeepCopy\f013; +use BadMethodCallException; use Doctrine\Persistence\Proxy; class A implements Proxy @@ -11,14 +12,15 @@ class A implements Proxy /** * @inheritdoc */ - public function __load() + public function __load(): void { } /** * @inheritdoc */ - public function __isInitialized() + public function __isInitialized(): bool { + throw new BadMethodCallException(); } } diff --git a/fixtures/f013/B.php b/fixtures/f013/B.php index 89425d8..d1382e6 100644 --- a/fixtures/f013/B.php +++ b/fixtures/f013/B.php @@ -2,6 +2,7 @@ namespace DeepCopy\f013; +use BadMethodCallException; use Doctrine\Persistence\Proxy; class B implements Proxy @@ -11,15 +12,16 @@ class B implements Proxy /** * @inheritdoc */ - public function __load() + public function __load(): void { } /** * @inheritdoc */ - public function __isInitialized() + public function __isInitialized(): bool { + throw new BadMethodCallException(); } public function getFoo() diff --git a/tests/DeepCopyTest/Matcher/Doctrine/DoctrineProxyMatcherTest.php b/tests/DeepCopyTest/Matcher/Doctrine/DoctrineProxyMatcherTest.php index 22e380d..38de911 100644 --- a/tests/DeepCopyTest/Matcher/Doctrine/DoctrineProxyMatcherTest.php +++ b/tests/DeepCopyTest/Matcher/Doctrine/DoctrineProxyMatcherTest.php @@ -39,7 +39,7 @@ class FooProxy implements Proxy /** * @inheritdoc */ - public function __load() + public function __load(): void { throw new BadMethodCallException(); } @@ -47,7 +47,7 @@ public function __load() /** * @inheritdoc */ - public function __isInitialized() + public function __isInitialized(): bool { throw new BadMethodCallException(); }