apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -12,7 +12,6 @@ declare(strict_types=1);
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Entity\Notification;
use DateTimeImmutable;
use Doctrine\Persistence\ObjectManager;
/**
@@ -27,14 +26,14 @@ trait LoadAbstractNotificationsTrait
foreach ($this->notifs as $notif) {
$entityId = $this->getReference($notif['entityRef'])->getId();
echo 'Adding notification for ' . $notif['entityClass'] . '(entity id:' . $entityId . ")\n";
echo 'Adding notification for '.$notif['entityClass'].'(entity id:'.$entityId.")\n";
$newNotif = (new Notification())
->setMessage($notif['message'])
->setSender($this->getReference($notif['sender']))
->setRelatedEntityClass($notif['entityClass'])
->setRelatedEntityId($entityId)
->setDate(new DateTimeImmutable('now'))
->setDate(new \DateTimeImmutable('now'))
->setRead([]);
foreach ($notif['addressees'] as $addressee) {

View File

@@ -50,7 +50,7 @@ class LoadAddressReferences extends AbstractFixture implements ContainerAwareInt
$manager->flush();
}
public function setContainer(?ContainerInterface $container = null)
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}

View File

@@ -43,7 +43,7 @@ class LoadCountries extends AbstractFixture implements ContainerAwareInterface,
$manager->flush();
}
public function setContainer(?ContainerInterface $container = null)
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}

View File

@@ -35,7 +35,7 @@ class LoadGroupCenters extends AbstractFixture implements OrderedFixtureInterfac
$manager->persist($GroupCenter);
$reference = $centerRef . '_' . $permissionGroupRef;
$reference = $centerRef.'_'.$permissionGroupRef;
$this->addReference($reference, $GroupCenter);
static::$refs[] = $reference;
echo "Creating {$reference}... \n";

View File

@@ -17,9 +17,6 @@ use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Intl\Intl;
use function in_array;
/**
* Load languages into database.
@@ -47,8 +44,8 @@ class LoadLanguages extends AbstractFixture implements ContainerAwareInterface,
foreach (\Symfony\Component\Intl\Languages::getNames() as $code => $language) {
if (
!in_array($code, $this->regionalVersionToInclude, true)
&& !in_array($code, $this->ancientToExclude, true)
!\in_array($code, $this->regionalVersionToInclude, true)
&& !\in_array($code, $this->ancientToExclude, true)
) {
$lang = (new Language())
->setId($code)
@@ -60,7 +57,7 @@ class LoadLanguages extends AbstractFixture implements ContainerAwareInterface,
$manager->flush();
}
public function setContainer(?ContainerInterface $container = null)
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}

View File

@@ -65,7 +65,7 @@ class LoadLocationType extends AbstractFixture implements ContainerAwareInterfac
$manager->flush();
}
public function setContainer(?ContainerInterface $container = null)
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}

View File

@@ -63,7 +63,7 @@ class LoadPermissionsGroup extends AbstractFixture implements OrderedFixtureInte
}
$manager->persist($permissionGroup);
$reference = 'permission_group_' . $new['name'];
$reference = 'permission_group_'.$new['name'];
echo "Creating {$reference} \n";
$this->setReference($reference, $permissionGroup);
static::$refs[] = $reference;

View File

@@ -18,9 +18,6 @@ use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use function strtolower;
use function ucwords;
/**
* Description of LoadPostalCodes.
*/
@@ -351,7 +348,7 @@ class LoadPostalCodes extends AbstractFixture implements OrderedFixtureInterface
$c = new PostalCode();
$c->setCountry($country)
->setCode($code[0])
->setName(ucwords(strtolower($code[1])));
->setName(\ucwords(\strtolower($code[1])));
if (null !== ($code[3] ?? null)) {
$c->setRefPostalCodeId($code[3]);
@@ -366,7 +363,7 @@ class LoadPostalCodes extends AbstractFixture implements OrderedFixtureInterface
}
$manager->persist($c);
$ref = 'postal_code_' . $code[0];
$ref = 'postal_code_'.$code[0];
if (!$this->hasReference($ref)) {
$this->addReference($ref, $c);

View File

@@ -56,7 +56,7 @@ class LoadRoleScopes extends AbstractFixture implements OrderedFixtureInterface
$roleScope = new RoleScope();
$roleScope->setRole($key)
->setScope($this->getReference($scopeReference));
$reference = 'role_scope_' . $key . '_' . $this->getReference($scopeReference)->getName()['en'];
$reference = 'role_scope_'.$key.'_'.$this->getReference($scopeReference)->getName()['en'];
echo "Creating {$reference} \n";
$this->addReference($reference, $roleScope);
$manager->persist($roleScope);

View File

@@ -58,7 +58,7 @@ class LoadScopes extends AbstractFixture implements OrderedFixtureInterface
$scope->setName($new['names']);
$manager->persist($scope);
$reference = 'scope_' . $new['names']['en'];
$reference = 'scope_'.$new['names']['en'];
$this->addReference($reference, $scope);
static::$references[] = $reference;
}

View File

@@ -15,14 +15,11 @@ use Chill\MainBundle\Entity\User;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use LogicException;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Security\Core\Encoder\EncoderFactory;
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
use function str_replace;
/**
* Load fixtures users into database.
*
@@ -81,13 +78,13 @@ class LoadUsers extends AbstractFixture implements ContainerAwareInterface, Orde
->getEncoder($user)
->encodePassword('password', $user->getSalt())
)
->setEmail(sprintf('%s@chill.social', str_replace(' ', '', (string) $username)));
->setEmail(sprintf('%s@chill.social', \str_replace(' ', '', (string) $username)));
foreach ($params['groupCenterRefs'] as $groupCenterRef) {
$user->addGroupCenter($this->getReference($groupCenterRef));
}
echo 'Creating user ' . $username . "... \n";
echo 'Creating user '.$username."... \n";
$manager->persist($user);
$this->addReference($username, $user);
}
@@ -95,10 +92,10 @@ class LoadUsers extends AbstractFixture implements ContainerAwareInterface, Orde
$manager->flush();
}
public function setContainer(?ContainerInterface $container = null)
public function setContainer(ContainerInterface $container = null)
{
if (null === $container) {
throw new LogicException('$container should not be null');
throw new \LogicException('$container should not be null');
}
$this->container = $container;