Skip to content

Commit

Permalink
More cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Zombaya committed Dec 16, 2024
1 parent e38be8b commit 1ad0518
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 48 deletions.
20 changes: 0 additions & 20 deletions src-new/DependencyInjection/DoctrineEncryptExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,6 @@ public function load(array $configs, ContainerBuilder $container): void
$config = $this->processConfiguration(new Configuration($this->getAlias()), $configs);

(new ServiceConfigurator($this->versionTester, true))->configure($config, $container);

// Symfony 1-4
// Sanity-check since this should be blocked by composer.json
if (Kernel::MAJOR_VERSION < 5 || (Kernel::MAJOR_VERSION === 5 && Kernel::MINOR_VERSION < 4)) {
throw new \RuntimeException('doctrineencryptbundle/doctrine-encrypt-bundle expects symfony-version >= 5.4!');
}

// Wrap exceptions
if ($config['wrap_exceptions']) {
self::wrapExceptions(true);
} else {
trigger_deprecation(
'doctrineencryptbundle/doctrine-encrypt-bundle',
'5.4.2',
<<<'EOF'
Starting from 6.0, all exceptions thrown by this library will be wrapped by \Ambta\DoctrineEncryptBundle\Exception\DoctrineEncryptBundleException or a child-class of it.
You can start using these exceptions today by setting 'ambta_doctrine_encrypt.wrap_exceptions' to TRUE.
EOF
);
}
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src-new/DependencyInjection/ServiceConfigurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ public function configure(array $config, ContainerBuilder $container): void
trigger_deprecation(
'doctrineencryptbundle/doctrine-encrypt-bundle',
'5.4.2',
<<<'EOF'
<<<EOF
Starting from 6.0, all exceptions thrown by this library will be wrapped by \Ambta\DoctrineEncryptBundle\Exception\DoctrineEncryptBundleException or a child-class of it.
You can start using these exceptions today by setting $this->longPrefix.'.wrap_exceptions' to TRUE.
You can start using these exceptions today by setting '{$this->prefix}wrap_exceptions' to TRUE.
EOF
);
}
Expand Down
20 changes: 0 additions & 20 deletions src/DependencyInjection/DoctrineEncryptExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,6 @@ public function load(array $configs, ContainerBuilder $container): void
$config = $this->processConfiguration(new Configuration($this->getAlias()), $configs);

(new ServiceConfigurator($this->versionTester, false))->configure($config, $container);

// Symfony 1-4
// Sanity-check since this should be blocked by composer.json
if (Kernel::MAJOR_VERSION < 5 || (Kernel::MAJOR_VERSION === 5 && Kernel::MINOR_VERSION < 4)) {
throw new \RuntimeException('doctrineencryptbundle/doctrine-encrypt-bundle expects symfony-version >= 5.4!');
}

// Wrap exceptions
if ($config['wrap_exceptions']) {
self::wrapExceptions(true);
} else {
trigger_deprecation(
'doctrineencryptbundle/doctrine-encrypt-bundle',
'5.4.2',
<<<'EOF'
Starting from 6.0, all exceptions thrown by this library will be wrapped by \Ambta\DoctrineEncryptBundle\Exception\DoctrineEncryptBundleException or a child-class of it.
You can start using these exceptions today by setting 'ambta_doctrine_encrypt.wrap_exceptions' to TRUE.
EOF
);
}
}

/**
Expand Down
11 changes: 5 additions & 6 deletions tests/Unit/DependencyInjection/DoctrineEncryptExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,13 @@ public function testConfigLoadsCorrectServicesAndParameters(

$expectedServiceIds = array_merge(
array_keys($expectedServices),
array_keys($expectedAliases)
array_keys($expectedAliases),
[
\Psr\Container\ContainerInterface::class,
\Symfony\Component\DependencyInjection\ContainerInterface::class,
]
);

if (PHP_MAJOR_VERSION < 8) {
$expectedServiceIds[] = \Psr\Container\ContainerInterface::class;
$expectedServiceIds[] = \Symfony\Component\DependencyInjection\ContainerInterface::class;
}

$this->assertEqualsCanonicalizing($expectedServiceIds, $container->getServiceIds());

foreach ($expectedServices as $expectedService => $expectedValue) {
Expand Down

0 comments on commit 1ad0518

Please sign in to comment.