From 558005695251429d6c53ee88e3abd321062b9584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Sun, 10 Apr 2022 19:53:49 +0200 Subject: [PATCH] phpstan fix, tests fix --- src/Wsdl/Event/RequestFailEvent.php | 1 + src/Wsdl/Event/RequestPostEvent.php | 1 + src/Wsdl/WebService.php | 2 +- tests/Unit/Wsdl/Event/RequestFailEventTest.php | 9 ++++++--- tests/Unit/Wsdl/Event/RequestPostEventTest.php | 3 ++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Wsdl/Event/RequestFailEvent.php b/src/Wsdl/Event/RequestFailEvent.php index a6c2fb0..915d617 100644 --- a/src/Wsdl/Event/RequestFailEvent.php +++ b/src/Wsdl/Event/RequestFailEvent.php @@ -55,6 +55,7 @@ class RequestFailEvent implements Serializable /** * @param string $fname Nazev volane funkce * @param array $args Argumenty pozadavku + * @param array> $trace Zasobnik volanych funkci */ public function __construct( string $fname, diff --git a/src/Wsdl/Event/RequestPostEvent.php b/src/Wsdl/Event/RequestPostEvent.php index 7792685..bab34d8 100644 --- a/src/Wsdl/Event/RequestPostEvent.php +++ b/src/Wsdl/Event/RequestPostEvent.php @@ -42,6 +42,7 @@ class RequestPostEvent implements Serializable * @param string $fname Nazev volane funkce * @param array $args Argumenty pozadavku * @param array|stdClass|null $result + * @param array> $trace Zasobnik volanych funkci */ public function __construct( string $fname, diff --git a/src/Wsdl/WebService.php b/src/Wsdl/WebService.php index da83e1d..aba0135 100644 --- a/src/Wsdl/WebService.php +++ b/src/Wsdl/WebService.php @@ -88,7 +88,7 @@ protected function soapCall( ) { $fname = ucfirst($functionName); $args = $this->prepareArgs($fname, $arguments); - $trace = null; + $trace = []; if ($this->eventDispatcher !== null) { $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); diff --git a/tests/Unit/Wsdl/Event/RequestFailEventTest.php b/tests/Unit/Wsdl/Event/RequestFailEventTest.php index 41f08b4..35e697a 100644 --- a/tests/Unit/Wsdl/Event/RequestFailEventTest.php +++ b/tests/Unit/Wsdl/Event/RequestFailEventTest.php @@ -17,8 +17,9 @@ class RequestFailEventTest extends TestCase public function testExceptionMessage(): void { $throwable = new RuntimeException('my message'); + $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); - $event = new RequestFailEvent('asd', [], $throwable, 30); + $event = new RequestFailEvent('asd', [], $throwable, 30, $trace); $this->assertStringContainsString('my message', $event->getExceptionString()); $this->assertSame(RuntimeException::class, $event->getExceptionClass()); } @@ -31,8 +32,9 @@ public function testDeserialization(): void 'argument' => 'value', ], ]; + $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); - $event = new RequestFailEvent('asd', $args, $throwable, 30.22); + $event = new RequestFailEvent('asd', $args, $throwable, 30.22, $trace); $serialized = serialize($event); /** @var RequestFailEvent $unserialized */ @@ -56,8 +58,9 @@ public function testRepeatedSerializationDeserialization(): void 'argument' => 'value', ], ]; + $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); - $event = new RequestFailEvent('asd', $args, $throwable, 30.22); + $event = new RequestFailEvent('asd', $args, $throwable, 30.22, $trace); $serialized = serialize($event); $unserialized = unserialize($serialized); diff --git a/tests/Unit/Wsdl/Event/RequestPostEventTest.php b/tests/Unit/Wsdl/Event/RequestPostEventTest.php index 351cbfa..b8a1959 100644 --- a/tests/Unit/Wsdl/Event/RequestPostEventTest.php +++ b/tests/Unit/Wsdl/Event/RequestPostEventTest.php @@ -21,8 +21,9 @@ public function testDeserialize(): void ]; $result = [(object)['a' => 'b']]; $duration = 11.11; + $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); - $event = new RequestPostEvent('asd', $args, $result, $duration); + $event = new RequestPostEvent('asd', $args, $result, $duration, $trace); $serialized = serialize($event); /** @var RequestPostEvent $unserialized */