From 9eb395948e59238d1480773c565e5ee18f05a58d Mon Sep 17 00:00:00 2001 From: HorstOeko Date: Thu, 17 Oct 2024 16:46:46 +0200 Subject: [PATCH] Updated PHPDocs using messages from PHPStan --- build/phpstan.neon | 18 ++++++++++-------- src/ZugferdDocument.php | 3 +-- src/ZugferdDocumentBuilder.php | 2 +- src/ZugferdObjectHelper.php | 2 +- tests/testcases/ObjectHelperExtendedTest.php | 6 +++++- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/build/phpstan.neon b/build/phpstan.neon index 50596141..b73b7b98 100644 --- a/build/phpstan.neon +++ b/build/phpstan.neon @@ -1,8 +1,10 @@ -parameters: - paths: - - ../src - - ../tests - level: 5 - treatPhpDocTypesAsCertain: false - excludePaths: - - ../src/entities/* +parameters: + paths: + - ../src + - ../tests + level: 5 + treatPhpDocTypesAsCertain: false + excludePaths: + - ../src/entities/* + - ../tests/testcases/issues/Issue32Test.php + - ../src/quick/ZugferdQuickDescriptor.php diff --git a/src/ZugferdDocument.php b/src/ZugferdDocument.php index 696ded2f..c07ed4c8 100644 --- a/src/ZugferdDocument.php +++ b/src/ZugferdDocument.php @@ -12,7 +12,6 @@ use GoetasWebservices\Xsd\XsdToPhpRuntime\Jms\Handler\BaseTypesHandler; use GoetasWebservices\Xsd\XsdToPhpRuntime\Jms\Handler\XmlSchemaDateHandler; use horstoeko\stringmanagement\PathUtils; -use horstoeko\zugferd\entities\en16931\rsm\CrossIndustryInvoiceType; use horstoeko\zugferd\exception\ZugferdUnknownProfileParameterException; use horstoeko\zugferd\jms\ZugferdTypesHandler; use horstoeko\zugferd\ZugferdObjectHelper; @@ -58,7 +57,7 @@ class ZugferdDocument /** * @internal - * @var CrossIndustryInvoiceType The internal invoice object + * @var \horstoeko\zugferd\entities\basic\rsm\CrossIndustryInvoice|\horstoeko\zugferd\entities\basicwl\rsm\CrossIndustryInvoice|\horstoeko\zugferd\entities\en16931\rsm\CrossIndustryInvoice|\horstoeko\zugferd\entities\extended\rsm\CrossIndustryInvoice|\horstoeko\zugferd\entities\minimum\rsm\CrossIndustryInvoice The internal invoice object */ private $invoiceObject = null; diff --git a/src/ZugferdDocumentBuilder.php b/src/ZugferdDocumentBuilder.php index 59ffbd49..a10a8dfa 100644 --- a/src/ZugferdDocumentBuilder.php +++ b/src/ZugferdDocumentBuilder.php @@ -294,7 +294,7 @@ public function initDocumentSummation(): ZugferdDocumentBuilder * * @param string $foreignCurrencyCode __BT-6, From BASIC WL__ Foreign currency code * @param float $foreignTaxAmount __BT-, From __ Required from EXTENDED Tax total amount in the foreign currency - * @param float|null $foreignTaxAmount __BT-X-260, From EXTENDED __ Exchange Rate + * @param float|null $exchangeRate __BT-X-260, From EXTENDED __ Exchange Rate * @return ZugferdDocumentBuilder */ public function setForeignCurrency(string $foreignCurrencyCode, float $foreignTaxAmount, ?float $exchangeRate = null): ZugferdDocumentBuilder diff --git a/src/ZugferdObjectHelper.php b/src/ZugferdObjectHelper.php index 99fcb2b7..ba459a73 100644 --- a/src/ZugferdObjectHelper.php +++ b/src/ZugferdObjectHelper.php @@ -572,7 +572,7 @@ public function getTradeCountryType(?string $id = null): ?object /** * Undocumented function * - * @return \horstoeko\zugferd\entities\basic\rsm\CrossIndustryInvoiceType|\horstoeko\zugferd\entities\basicwl\rsm\CrossIndustryInvoiceType|\horstoeko\zugferd\entities\en16931\rsm\CrossIndustryInvoiceType|\horstoeko\zugferd\entities\extended\rsm\CrossIndustryInvoiceType + * @return \horstoeko\zugferd\entities\basic\rsm\CrossIndustryInvoice|\horstoeko\zugferd\entities\basicwl\rsm\CrossIndustryInvoice|\horstoeko\zugferd\entities\en16931\rsm\CrossIndustryInvoice|\horstoeko\zugferd\entities\extended\rsm\CrossIndustryInvoice */ public function getCrossIndustryInvoice() { diff --git a/tests/testcases/ObjectHelperExtendedTest.php b/tests/testcases/ObjectHelperExtendedTest.php index ad4dfe83..c8649a1f 100644 --- a/tests/testcases/ObjectHelperExtendedTest.php +++ b/tests/testcases/ObjectHelperExtendedTest.php @@ -1354,7 +1354,11 @@ public function testGetTaxApplicableTradeCurrencyExchangeType(): void $this->assertNotNull($currencyExchangeType); $this->assertEquals("EUR", $currencyExchangeType->getSourceCurrencyCode()); $this->assertEquals("USD", $currencyExchangeType->getTargetCurrencyCode()); - $this->assertEquals(10.0, $currencyExchangeType->getConversionRate()->value()); + /** + * @var \horstoeko\zugferd\entities\extended\udt\RateType + */ + $rate = $currencyExchangeType->getConversionRate(); + $this->assertEquals(10.0, $rate->value()); $this->assertEquals("20180305", $currencyExchangeType->getConversionRateDateTime()->getDateTimeString()->value()); $this->assertEquals("102", $currencyExchangeType->getConversionRateDateTime()->getDateTimeString()->getFormat());