mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-28 12:40:08 +02:00
Added an PHP CS fixer config file and applied it to files.
We now use the same the same style as the symfony project, and it allows us to simply fix the style by executing php_cs_fixer fix in the project root.
This commit is contained in:
parent
89258bc102
commit
e557bdedd5
210 changed files with 2099 additions and 2742 deletions
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony)
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
|
@ -17,12 +17,10 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
namespace App\EventSubscriber;
|
||||
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
|
||||
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
|
||||
|
@ -31,11 +29,9 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||
|
||||
/**
|
||||
* This event listener shows an login successful flash to the user after login.
|
||||
* @package App\EventSubscriber
|
||||
*/
|
||||
class LoginSuccessListener implements EventSubscriberInterface
|
||||
{
|
||||
|
||||
protected $translator;
|
||||
protected $flashBag;
|
||||
|
||||
|
@ -72,4 +68,4 @@ class LoginSuccessListener implements EventSubscriberInterface
|
|||
{
|
||||
return [SecurityEvents::INTERACTIVE_LOGIN => 'onLogin'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony)
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
|
@ -17,27 +17,20 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
namespace App\EventSubscriber;
|
||||
|
||||
|
||||
use App\Entity\UserSystem\User;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
|
||||
use Symfony\Component\HttpKernel\Event\ControllerEvent;
|
||||
use Symfony\Component\HttpKernel\Event\RequestEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Security\Http\SecurityEvents;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class LogoutOnDisabledUserListener implements EventSubscriberInterface
|
||||
{
|
||||
|
||||
protected $security;
|
||||
protected $translator;
|
||||
protected $flashBag;
|
||||
|
@ -82,4 +75,4 @@ class LogoutOnDisabledUserListener implements EventSubscriberInterface
|
|||
{
|
||||
return [KernelEvents::REQUEST => 'onRequest'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony)
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
|
@ -17,19 +17,16 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
namespace App\EventSubscriber;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\EventDispatcher\Tests\Debug\EventSubscriber;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
|
||||
class SymfonyDebugToolbarSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
|
||||
protected $kernel;
|
||||
|
||||
public function __construct(ContainerInterface $kernel)
|
||||
|
@ -60,7 +57,6 @@ class SymfonyDebugToolbarSubscriber implements EventSubscriberInterface
|
|||
return ['kernel.response' => 'onKernelResponse'];
|
||||
}
|
||||
|
||||
|
||||
public function onKernelResponse(FilterResponseEvent $event)
|
||||
{
|
||||
if (!$this->kernel->getParameter('kernel.debug')) {
|
||||
|
@ -70,5 +66,4 @@ class SymfonyDebugToolbarSubscriber implements EventSubscriberInterface
|
|||
$response = $event->getResponse();
|
||||
$response->headers->set('Symfony-Debug-Toolbar-Replace', 1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony)
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
|
@ -17,12 +17,10 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
namespace App\EventSubscriber;
|
||||
|
||||
|
||||
use App\Entity\UserSystem\User;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpKernel\Event\ControllerEvent;
|
||||
|
@ -31,11 +29,9 @@ use Symfony\Component\Security\Core\Security;
|
|||
|
||||
/**
|
||||
* The purpose of this event listener is to set the timezone to the one preferred by the user.
|
||||
* @package App\EventSubscriber
|
||||
*/
|
||||
class TimezoneListener implements EventSubscriberInterface
|
||||
{
|
||||
|
||||
protected $default_timezone;
|
||||
protected $security;
|
||||
|
||||
|
@ -56,14 +52,13 @@ class TimezoneListener implements EventSubscriberInterface
|
|||
}
|
||||
|
||||
//Fill with default value if needed
|
||||
if ($timezone === null && !empty($this->default_timezone)) {
|
||||
if (null === $timezone && !empty($this->default_timezone)) {
|
||||
$timezone = $this->default_timezone;
|
||||
}
|
||||
|
||||
//If timezone was configured anywhere set it, otherwise just use the one from php.ini
|
||||
if ($timezone !== null) {
|
||||
if (null !== $timezone) {
|
||||
date_default_timezone_set($timezone);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,7 +84,7 @@ class TimezoneListener implements EventSubscriberInterface
|
|||
{
|
||||
//Set the timezone shortly before executing the controller
|
||||
return [
|
||||
KernelEvents::CONTROLLER => 'setTimeZone'
|
||||
KernelEvents::CONTROLLER => 'setTimeZone',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue