Skip to content

Commit

Permalink
Introduce more real constants
Browse files Browse the repository at this point in the history
  • Loading branch information
curry684 committed Jan 25, 2025
1 parent 5696766 commit a621ea5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/AntiSpamBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
/**
* @phpstan-type AntiSpamProfile array{passive: ?bool, banned_markup: array<string, mixed>, url_count: array<string, mixed>, banned_phrases: array<string, mixed>, banned_scripts: array<string, mixed>}
* @phpstan-type AntiSpamConfiguration array{enabled: bool, passive: bool, profiles: array<string, AntiSpamProfile>}
* @infection-ignore-all As infection cannot clear caches reliably mutating the bundle class has no effect
*/
class AntiSpamBundle extends AbstractBundle
{
public const TRANSLATION_DOMAIN = 'antispam';
public const ANTISPAM_ALIAS = 'antispam';
public const MONOLOG_CHANNEL_NAME = 'antispam';
public const TRANSLATION_DOMAIN = 'antispam';

protected string $extensionAlias = self::ANTISPAM_ALIAS;

Expand All @@ -61,8 +61,8 @@ public function loadExtension(array $config, ContainerConfigurator $container, C
{
$services = $container->services();
$services->defaults()->autowire()->autoconfigure();
$services->instanceof(LoggerAwareInterface::class)->tag('monolog.logger', ['channel' => 'antispam']);
$services->load('Omines\\AntiSpamBundle\\', __DIR__);
$services->instanceof(LoggerAwareInterface::class)->tag('monolog.logger', ['channel' => self::MONOLOG_CHANNEL_NAME]);
$services->load(__NAMESPACE__ . '\\', __DIR__);

$builder->setParameter('antispam.enabled', $config['enabled']);
foreach ($config['profiles'] as $name => $profile) {
Expand Down
2 changes: 2 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\ErrorHandler;
use Symfony\Component\Filesystem\Filesystem;

require dirname(__DIR__) . '/vendor/autoload_runtime.php';

Expand All @@ -21,3 +22,4 @@
set_exception_handler([new ErrorHandler(), 'handleException']);

(new Dotenv())->loadEnv(__DIR__ . '/Fixture/.env');
(new Filesystem())->remove(__DIR__ . '/Fixture/var/cache/test');

0 comments on commit a621ea5

Please sign in to comment.