Skip to content

Commit

Permalink
phpstan fix, tests fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-stanek committed Apr 10, 2022
1 parent 601a4be commit 5580056
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/Wsdl/Event/RequestFailEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class RequestFailEvent implements Serializable
/**
* @param string $fname Nazev volane funkce
* @param array<int|string, mixed> $args Argumenty pozadavku
* @param array<int, array<string, mixed>> $trace Zasobnik volanych funkci
*/
public function __construct(
string $fname,
Expand Down
1 change: 1 addition & 0 deletions src/Wsdl/Event/RequestPostEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class RequestPostEvent implements Serializable
* @param string $fname Nazev volane funkce
* @param array<int|string, mixed> $args Argumenty pozadavku
* @param array<int|string, mixed>|stdClass|null $result
* @param array<int, array<string, mixed>> $trace Zasobnik volanych funkci
*/
public function __construct(
string $fname,
Expand Down
2 changes: 1 addition & 1 deletion src/Wsdl/WebService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 6 additions & 3 deletions tests/Unit/Wsdl/Event/RequestFailEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand All @@ -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 */
Expand All @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Wsdl/Event/RequestPostEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 5580056

Please sign in to comment.