Skip to content

Commit

Permalink
Fixing Psalm, Codesniffer and Phpunit issues
Browse files Browse the repository at this point in the history
Signed-off-by: Atul-glo35265 <[email protected]>
  • Loading branch information
Atul-glo35265 committed Oct 16, 2024
1 parent c392003 commit f9d6567
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions src/AutoDiscover.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Laminas\Server\Reflection;
use Laminas\Soap\AutoDiscover\DiscoveryStrategy\DiscoveryStrategyInterface as DiscoveryStrategy;
use Laminas\Soap\AutoDiscover\DiscoveryStrategy\ReflectionDiscovery;
use Laminas\Soap\Wsdl;
use Laminas\Soap\Wsdl\ComplexTypeStrategy\ComplexTypeStrategyInterface as ComplexTypeStrategy;
use Laminas\Uri;

Expand All @@ -15,8 +14,10 @@
use function function_exists;
use function get_class;
use function gettype;
use function header;
use function htmlspecialchars;
use function is_array;
use function is_callable;
use function is_object;
use function is_string;
use function is_subclass_of;
Expand Down Expand Up @@ -624,15 +625,19 @@ public function toXml()
}

/**
* handle function
* Handle function
*
* @param string $responseHandler
* @param string|null|callable $responseHandler
* @return void
*/
public function handle($responseHandler = null)
{
$responseHandler = $responseHandler ?? 'header';
$responseHandler('Content-Type: text/xml');
if (is_callable($responseHandler)) {
$responseHandler('Content-Type: text/xml');
} else {
header($responseHandler ?? 'Content-Type: text/xml');
}

echo $this->toXml();
}
}
2 changes: 1 addition & 1 deletion test/AutoDiscoverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,7 @@ public function testHandle()

ob_start();

$this->server->handle(function ($header) {
$this->server->handle(function (?string $header) {
// Optionally verify the header if you're mocking
$this->assertEquals('Content-Type: text/xml', $header);
});
Expand Down

0 comments on commit f9d6567

Please sign in to comment.