diff --git a/.baseline-phan.php b/.baseline-phan.php
index 540fa4b..92adce6 100644
--- a/.baseline-phan.php
+++ b/.baseline-phan.php
@@ -34,7 +34,6 @@
// PhanPossiblyNullTypeMismatchProperty : 1 occurrence
// PhanReadOnlyPrivateProperty : 1 occurrence
// PhanTypeInvalidLeftOperandOfNumericOp : 1 occurrence
- // PhanTypeMismatchArgumentInternal : 1 occurrence
// PhanTypeMismatchPropertyReal : 1 occurrence
// PhanTypeMismatchReturnNullable : 1 occurrence
// PhanUnextractableAnnotationElementName : 1 occurrence
@@ -74,7 +73,7 @@
'src/Model/Feature/Subscribed/SubscribedCountableFeature.php' => ['ConstReferenceClassNotImported', 'PhanUndeclaredMethod'],
'src/Model/Feature/Subscribed/SubscribedFeaturesCollection.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchDeclaredReturn', 'PhanUnreferencedProtectedMethod'],
'src/Model/Feature/Subscribed/SubscribedRechargeableFeature.php' => ['PhanCompatibleUnionType', 'PhanTypeMismatchReturnSuperType'],
- 'src/Model/Invoice.php' => ['PhanDeprecatedFunction', 'PhanParamSignatureMismatch', 'PhanTypeArraySuspicious', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchDimAssignment', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnNullable'],
+ 'src/Model/Invoice.php' => ['PhanDeprecatedFunction', 'PhanParamSignatureMismatch', 'PhanTypeArraySuspicious', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchDimAssignment', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnNullable'],
'src/Model/InvoiceInterface.php' => ['PhanUnextractableAnnotationElementName', 'PhanUnextractableAnnotationSuffix'],
'src/Model/InvoiceLine.php' => ['PhanPossiblyNullTypeMismatchProperty'],
'src/Model/InvoiceSection.php' => ['PhanDeprecatedFunction', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchDimAssignment', 'PhanTypeMismatchPropertyReal'],
diff --git a/.baseline-phpstan.neon b/.baseline-phpstan.neon
index 2864d9a..64a11f4 100644
--- a/.baseline-phpstan.neon
+++ b/.baseline-phpstan.neon
@@ -590,6 +590,11 @@ parameters:
count: 1
path: src/Model/Invoice.php
+ -
+ message: "#^Class DateTime is unsafe to use\\. Its methods can return FALSE instead of throwing an exception\\. Please add 'use Safe\\\\DateTime;' at the beginning of the file to use the variant provided by the 'thecodingmachine/safe' library\\.$#"
+ count: 1
+ path: src/Model/Invoice.php
+
-
message: "#^Method SerendipityHQ\\\\Bundle\\\\FeaturesBundle\\\\Model\\\\Invoice\\:\\:getLine\\(\\) has parameter \\$id with no type specified\\.$#"
count: 1
@@ -625,16 +630,6 @@ parameters:
count: 1
path: src/Model/Invoice.php
- -
- message: "#^Parameter \\#2 \\$datetime of static method DateTime\\:\\:createFromFormat\\(\\) expects string, float given\\.$#"
- count: 1
- path: src/Model/Invoice.php
-
- -
- message: "#^Property SerendipityHQ\\\\Bundle\\\\FeaturesBundle\\\\Model\\\\Invoice\\:\\:\\$issuedOn \\(DateTimeInterface\\) does not accept DateTime\\|false\\.$#"
- count: 1
- path: src/Model/Invoice.php
-
-
message: "#^Result of && is always false\\.$#"
count: 1
@@ -650,16 +645,6 @@ parameters:
count: 1
path: src/Model/Invoice.php
- -
- message: "#^Strict comparison using \\=\\=\\= between null and DateTimeInterface will always evaluate to false\\.$#"
- count: 1
- path: src/Model/Invoice.php
-
- -
- message: "#^Strict comparison using \\=\\=\\= between null and SerendipityHQ\\\\Component\\\\ValueObjects\\\\Money\\\\MoneyInterface will always evaluate to false\\.$#"
- count: 2
- path: src/Model/Invoice.php
-
-
message: "#^Method SerendipityHQ\\\\Bundle\\\\FeaturesBundle\\\\Model\\\\InvoiceLine\\:\\:__toArray\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
diff --git a/.baseline-psalm.xml b/.baseline-psalm.xml
index fee4344..991c589 100644
--- a/.baseline-psalm.xml
+++ b/.baseline-psalm.xml
@@ -406,6 +406,9 @@
+
+
+
@@ -424,31 +427,21 @@
sections[self::SECTION_DEFAULT]->getLine($id)]]>
-
-
-
-
-
-
- grossTotal]]>
- issuedOn]]>
- netTotal]]>
-
+
+ grossTotal)]]>
+ issuedOn)]]>
+ netTotal)]]>
+
-
- grossTotal]]>
- issuedOn]]>
- netTotal]]>
-
diff --git a/src/Model/Invoice.php b/src/Model/Invoice.php
index b75c9b6..4455a5f 100644
--- a/src/Model/Invoice.php
+++ b/src/Model/Invoice.php
@@ -56,16 +56,16 @@ public function __construct($currency)
$this->currency = $currency;
// Set the issue date
- if (null === $this->issuedOn) {
+ if (false === isset($this->issuedOn)) {
// Create it with microseconds, so it is possible to use the createdOn to create a unique invoice number (http://stackoverflow.com/a/28937386/1399706)
- $this->issuedOn = \DateTime::createFromFormat('U.u', \microtime(true));
+ $this->issuedOn = new \DateTime('@' . \microtime(true));
}
- if (null === $this->grossTotal) {
+ if (false === isset($this->grossTotal)) {
$this->grossTotal = new Money([MoneyInterface::BASE_AMOUNT => 0, MoneyInterface::CURRENCY => $this->getCurrency()]);
}
- if (null === $this->netTotal) {
+ if (false === isset($this->netTotal)) {
$this->netTotal = new Money([MoneyInterface::BASE_AMOUNT => 0, MoneyInterface::CURRENCY => $this->getCurrency()]);
}