1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-06-27 16:36:00 +00:00

Initial Rector fixes with basic configuration

This commit is contained in:
Yassine Guedidi 2025-04-05 13:08:13 +02:00
parent a679117736
commit 84eb99c59b
5 changed files with 90 additions and 42 deletions

View file

@ -1,8 +1,39 @@
<?php
use BabDev\PagerfantaBundle\BabDevPagerfantaBundle;
use Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle;
use Craue\ConfigBundle\CraueConfigBundle;
use DAMA\DoctrineTestBundle\DAMADoctrineTestBundle;
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
use Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle;
use Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle;
use FOS\JsRoutingBundle\FOSJsRoutingBundle;
use FOS\OAuthServerBundle\FOSOAuthServerBundle;
use FOS\RestBundle\FOSRestBundle;
use FOS\UserBundle\FOSUserBundle;
use JMS\SerializerBundle\JMSSerializerBundle;
use KPhoen\RulerZBundle\KPhoenRulerZBundle;
use Nelmio\ApiDocBundle\NelmioApiDocBundle;
use Nelmio\CorsBundle\NelmioCorsBundle;
use OldSound\RabbitMqBundle\OldSoundRabbitMqBundle;
use Scheb\TwoFactorBundle\SchebTwoFactorBundle;
use Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle;
use Sentry\SentryBundle\SentryBundle;
use Spiriit\Bundle\FormFilterBundle\SpiriitFormFilterBundle;
use Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle;
use Symfony\Bundle\DebugBundle\DebugBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\MakerBundle\MakerBundle;
use Symfony\Bundle\MonologBundle\MonologBundle;
use Symfony\Bundle\SecurityBundle\SecurityBundle;
use Symfony\Bundle\TwigBundle\TwigBundle;
use Symfony\Bundle\WebProfilerBundle\WebProfilerBundle;
use Symfony\Bundle\WebServerBundle\WebServerBundle;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\WebpackEncoreBundle\WebpackEncoreBundle;
use Twig\Extra\TwigExtraBundle\TwigExtraBundle;
use Wallabag\Import\ImportCompilerPass;
class AppKernel extends Kernel
@ -10,45 +41,45 @@ class AppKernel extends Kernel
public function registerBundles()
{
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new FOS\RestBundle\FOSRestBundle(),
new FOS\UserBundle\FOSUserBundle(),
new JMS\SerializerBundle\JMSSerializerBundle(),
new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
new Nelmio\CorsBundle\NelmioCorsBundle(),
new Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle(),
new Spiriit\Bundle\FormFilterBundle\SpiriitFormFilterBundle(),
new FOS\OAuthServerBundle\FOSOAuthServerBundle(),
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
new Scheb\TwoFactorBundle\SchebTwoFactorBundle(),
new KPhoen\RulerZBundle\KPhoenRulerZBundle(),
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
new Craue\ConfigBundle\CraueConfigBundle(),
new BabDev\PagerfantaBundle\BabDevPagerfantaBundle(),
new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(),
new Sentry\SentryBundle\SentryBundle(),
new Twig\Extra\TwigExtraBundle\TwigExtraBundle(),
new Symfony\WebpackEncoreBundle\WebpackEncoreBundle(),
new FrameworkBundle(),
new SecurityBundle(),
new TwigBundle(),
new MonologBundle(),
new DoctrineBundle(),
new SensioFrameworkExtraBundle(),
new FOSRestBundle(),
new FOSUserBundle(),
new JMSSerializerBundle(),
new NelmioApiDocBundle(),
new NelmioCorsBundle(),
new BazingaHateoasBundle(),
new SpiriitFormFilterBundle(),
new FOSOAuthServerBundle(),
new StofDoctrineExtensionsBundle(),
new SchebTwoFactorBundle(),
new KPhoenRulerZBundle(),
new DoctrineMigrationsBundle(),
new CraueConfigBundle(),
new BabDevPagerfantaBundle(),
new FOSJsRoutingBundle(),
new OldSoundRabbitMqBundle(),
new SentryBundle(),
new TwigExtraBundle(),
new WebpackEncoreBundle(),
];
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
$bundles[] = new DebugBundle();
$bundles[] = new WebProfilerBundle();
$bundles[] = new DoctrineFixturesBundle();
if ('test' === $this->getEnvironment()) {
$bundles[] = new DAMA\DoctrineTestBundle\DAMADoctrineTestBundle();
$bundles[] = new DAMADoctrineTestBundle();
}
if ('dev' === $this->getEnvironment()) {
$bundles[] = new Symfony\Bundle\MakerBundle\MakerBundle();
$bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
$bundles[] = new MakerBundle();
$bundles[] = new WebServerBundle();
}
}
@ -69,13 +100,13 @@ class AppKernel extends Kernel
{
$loader->load($this->getProjectDir() . '/app/config/config_' . $this->getEnvironment() . '.yml');
$loader->load(function (ContainerBuilder $container) {
$loader->load(function (ContainerBuilder $container): void {
// $container->setParameter('container.autowiring.strict_mode', true);
// $container->setParameter('container.dumper.inline_class_loader', true);
$container->addObjectResource($this);
});
$loader->load(function (ContainerBuilder $container) {
$loader->load(function (ContainerBuilder $container): void {
$this->processDatabaseParameters($container);
$this->defineRedisUrlEnvVar($container);
$this->defineRabbitMqUrlEnvVar($container);

16
rector.php Normal file
View file

@ -0,0 +1,16 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withPaths([
__DIR__ . '/app',
__DIR__ . '/fixtures',
__DIR__ . '/src',
__DIR__ . '/tests',
__DIR__ . '/web',
])
->withImportNames(importShortClasses: false)
->withTypeCoverageLevel(0);

View file

@ -31,7 +31,7 @@ class AuthenticatorProvider implements ExpressionFunctionProviderInterface
{
return new ExpressionFunction(
'request_html',
function () {
function (): void {
throw new \Exception('Not supported');
},
function (array $arguments, $uri) {
@ -44,7 +44,7 @@ class AuthenticatorProvider implements ExpressionFunctionProviderInterface
{
return new ExpressionFunction(
'preg_match',
function () {
function (): void {
throw new \Exception('Not supported');
},
function (array $arguments, $pattern, $html) {
@ -63,7 +63,7 @@ class AuthenticatorProvider implements ExpressionFunctionProviderInterface
{
return new ExpressionFunction(
'xpath',
function () {
function (): void {
throw new \Exception('Not supported');
},
function (array $arguments, $xpathQuery, $html) {

View file

@ -3,6 +3,7 @@
namespace Tests\Wallabag;
use Doctrine\ORM\EntityManagerInterface;
use Predis\Client;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
@ -118,7 +119,7 @@ abstract class WallabagTestCase extends WebTestCase
protected function checkRedis()
{
try {
$this->client->getContainer()->get(\Predis\Client::class)->connect();
$this->client->getContainer()->get(Client::class)->connect();
} catch (\Exception $e) {
$this->markTestSkipped('Redis is not installed/activated');
}

View file

@ -15,7 +15,7 @@ if (!isPartialRun()) {
'--force',
'--env=test',
'--no-debug',
]))->run(function ($type, $buffer) {
]))->run(function ($type, $buffer): void {
echo $buffer;
});
@ -25,7 +25,7 @@ if (!isPartialRun()) {
'doctrine:database:create',
'--env=test',
'--no-debug',
]))->mustRun(function ($type, $buffer) {
]))->mustRun(function ($type, $buffer): void {
echo $buffer;
});
@ -37,7 +37,7 @@ if (!isPartialRun()) {
'--env=test',
'--no-debug',
'-vv',
]))->mustRun(function ($type, $buffer) {
]))->mustRun(function ($type, $buffer): void {
echo $buffer;
});
@ -48,7 +48,7 @@ if (!isPartialRun()) {
'--no-interaction',
'--env=test',
'-v',
]))->mustRun(function ($type, $buffer) {
]))->mustRun(function ($type, $buffer): void {
echo $buffer;
});
}
@ -60,6 +60,6 @@ if (!isPartialRun()) {
'--no-interaction',
'--env=test',
'--no-debug',
]))->mustRun(function ($type, $buffer) {
]))->mustRun(function ($type, $buffer): void {
echo $buffer;
});