Skip to content

Commit

Permalink
Merge pull request #18 from Schaaap/update-to-support-php-8
Browse files Browse the repository at this point in the history
Changes to support PHP 8 + remove support for PHP 7.2 or higher
  • Loading branch information
Dwarfex committed Nov 1, 2023
2 parents eee58c7 + 485e698 commit 4f38bca
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
6 changes: 3 additions & 3 deletions src/Subscriber/EncryptionSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand All @@ -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 = [];
Expand Down Expand Up @@ -425,4 +425,4 @@ public function setPostFlushDecryptQueue(array $postFlushDecryptQueue) : Encrypt

return $this;
}
}
}

0 comments on commit 4f38bca

Please sign in to comment.