From fadaf6de29b35f7a9d6eb0ab5a420b94eee5af38 Mon Sep 17 00:00:00 2001 From: Benjamin Morel Date: Thu, 6 Oct 2022 00:06:51 +0200 Subject: [PATCH] Prevent subclassing AbstractMoney --- CHANGELOG.md | 1 + src/AbstractMoney.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 28529b5..0d2d67e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ 💥 **Breaking changes** - JSON extension is now required for PHP 7.4 (always available with PHP >= 8.0) +- `AbstractMoney` is now officially sealed, extending it yourself is not supported ✨ **New features** diff --git a/src/AbstractMoney.php b/src/AbstractMoney.php index 6ad176f..eb1e915 100644 --- a/src/AbstractMoney.php +++ b/src/AbstractMoney.php @@ -14,6 +14,9 @@ /** * Base class for Money and RationalMoney. + * + * Please consider this class sealed: extending this class yourself is not supported, and breaking changes (such as + * adding new abstract methods) can happen at any time, even in a minor version. */ abstract class AbstractMoney implements MoneyContainer, JsonSerializable {