From 485e6980008cbc892dc0cdf5e9cdbd9d61717588 Mon Sep 17 00:00:00 2001 From: Malika Wakrim Date: Thu, 5 Oct 2023 15:55:57 +0200 Subject: [PATCH] Require PHP 8.1 or higher --- CHANGELOG.md | 11 +++++++++++ README.md | 4 ++-- composer.json | 6 +++--- src/Subscriber/EncryptionSubscriber.php | 6 +++--- 4 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..05f5de3 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ +# Changelog + +## 3.0.0 +### Breaking changes +- Minimum version of PHP 8.1 required +- The required Laminas dependencies have been updated to newer versions + +### Other +`EncryptionSubscriber.php` +If you use your own EncryptionSubscriber or extend from it: +All type declared values for the Doctrine manager have been changed from `ObjectManager $entityManager` to also support the EntityManager: `ObjectManager|EntityManager $entityManager` diff --git a/README.md b/README.md index 10d08df..84715fa 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,9 @@ Provides a Laminas & Doctrine 2 encryption module. With support for Mezzio. # Requirements - * PHP 7.2 or greater (must have Sodium extension enabled) + * PHP 8.1 or greater (must have Sodium extension enabled) -If you're on Windows, using Xampp, the PHP 7.2 installation might not automatically enable the Sodium extension. If this +If you're on Windows, using Xampp, the PHP 8.1 installation might not automatically enable the Sodium extension. If this the case, you'll get an error (`'This is not implemented, as it is not possible to securely wipe memory from PHP'`). Enable Sodium for PHP by adding this to your `php.ini` file: diff --git a/composer.json b/composer.json index b259e9c..e82343a 100644 --- a/composer.json +++ b/composer.json @@ -20,17 +20,17 @@ } ], "require": { - "php": " ~7.2 || 8.0.*", + "php": "^8.1.0", "ext-sodium": "*", "doctrine/annotations": "^1.6", "doctrine/orm": "^2.6", "doctrine/doctrine-module": "^4.1.1 || ^5.1", "paragonie/halite": "^4.4", "paragonie/hidden-string": "^1.0", - "laminas/laminas-modulemanager": "^2.8", + "laminas/laminas-modulemanager": "^2.14.0", "laminas/laminas-servicemanager": "^2.7.8 || ^3.3", "laminas/laminas-stdlib": "^3.2", - "laminas/laminas-dependency-plugin": "^2.0.0" + "laminas/laminas-dependency-plugin": "^2.5.0" }, "autoload": { "psr-4": { diff --git a/src/Subscriber/EncryptionSubscriber.php b/src/Subscriber/EncryptionSubscriber.php index 427dc23..369f2ea 100644 --- a/src/Subscriber/EncryptionSubscriber.php +++ b/src/Subscriber/EncryptionSubscriber.php @@ -87,7 +87,7 @@ public function __construct(Reader $reader, EncryptionInterface $encryptor) */ public function onFlush(OnFlushEventArgs $args) { - $objectManager = $args->getEntityManager(); + $objectManager = $args->getObjectManager(); $unitOfWork = $objectManager->getUnitOfWork(); $this->postFlushDecryptQueue = []; @@ -108,7 +108,7 @@ public function onFlush(OnFlushEventArgs $args) * * @throws \Doctrine\ORM\Mapping\MappingException */ - private function entityOnFlush(object $entity, ObjectManager $objectManager) + private function entityOnFlush(object $entity, ObjectManager|EntityManager $objectManager) { $objId = spl_object_hash($entity); $fields = []; @@ -425,4 +425,4 @@ public function setPostFlushDecryptQueue(array $postFlushDecryptQueue) : Encrypt return $this; } -} \ No newline at end of file +}