Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mathielen committed Apr 7, 2024
1 parent cda8c7a commit 5249094
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
4 changes: 4 additions & 0 deletions src/CXml/Endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ public function __construct(
$this->logger = $logger ?? new NullLogger();
}

/**
* @throws CXmlException
* @throws CXmlInvalidException
*/
public function parseAndProcessStringAsCXml(string $xml, Context $context = null): ?CXml
{
$this->logger->info('Processing incoming CXml message', ['xml' => $xml]);
Expand Down
2 changes: 1 addition & 1 deletion src/CXml/Jms/JmsDateTimeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
class JmsDateTimeHandler
{
public function serialize(XmlSerializationVisitor $visitor, \DateTimeInterface $date, array $type, Context $context)
public function serialize(XmlSerializationVisitor $visitor, \DateTimeInterface $date, array $type, Context $context): \DOMText
{
if ($date instanceof Date) {
$format = 'Y-m-d';
Expand Down
1 change: 0 additions & 1 deletion src/CXml/Model/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/
class Date extends \DateTime
{
#[\ReturnTypeWillChange]
public static function createFromFormat($format, $datetime, \DateTimeZone $timezone = null)

Check failure on line 11 in src/CXml/Model/Date.php

View workflow job for this annotation

GitHub Actions / Static PHP Validation (8.1)

Return type mixed of method CXml\Model\Date::createFromFormat() is not covariant with tentative return type DateTime|false of method DateTime::createFromFormat().

Check failure on line 11 in src/CXml/Model/Date.php

View workflow job for this annotation

GitHub Actions / Static PHP Validation (8.2)

Return type mixed of method CXml\Model\Date::createFromFormat() is not covariant with tentative return type DateTime|false of method DateTime::createFromFormat().

Check failure on line 11 in src/CXml/Model/Date.php

View workflow job for this annotation

GitHub Actions / Static PHP Validation (8.3)

Return type mixed of method CXml\Model\Date::createFromFormat() is not covariant with tentative return type DateTime|false of method DateTime::createFromFormat().
{
$dateTime = parent::createFromFormat($format, $datetime, $timezone);
Expand Down
24 changes: 12 additions & 12 deletions src/CXml/Processor/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,20 +160,20 @@ private function getHandlerForPayload(PayloadInterface $payload): HandlerInterfa
*/
private function processMessage(Message $message, Context $context): void
{
$header = $context->getCXml() ? $context->getCXml()->getHeader() : null;
if (!$header) {
throw new CXmlException('Invalid CXml. Header is mandatory for message.');
}
$header = $context->getCXml() ? $context->getCXml()->getHeader() : null;
if (!$header) {
throw new CXmlException('Invalid CXml. Header is mandatory for message.');
}

try {
$this->headerProcessor->process($header, $context);
} catch (CXmlException $e) {
throw $e;
} catch (\Throwable $e) {
throw new CXmlProcessException($e);
}
try {
$this->headerProcessor->process($header, $context);
} catch (CXmlException $e) {
throw $e;
} catch (\Throwable $e) {
throw new CXmlProcessException($e);
}

$payload = $message->getPayload();
$payload = $message->getPayload();
try {
$this->getHandlerForPayload($payload)->handle($payload, $context);
} catch (CXmlException $e) {
Expand Down

0 comments on commit 5249094

Please sign in to comment.