Skip to content

Commit 288af58

Browse files
update rector config
1 parent 79d2d0c commit 288af58

7 files changed

Lines changed: 15 additions & 10 deletions

File tree

rector.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@
55
use Rector\Config\RectorConfig;
66
use Rector\Symfony\Set\JMSSetList;
77
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNativeCallRector;
8-
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictScalarReturnExprRector;
98

109
return RectorConfig::configure()
10+
->withImportNames()
1111
->withPaths([
1212
__DIR__ . '/src/zugferd2',
13+
__DIR__ . '/tests/zugferd2',
1314
])
14-
->withPhpSets(php81: true)
15+
->withPhpSets()
16+
->withPreparedSets(codeQuality: true, deadCode: true)
1517
->withRules([
1618
ReturnTypeFromStrictNativeCallRector::class,
17-
ReturnTypeFromStrictScalarReturnExprRector::class,
1819
])
1920
->withSets([
2021
JMSSetList::ANNOTATIONS_TO_ATTRIBUTES,

src/zugferd2/Model/HeaderTradeAgreement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class HeaderTradeAgreement
6767
#[Type(ReferencedDocument::class)]
6868
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
6969
#[SerializedName('SellerOrderReferencedDocument')]
70-
public ?ReferencedDocument $sellerOrderReferencedDocument;
70+
public ?ReferencedDocument $sellerOrderReferencedDocument = null;
7171

7272
#[Type(ProcuringProject::class)]
7373
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]

src/zugferd2/Model/LineTradeDelivery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class LineTradeDelivery
1818
#[Type(Quantity::class)]
1919
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
2020
#[SerializedName('PackageQuantity')]
21-
public ?Quantity $packageQuantity;
21+
public ?Quantity $packageQuantity = null;
2222

2323
#[Type(SupplyChainEvent::class)]
2424
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]

src/zugferd2/Model/ProductType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ProductType
1313
#[Type(Id::class)]
1414
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]
1515
#[SerializedName('GlobalID')]
16-
public ?Id $id;
16+
public ?Id $id = null;
1717

1818
#[Type('string')]
1919
#[XmlElement(cdata: false, namespace: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100')]

src/zugferd2/Validator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Easybill\ZUGFeRD2;
66

7+
use DOMDocument;
8+
79
class Validator
810
{
911
public const SCHEMA_BASIC = __DIR__ . '/Schema/BASIC/Factur-X_1.0.07_BASIC.xsd';
@@ -14,7 +16,7 @@ class Validator
1416

1517
public function validateAgainstXsd(string $xml, string $schemaFile): ?string
1618
{
17-
$domDoc = new \DOMDocument();
19+
$domDoc = new DOMDocument();
1820
$domDoc->loadXML($xml);
1921

2022
try {

tests/zugferd2/Tests/Legacy/TradeAccountingAccountTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function testTradeAccountingAccount(): void
5050

5151
$invoice->supplyChainTradeTransaction->lineItems[] = $item1;
5252

53-
$xml = <<<'XML'
53+
$xml = <<<'XML_WRAP'
5454
<?xml version="1.0" encoding="UTF-8"?>
5555
<rsm:CrossIndustryInvoice xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100" xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100">
5656
<rsm:ExchangedDocumentContext>
@@ -107,7 +107,7 @@ public function testTradeAccountingAccount(): void
107107
</ram:ApplicableHeaderTradeSettlement>
108108
</rsm:SupplyChainTradeTransaction>
109109
</rsm:CrossIndustryInvoice>
110-
XML;
110+
XML_WRAP;
111111
$this->assertEquals(
112112
// Removes white-space
113113
preg_replace('/\s/', '', $xml),

tests/zugferd2/Tests/Traits/ReformatXmlTrait.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44

55
namespace Easybill\ZUGFeRD2\Tests\Traits;
66

7+
use DOMDocument;
8+
79
trait ReformatXmlTrait
810
{
911
public static function reformatXml(string $xml): string
1012
{
1113
$xml = preg_replace('/<!--(.|\s)*?-->/', '', $xml);
1214

13-
$doc = new \DOMDocument('1.0', 'UTF-8');
15+
$doc = new DOMDocument('1.0', 'UTF-8');
1416
$doc->preserveWhiteSpace = false;
1517
$doc->formatOutput = true;
1618
$doc->loadXML($xml);

0 commit comments

Comments
 (0)