Skip to content

Commit

Permalink
Merge branch 'hotfix/0.12.14' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Aerendir committed Oct 19, 2024
2 parents 72f2da8 + 685ff7e commit 290be91
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 41 deletions.
3 changes: 1 addition & 2 deletions .baseline-phan.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'],
Expand Down
25 changes: 5 additions & 20 deletions .baseline-phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
23 changes: 8 additions & 15 deletions .baseline-psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,9 @@
<InvalidNullableReturnType>
<code><![CDATA[InvoiceLine]]></code>
</InvalidNullableReturnType>
<InvalidOperand>
<code><![CDATA[\microtime(true)]]></code>
</InvalidOperand>
<InvalidReturnStatement>
<code><![CDATA[$return]]></code>
</InvalidReturnStatement>
Expand All @@ -424,31 +427,21 @@
<NullableReturnStatement>
<code><![CDATA[$this->sections[self::SECTION_DEFAULT]->getLine($id)]]></code>
</NullableReturnStatement>
<PropertyNotSetInConstructor>
<code><![CDATA[$grossTotal]]></code>
<code><![CDATA[$issuedOn]]></code>
<code><![CDATA[$netTotal]]></code>
</PropertyNotSetInConstructor>
<RedundantCondition>
<code><![CDATA['string']]></code>
</RedundantCondition>
<RedundantConditionGivenDocblockType>
<code><![CDATA[\is_int($id)]]></code>
</RedundantConditionGivenDocblockType>
<TypeDoesNotContainNull>
<code><![CDATA[null === $this->grossTotal]]></code>
<code><![CDATA[null === $this->issuedOn]]></code>
<code><![CDATA[null === $this->netTotal]]></code>
</TypeDoesNotContainNull>
<RedundantPropertyInitializationCheck>
<code><![CDATA[false === isset($this->grossTotal)]]></code>
<code><![CDATA[false === isset($this->issuedOn)]]></code>
<code><![CDATA[false === isset($this->netTotal)]]></code>
</RedundantPropertyInitializationCheck>
<UndefinedMethod>
<code><![CDATA[$section]]></code>
<code><![CDATA[$section]]></code>
</UndefinedMethod>
<UninitializedProperty>
<code><![CDATA[$this->grossTotal]]></code>
<code><![CDATA[$this->issuedOn]]></code>
<code><![CDATA[$this->netTotal]]></code>
</UninitializedProperty>
</file>
<file src="src/Model/InvoiceInterface.php">
<InvalidDocblock>
Expand Down
8 changes: 4 additions & 4 deletions src/Model/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()]);
}

Expand Down

0 comments on commit 290be91

Please sign in to comment.