Skip to content

Commit

Permalink
Rector, php-cs-fixer et phpstan (#1609)
Browse files Browse the repository at this point in the history
  • Loading branch information
stakovicz authored Feb 9, 2025
1 parent 238ac59 commit 2428832
Show file tree
Hide file tree
Showing 572 changed files with 6,421 additions and 7,446 deletions.
6 changes: 5 additions & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
$finder = (new PhpCsFixer\Finder())
->name('*.php')
->in([
__DIR__ . '/app',
__DIR__ . '/db',
__DIR__ . '/sources/AppBundle',
__DIR__ . '/htdocs',
__DIR__ . '/sources',
__DIR__ . '/tests',
])
;

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'@PHP74Migration:risky' => true,
'blank_line_after_opening_tag' => true,
'concat_space' => ['spacing' => 'one'],
'no_alias_functions' => true,
Expand Down
2 changes: 2 additions & 0 deletions app/AppCache.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;

class AppCache extends HttpCache
Expand Down
52 changes: 34 additions & 18 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
<?php

declare(strict_types=1);

use AppBundle\AppBundle;
use CCMBenchmark\TingBundle\TingBundle;
use Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle;
use Ekino\Bundle\NewRelicBundle\EkinoNewRelicBundle;
use EWZ\Bundle\RecaptchaBundle\EWZRecaptchaBundle;
use JMS\SerializerBundle\JMSSerializerBundle;
use KnpU\OAuth2ClientBundle\KnpUOAuth2ClientBundle;
use Presta\SitemapBundle\PrestaSitemapBundle;
use Symfony\Bundle\DebugBundle\DebugBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\MonologBundle\MonologBundle;
use Symfony\Bundle\SecurityBundle\SecurityBundle;
use Symfony\Bundle\TwigBundle\TwigBundle;
use Symfony\Bundle\WebProfilerBundle\WebProfilerBundle;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel;

Expand All @@ -8,23 +24,23 @@ 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\DoctrineCacheBundle\DoctrineCacheBundle(),
new \CCMBenchmark\TingBundle\TingBundle(),
new \KnpU\OAuth2ClientBundle\KnpUOAuth2ClientBundle(),
new AppBundle\AppBundle(),
new \JMS\SerializerBundle\JMSSerializerBundle(),
new Presta\SitemapBundle\PrestaSitemapBundle(),
new EWZ\Bundle\RecaptchaBundle\EWZRecaptchaBundle(),
new Ekino\Bundle\NewRelicBundle\EkinoNewRelicBundle(),
new FrameworkBundle(),
new SecurityBundle(),
new TwigBundle(),
new MonologBundle(),
new DoctrineCacheBundle(),
new TingBundle(),
new KnpUOAuth2ClientBundle(),
new AppBundle(),
new JMSSerializerBundle(),
new PrestaSitemapBundle(),
new EWZRecaptchaBundle(),
new EkinoNewRelicBundle(),
];

if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new DebugBundle();
$bundles[] = new WebProfilerBundle();
}

return $bundles;
Expand All @@ -37,16 +53,16 @@ public function getRootDir()

public function getCacheDir()
{
return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment();
}

public function getLogDir()
{
return dirname(__DIR__).'/var/logs';
return dirname(__DIR__) . '/var/logs';
}

public function registerContainerConfiguration(LoaderInterface $loader)
public function registerContainerConfiguration(LoaderInterface $loader): void
{
$loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
$loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{% block submenu %}
{{ render(controller(
'AppBundle\\Controller\\Website\\SecondaryMenuController::displayAction',
'AppBundle\\Controller\\Website\\SecondaryMenuController::display',
{ 'feuille_id': constant('Afup\\Site\\Corporate\\Feuille::ID_FEUILLE_ASSOCIATION') }
)) }}
{% endblock %}
Expand Down
2 changes: 1 addition & 1 deletion app/Resources/views/site/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
</div>
<div class="col-md-6 tablet-hidden">
<label class="pre-footer-newsletter-title" for="subscriber_email">Inscription à la newsletter</label>
{{ render(controller('AppBundle:Website\\Newsletter:subscribeForm')) }}
{{ render(controller('AppBundle\\Controller\\Website\\NewsletterController:subscribeForm')) }}
<span class="pre-footer-newsletter-caption">Tous les trois mois, des nouvelles de L'AFUP</span>
</div>
<div class="col-md-1 pre-footer-icon">
Expand Down
2 changes: 1 addition & 1 deletion app/Resources/views/site/become_member.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

{% block content %}
{{ render(controller(
'AppBundle\\Controller\\Website\\SecondaryMenuController::displayAction',
'AppBundle\\Controller\\Website\\SecondaryMenuController::display',
{ 'feuille_id': constant('Afup\\Site\\Corporate\\Feuille::ID_FEUILLE_ASSOCIATION') }
)) }}
<div class="mw1400p center" id="container">
Expand Down
2 changes: 1 addition & 1 deletion app/Resources/views/site/cms_page/display.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

{% block content %}
{{ render(controller(
'AppBundle\\Controller\\Website\\SecondaryMenuController::displayAction',
'AppBundle\\Controller\\Website\\SecondaryMenuController::display',
{ 'feuille_id': rubrique.feuille_associee }
)) }}
<div class="mw1400p center" id="container">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{% block submenu %}
{{ render(controller(
'AppBundle\\Controller\\Website\\SecondaryMenuController::displayAction',
'AppBundle\\Controller\\Website\\SecondaryMenuController::display',
{ 'feuille_id': constant('Afup\\Site\\Corporate\\Feuille::ID_FEUILLE_ASSOCIATION') }
)) }}
{% endblock %}
Expand Down
2 changes: 1 addition & 1 deletion app/Resources/views/site/meetups/list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

{% block content %}
{{ render(controller(
'AppBundle\\Controller\\Website\\SecondaryMenuController::displayAction',
'AppBundle\\Controller\\Website\\SecondaryMenuController::display',
{ 'feuille_id': constant('Afup\\Site\\Corporate\\Feuille::ID_FEUILLE_ANTENNES') }
)) }}

Expand Down
2 changes: 1 addition & 1 deletion app/Resources/views/site/news/list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
{% endif %}

{{ render(controller(
'AppBundle\\Controller\\Website\\PagerController::displayAction',
'AppBundle\\Controller\\Website\\PagerController::display',
{
'total_items': total_items,
'current_page': current_page,
Expand Down
2 changes: 1 addition & 1 deletion app/Resources/views/site/offices.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@

{% block content %}
{{ render(controller(
'AppBundle\\Controller\\Website\\SecondaryMenuController::displayAction',
'AppBundle\\Controller\\Website\\SecondaryMenuController::display',
{ 'feuille_id': constant('Afup\\Site\\Corporate\\Feuille::ID_FEUILLE_ANTENNES') }
)) }}
<div class="mw1400p center" id="container">
Expand Down
2 changes: 1 addition & 1 deletion app/Resources/views/site/techletter/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

{% block content %}
{{ render(controller(
'AppBundle\\Controller\\Website\\SecondaryMenuController::displayAction',
'AppBundle\\Controller\\Website\\SecondaryMenuController::display',
{ 'feuille_id': constant('Afup\\Site\\Corporate\\Feuille::ID_FEUILLE_NOS_ACTIONS') }
)) }}

Expand Down
6 changes: 4 additions & 2 deletions app/config/config.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<?php

declare(strict_types=1);

/**
* On charge les parameters depuis le .env ou .env.dist avec une conversion de nom en minuscule.
* À la migration vers Symfony 4+ ceci ne sera plus utile.
* On fait ça à cause du bundle Ting qui ne peut utiliser les "%env()%" comme paramètre.
*/
$path = dirname(__FILE__, 3);
$envFile = is_file($path.'/.env') ? $path.'/.env' : $path.'/.env.dist';
$envFile = is_file($path . '/.env') ? $path . '/.env' : $path . '/.env.dist';
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach ($lines as $line) {

if (strpos(trim($line), '#') === 0) {
continue;
}
Expand Down
8 changes: 4 additions & 4 deletions app/config/routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ planete_php_api:

badge_image:
path: /profile/badge/{id}
defaults: {_controller: AppBundle:Website\Badge:badge }
defaults: {_controller: AppBundle\Controller\Website\BadgeController::badge }

company_public_profile_logo:
path: /profile/company/{id}-{slug}/logo
defaults: {_controller: AppBundle:Website\CompanyPublicProfile:logo }
defaults: {_controller: AppBundle\Controller\Website\CompanyPublicProfileController::logo }

company_public_profile:
path: /profile/company/{id}-{slug}
defaults: {_controller: AppBundle:Website\CompanyPublicProfile:index }
defaults: {_controller: AppBundle\Controller\Website\CompanyPublicProfileController::index }

company_public_profile_list:
path: /profile/company
defaults: {_controller: AppBundle:Website\CompanyPublicProfileList:index }
defaults: {_controller: AppBundle\Controller\Website\CompanyPublicProfileListController::index }

feed_rss:
path: /rss.xml
Expand Down
4 changes: 2 additions & 2 deletions app/config/routing/admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ admin_home:

admin_vote:
path: /vote/
defaults: {_controller: AppBundle:Admin\Vote:admin}
defaults: {_controller: AppBundle\Controller\Admin\VoteController::admin}

admin_relances:
path: /association/relances/{page}
defaults: {_controller: AppBundle\Controller\Admin\Membership\ReminderLogAction}

admin_void:
path: /void
defaults: {_controller: AppBundle:Legacy:backOffice}
defaults: {_controller: AppBundle\Controller\LegacyController::backOffice}

admin_login:
path: /login
Expand Down
8 changes: 4 additions & 4 deletions app/config/routing/blog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

program:
path: /{eventSlug}/program
defaults: {_controller: AppBundle:Event\Blog:program}
defaults: {_controller: AppBundle\Controller\Event\BlogController::program}

speakers:
path: /{eventSlug}/speakers
defaults: {_controller: AppBundle:Event\Blog:speakers}
defaults: {_controller: AppBundle\Controller\Event\BlogController::speakers}

planning:
path: /{eventSlug}/planning
defaults: {_controller: AppBundle:Event\Blog:planning}
defaults: {_controller: AppBundle\Controller\Event\BlogController::planning}

talk_widget:
path: /talk_widget
defaults: {_controller: AppBundle:Event\Blog:talkWidget}
defaults: {_controller: AppBundle\Controller\Event\BlogController::talkWidget}
2 changes: 1 addition & 1 deletion app/config/routing/cms_page.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cms_page_display:
path: /{code}
defaults: { _controller: AppBundle:Website\CmsPage:display }
defaults: { _controller: AppBundle\Controller\Website\CmsPageController::display }
4 changes: 2 additions & 2 deletions app/config/routing/connection.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
connection_github_check:
path: /github/check
defaults: {_controller: AppBundle:Github:connectCheck}
defaults: {_controller: AppBundle\Controller\GithubController::connectCheck}

connection_github:
path: /github
defaults: {_controller: AppBundle:Github:connect}
defaults: {_controller: AppBundle\Controller\GithubController::connect}
Loading

0 comments on commit 2428832

Please sign in to comment.