diff --git a/src/CXml/Endpoint.php b/src/CXml/Endpoint.php index ab70d4e..9f59104 100644 --- a/src/CXml/Endpoint.php +++ b/src/CXml/Endpoint.php @@ -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]); diff --git a/src/CXml/Jms/JmsDateTimeHandler.php b/src/CXml/Jms/JmsDateTimeHandler.php index b861550..ac67ecf 100644 --- a/src/CXml/Jms/JmsDateTimeHandler.php +++ b/src/CXml/Jms/JmsDateTimeHandler.php @@ -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'; diff --git a/src/CXml/Model/Date.php b/src/CXml/Model/Date.php index 102c998..c94d116 100644 --- a/src/CXml/Model/Date.php +++ b/src/CXml/Model/Date.php @@ -8,7 +8,6 @@ */ class Date extends \DateTime { - #[\ReturnTypeWillChange] public static function createFromFormat($format, $datetime, \DateTimeZone $timezone = null) { $dateTime = parent::createFromFormat($format, $datetime, $timezone); diff --git a/src/CXml/Processor/Processor.php b/src/CXml/Processor/Processor.php index 6ff3d74..81d11fd 100644 --- a/src/CXml/Processor/Processor.php +++ b/src/CXml/Processor/Processor.php @@ -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) {