Skip to content

Commit

Permalink
Fixed several code issues issued by PHPStan
Browse files Browse the repository at this point in the history
  • Loading branch information
ruff committed Feb 17, 2023
1 parent db19d7a commit 35ce9d0
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion build/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ parameters:
level: 5
treatPhpDocTypesAsCertain: false
checkMissingIterableValueType: false
excludes_analyse:
excludePaths:
- ../src/entities/*
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
}
},
"require": {
"php": "^7.3|^8.0|^8.1",
"php": "^7.3|^7.4|^8.0|^8.1",
"jms/serializer": "^3",
"adrienrn/php-mimetyper": "^0.2",
"goetas-webservices/xsd2php-runtime": "^0.2.13",
Expand Down
4 changes: 2 additions & 2 deletions src/ZugferdDocumentJsonExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ public function toJsonString(): string
/**
* Returns the invoice object as a json object
*
* @return string
* @return \stdClass
* @throws RuntimeException
*/
public function toJsonObject(): object
public function toJsonObject(): \stdClass
{
$jsonObject = json_decode($this->toJsonString());

Expand Down
2 changes: 1 addition & 1 deletion src/ZugferdDocumentPdfBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private function startCreatePdf(): void

// Update meta data (e.g. such as author, producer, title)

$this->updatePdfMetaData();
$this->updatePdfMetadata();
}

/**
Expand Down
10 changes: 5 additions & 5 deletions src/ZugferdDocumentReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -1898,9 +1898,9 @@ public function getDocumentInvoicerLegalOrganisation(?string &$legalorgid, ?stri
*/
public function firstDocumentInvoicerContact(): bool
{
$this->documentInvoiceeContactPointer = 0;
$this->documentInvoicerContactPointer = 0;
$contacts = $this->objectHelper->ensureArray($this->getInvoiceValueByPath("getSupplyChainTradeTransaction.getApplicableHeaderTradeSettlement.getInvoicerTradeParty.getDefinedTradeContact", []));
return isset($contacts[$this->documentInvoiceeContactPointer]);
return isset($contacts[$this->documentInvoicerContactPointer]);
}

/**
Expand All @@ -1912,9 +1912,9 @@ public function firstDocumentInvoicerContact(): bool
*/
public function nextDocumentInvoicerContact(): bool
{
$this->documentInvoiceeContactPointer++;
$this->documentInvoicerContactPointer++;
$contacts = $this->objectHelper->ensureArray($this->getInvoiceValueByPath("getSupplyChainTradeTransaction.getApplicableHeaderTradeSettlement.getInvoicerTradeParty.getDefinedTradeContact", []));
return isset($contacts[$this->documentInvoiceeContactPointer]);
return isset($contacts[$this->documentInvoicerContactPointer]);
}

/**
Expand All @@ -1938,7 +1938,7 @@ public function nextDocumentInvoicerContact(): bool
public function getDocumentInvoicerContact(?string &$contactpersonname, ?string &$contactdepartmentname, ?string &$contactphoneno, ?string &$contactfaxno, ?string &$contactemailadd): ZugferdDocumentReader
{
$contacts = $this->objectHelper->ensureArray($this->getInvoiceValueByPath("getSupplyChainTradeTransaction.getApplicableHeaderTradeSettlement.getInvoicerTradeParty.getDefinedTradeContact", []));
$contact = $contacts[$this->documentInvoiceeContactPointer];
$contact = $contacts[$this->documentInvoicerContactPointer];
$contactpersonname = $this->getInvoiceValueByPathFrom($contact, "getPersonName.value", "");
$contactdepartmentname = $this->getInvoiceValueByPathFrom($contact, "getDepartmentName.value", "");
$contactphoneno = $this->getInvoiceValueByPathFrom($contact, "getTelephoneUniversalCommunication.getCompleteNumber.value", "");
Expand Down
4 changes: 2 additions & 2 deletions src/ZugferdDocumentValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ class ZugferdDocumentValidator
/**
* The validator instance
*
* @var ValidatorInterface;
* @var \Symfony\Component\Validator\Validator\ValidatorInterface;
*/
private $validator = null;

/**
* Constructor
*
* @codeCoverageIgnore
* @param ZugferdDocument $document
* @param ZugferdDocument $document
*/
public function __construct(ZugferdDocument $document)
{
Expand Down
3 changes: 2 additions & 1 deletion src/quick/ZugferdQuickDescriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace horstoeko\zugferd\quick;

use DateTime;
use horstoeko\stringmanagement\StringUtils;
use horstoeko\zugferd\ZugferdDocumentBuilder;
use horstoeko\zugferd\codelists\ZugferdInvoiceType;
use horstoeko\zugferd\codelists\ZugferdPaymentMeans;
Expand Down Expand Up @@ -124,7 +125,7 @@ public function doCreateInvoice(string $invoiceNo, \DateTime $invoiceDate, strin
public function doCreateCreditMemo(string $creditMemoNo, \DateTime $invoiceDate, string $currency, string $creditMemoNoReference = ""): ZugferdQuickDescriptor
{
$this->setDocumentInformation($creditMemoNo, ZugferdInvoiceType::CREDITNOTE, $invoiceDate, $currency);
$this->setDocumentGeneralPaymentInformation(null, $creditMemoNoReference ?? $creditMemoNo);
$this->setDocumentGeneralPaymentInformation(null, StringUtils::stringIsNullOrEmpty($creditMemoNoReference) ? $creditMemoNo : $creditMemoNoReference);
return $this;
}

Expand Down

0 comments on commit 35ce9d0

Please sign in to comment.