Skip to content

Commit

Permalink
Merge branch 'release/0.12.11'
Browse files Browse the repository at this point in the history
  • Loading branch information
Aerendir committed Oct 10, 2024
2 parents af440c1 + 5a7fe3e commit 2c62614
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 27 deletions.
21 changes: 11 additions & 10 deletions .baseline-phan.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,31 @@
// # Issue statistics:
// PhanDeprecatedFunction : 20+ occurrences
// PhanUndeclaredMethod : 15+ occurrences
// PhanParamSignatureMismatch : 10+ occurrences
// PhanTypeMismatchReturn : 10+ occurrences
// PhanUnreferencedClosure : 9 occurrences
// PhanTypeMismatchArgument : 8 occurrences
// PhanUndeclaredProperty : 8 occurrences
// PhanTypeMismatchDeclaredReturn : 6 occurrences
// PhanUnreferencedProtectedMethod : 6 occurrences
// PhanParamSignatureMismatch : 4 occurrences
// PhanTypeMismatchArgumentSuperType : 4 occurrences
// PhanTypeMismatchReturnSuperType : 4 occurrences
// PhanTypeMismatchArgumentNullable : 3 occurrences
// PhanUnusedPublicFinalMethodParameter : 3 occurrences
// PhanWriteOnlyPrivateProperty : 3 occurrences
// PhanTypeArraySuspicious : 2 occurrences
// PhanTypeMismatchDimAssignment : 2 occurrences
// PhanTypeMismatchPropertyReal : 2 occurrences
// PhanUndeclaredTypeParameter : 2 occurrences
// PhanUnusedVariable : 2 occurrences
// ConstReferenceClassNotImported : 1 occurrence
// PhanAccessClassInternal : 1 occurrence
// PhanCompatiblePHP7 : 1 occurrence
// PhanCompatibleUnionType : 1 occurrence
// PhanPossiblyNullTypeMismatchProperty : 1 occurrence
// PhanReadOnlyPrivateProperty : 1 occurrence
// PhanTypeInvalidLeftOperandOfNumericOp : 1 occurrence
// PhanTypeMismatchArgumentInternal : 1 occurrence
// PhanTypeMismatchArgumentReal : 1 occurrence
// PhanTypeMismatchDimFetch : 1 occurrence
// PhanTypeMismatchPropertyReal : 1 occurrence
// PhanTypeMismatchReturnNullable : 1 occurrence
// PhanUnextractableAnnotationElementName : 1 occurrence
// PhanUnextractableAnnotationSuffix : 1 occurrence
Expand All @@ -47,15 +47,16 @@
// Currently, file_suppressions and directory_suppressions are the only supported suppressions
'file_suppressions' => [
'src/DependencyInjection/Configuration.php' => ['PhanDeprecatedFunction', 'PhanUndeclaredMethod', 'PhanUnreferencedClosure', 'PhanUnusedVariable'],
'src/DependencyInjection/SHQFeaturesExtension.php' => ['PhanUnreferencedClass'],
'src/DependencyInjection/SHQFeaturesExtension.php' => ['PhanAccessClassInternal', 'PhanUnreferencedClass'],
'src/Form/DataTransformer/AbstractFeatureTransformer.php' => ['PhanDeprecatedFunction'],
'src/Form/DataTransformer/BooleanFeatureTransformer.php' => ['PhanTypeMismatchReturnSuperType', 'PhanUndeclaredMethod'],
'src/Form/DataTransformer/CountableFeatureTransformer.php' => ['PhanTypeMismatchReturnSuperType', 'PhanUndeclaredMethod'],
'src/Form/DataTransformer/RechargeableFeatureTransformer.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchReturnSuperType', 'PhanUndeclaredMethod', 'PhanUnusedPublicFinalMethodParameter'],
'src/Form/DataTransformer/BooleanFeatureTransformer.php' => ['PhanParamSignatureMismatch', 'PhanTypeMismatchReturnSuperType', 'PhanUndeclaredMethod'],
'src/Form/DataTransformer/CountableFeatureTransformer.php' => ['PhanParamSignatureMismatch', 'PhanTypeMismatchReturnSuperType', 'PhanUndeclaredMethod'],
'src/Form/DataTransformer/FeaturesCollectionTransformer.php' => ['PhanParamSignatureMismatch'],
'src/Form/DataTransformer/RechargeableFeatureTransformer.php' => ['PhanParamSignatureMismatch', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturnSuperType', 'PhanUndeclaredMethod', 'PhanUnusedPublicFinalMethodParameter'],
'src/Form/Type/FeaturesType.php' => ['PhanTypeMismatchArgumentSuperType', 'PhanUndeclaredMethod', 'PhanUnreferencedClosure'],
'src/InvoiceDrawer/AbstractInvoiceDrawer.php' => ['PhanWriteOnlyPublicProperty'],
'src/Manager/FeaturesManager.php' => ['PhanDeprecatedFunction', 'PhanUndeclaredMethod'],
'src/Manager/InvoicesManager.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchPropertyReal', 'PhanUndeclaredMethod', 'PhanWriteOnlyPrivateProperty'],
'src/Manager/InvoicesManager.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredMethod', 'PhanWriteOnlyPrivateProperty'],
'src/Model/Feature/AbstractFeaturesCollection.php' => ['PhanDeprecatedFunction', 'PhanUnreferencedClosure', 'PhanUnreferencedPublicClassConstant'],
'src/Model/Feature/Configured/ConfiguredCountableFeature.php' => ['PhanReadOnlyPrivateProperty', 'PhanUnusedPublicFinalMethodParameter'],
'src/Model/Feature/Configured/ConfiguredFeaturesCollection.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchDeclaredReturn', 'PhanUnreferencedProtectedMethod'],
Expand All @@ -77,7 +78,7 @@
'src/Model/InvoiceInterface.php' => ['PhanUnextractableAnnotationElementName', 'PhanUnextractableAnnotationSuffix'],
'src/Model/InvoiceLine.php' => ['PhanPossiblyNullTypeMismatchProperty'],
'src/Model/InvoiceSection.php' => ['PhanDeprecatedFunction', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchDimAssignment', 'PhanTypeMismatchPropertyReal'],
'src/Model/Subscription.php' => ['PhanDeprecatedFunction', 'PhanParamSignatureMismatch', 'PhanTypeMismatchArgumentReal', 'PhanTypeMismatchReturnSuperType'],
'src/Model/Subscription.php' => ['PhanCompatibleUnionType', 'PhanDeprecatedFunction', 'PhanParamSignatureMismatch', 'PhanTypeMismatchReturnSuperType'],
],
// 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed.
// (directory_suppressions will currently be ignored by subsequent calls to --save-baseline, but may be preserved in future Phan releases)
Expand Down
44 changes: 33 additions & 11 deletions .baseline-psalm.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.24.0@462c80e31c34e58cc4f750c656be3927e80e550e">
<files psalm-version="5.26.1@d747f6500b38ac4f7dfc5edbcae6e4b637d7add0">
<file src="src/DependencyInjection/Configuration.php">
<ArgumentTypeCoercion>
<code><![CDATA[$currency]]></code>
Expand Down Expand Up @@ -28,6 +28,11 @@
<code><![CDATA[children]]></code>
</UndefinedMethod>
</file>
<file src="src/DependencyInjection/SHQFeaturesExtension.php">
<InternalClass>
<code><![CDATA[Extension]]></code>
</InternalClass>
</file>
<file src="src/Form/DataTransformer/AbstractFeatureTransformer.php">
<MissingTemplateParam>
<code><![CDATA[DataTransformerInterface]]></code>
Expand All @@ -37,6 +42,10 @@
</PossiblyNullReference>
</file>
<file src="src/Form/DataTransformer/BooleanFeatureTransformer.php">
<MethodSignatureMismatch>
<code><![CDATA[BooleanFeatureTransformer]]></code>
<code><![CDATA[BooleanFeatureTransformer]]></code>
</MethodSignatureMismatch>
<MoreSpecificImplementedParamType>
<code><![CDATA[$enabled]]></code>
<code><![CDATA[$feature]]></code>
Expand All @@ -50,6 +59,10 @@
</RedundantCondition>
</file>
<file src="src/Form/DataTransformer/CountableFeatureTransformer.php">
<MethodSignatureMismatch>
<code><![CDATA[CountableFeatureTransformer]]></code>
<code><![CDATA[CountableFeatureTransformer]]></code>
</MethodSignatureMismatch>
<MoreSpecificImplementedParamType>
<code><![CDATA[$feature]]></code>
<code><![CDATA[$pack]]></code>
Expand All @@ -60,6 +73,10 @@
</ParamNameMismatch>
</file>
<file src="src/Form/DataTransformer/FeaturesCollectionTransformer.php">
<MethodSignatureMismatch>
<code><![CDATA[FeaturesCollectionTransformer]]></code>
<code><![CDATA[FeaturesCollectionTransformer]]></code>
</MethodSignatureMismatch>
<MissingTemplateParam>
<code><![CDATA[DataTransformerInterface]]></code>
</MissingTemplateParam>
Expand All @@ -73,6 +90,10 @@
</ParamNameMismatch>
</file>
<file src="src/Form/DataTransformer/RechargeableFeatureTransformer.php">
<MethodSignatureMismatch>
<code><![CDATA[RechargeableFeatureTransformer]]></code>
<code><![CDATA[RechargeableFeatureTransformer]]></code>
</MethodSignatureMismatch>
<MoreSpecificImplementedParamType>
<code><![CDATA[$feature]]></code>
<code><![CDATA[$pack]]></code>
Expand Down Expand Up @@ -173,9 +194,6 @@
</UndefinedInterfaceMethod>
</file>
<file src="src/Manager/InvoicesManager.php">
<InvalidPropertyAssignmentValue>
<code><![CDATA[$drawer]]></code>
</InvalidPropertyAssignmentValue>
<InvalidReturnStatement>
<code><![CDATA[$drawer]]></code>
</InvalidReturnStatement>
Expand Down Expand Up @@ -349,20 +367,18 @@
<code><![CDATA[toArray]]></code>
</PossiblyInvalidMethodCall>
<PropertyNotSetInConstructor>
<code><![CDATA[$lastRefreshOn]]></code>
<code><![CDATA[SubscribedCountableFeature]]></code>
</PropertyNotSetInConstructor>
<TypeDoesNotContainNull>
<code><![CDATA[false === isset($this->lastRefreshOn) || null === $this->lastRefreshOn]]></code>
<code><![CDATA[null === $this->getLastRefreshOn()]]></code>
<code><![CDATA[null === $this->lastRefreshOn]]></code>
<code><![CDATA[null === $this->previousRemainedQuantity]]></code>
</TypeDoesNotContainNull>
<TypeDoesNotContainType>
<code><![CDATA[$subscribedPack instanceof ConfiguredCountableFeaturePack]]></code>
<code><![CDATA[false === isset($this->lastRefreshOn) || null === $this->lastRefreshOn]]></code>
</TypeDoesNotContainType>
<UninitializedProperty>
<code><![CDATA[$this->lastRefreshOn]]></code>
</UninitializedProperty>
</file>
<file src="src/Model/Feature/Subscribed/SubscribedFeatureInterface.php">
<MissingReturnType>
Expand All @@ -377,7 +393,7 @@
<code><![CDATA[$elements]]></code>
</ImplementedParamTypeMismatch>
<MethodSignatureMismatch>
<code><![CDATA[public function __construct(array $elements = [])]]></code>
<code><![CDATA[public function __construct(?array $elements = [])]]></code>
</MethodSignatureMismatch>
<MismatchingDocblockReturnType>
<code><![CDATA[SubscribedBooleanFeature[]|SubscribedFeaturesCollection]]></code>
Expand Down Expand Up @@ -495,9 +511,12 @@
</RedundantConditionGivenDocblockType>
</file>
<file src="src/Model/Subscription.php">
<InvalidNullableReturnType>
<InvalidReturnStatement>
<code><![CDATA[$this->features]]></code>
</InvalidReturnStatement>
<InvalidReturnType>
<code><![CDATA[SubscribedFeaturesCollection]]></code>
</InvalidNullableReturnType>
</InvalidReturnType>
<LessSpecificReturnStatement>
<code><![CDATA[$this->nextRefreshOn]]></code>
<code><![CDATA[$this->nextRenewOn]]></code>
Expand All @@ -515,6 +534,9 @@
<code><![CDATA[$nextRenewOn]]></code>
<code><![CDATA[$renewInterval]]></code>
</ParamNameMismatch>
<ParseError>
<code><![CDATA[array|SubscribedFeaturesCollection|null]]></code>
</ParseError>
<PossiblyInvalidClone>
<code><![CDATA[clone $this->features]]></code>
<code><![CDATA[clone $this->features]]></code>
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"phpstan/phpstan-doctrine": "1.5.3",
"phpstan/phpstan-phpunit": "1.4.0",
"phpstan/phpstan-symfony": "1.4.10",
"rector/rector": "1.2.5",
"rector/rector": "1.2.6",
"roave/security-advisories": "dev-master",
"serendipity_hq/component-text-matrix": "^3.0",
"serendipity_hq/rector-config": "^1.0",
Expand Down
1 change: 1 addition & 0 deletions src/Manager/InvoicesManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public function populateSection(InvoiceSection $section, ?array $addedFeatures =
*/
$grossPrice = $this->getConfiguredFeatures()->get($feature->getName())->getPrice($this->getSubscription()->getCurrency(), $this->getSubscription()->getRenewInterval(), FeatureInterface::PRICE_GROSS);
$netPrice = $this->getConfiguredFeatures()->get($feature->getName())->getPrice($this->getSubscription()->getCurrency(), $this->getSubscription()->getRenewInterval(), FeatureInterface::PRICE_NET);
$quantity = 1;

break;
case SubscribedCountableFeature::class:
Expand Down
8 changes: 4 additions & 4 deletions src/Model/Feature/Subscribed/SubscribedCountableFeature.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ public function toArray(): array
}

return \array_merge([
IsRecurringFeatureInterface::FIELD_ACTIVE_UNTIL => json_decode(json_encode($this->getActiveUntil(), JSON_THROW_ON_ERROR), true, 512, JSON_THROW_ON_ERROR),
self::FIELD_SUBSCRIBED_PACK => $subscribedPack->toArray(),
self::FIELD_LAST_REFRESH_ON => json_decode(json_encode($this->getLastRefreshOn(), JSON_THROW_ON_ERROR), true, 512, JSON_THROW_ON_ERROR),
], parent::toArray(), $this->consumedToArray());
IsRecurringFeatureInterface::FIELD_ACTIVE_UNTIL => json_decode(json_encode($this->getActiveUntil(), JSON_THROW_ON_ERROR), true, 512, JSON_THROW_ON_ERROR),
self::FIELD_SUBSCRIBED_PACK => $subscribedPack->toArray(),
self::FIELD_LAST_REFRESH_ON => json_decode(json_encode($this->getLastRefreshOn(), JSON_THROW_ON_ERROR), true, 512, JSON_THROW_ON_ERROR),
], parent::toArray(), $this->consumedToArray());
}
}
2 changes: 1 addition & 1 deletion src/Model/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ abstract class Subscription implements SubscriptionInterface
*
* @ORM\Column(name="features", type="json", nullable=true)
*/
private null|array|SubscribedFeaturesCollection $features = null;
private array|SubscribedFeaturesCollection|null $features = null;

/** @ORM\Column(name="`renew_interval`", type="string", nullable=true) */
private ?string $renewInterval = null;
Expand Down

0 comments on commit 2c62614

Please sign in to comment.