mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-04-08 22:13:45 +00:00
phpstan boolean corrections
This commit is contained in:
@@ -88,11 +88,11 @@ class LoadAndUpdateLanguagesCommand extends Command
|
||||
foreach (Languages::getNames() as $code => $lang) {
|
||||
$excludeCode = (
|
||||
(
|
||||
!$input->getOption(self::INCLUDE_REGIONAL_VERSION)
|
||||
null === $input->getOption(self::INCLUDE_REGIONAL_VERSION)
|
||||
&& strpos($code, '_')
|
||||
&& !\in_array($code, $this->regionalVersionToInclude, true)
|
||||
) || (
|
||||
!$input->getOption(self::INCLUDE_ANCIENT)
|
||||
null === $input->getOption(self::INCLUDE_ANCIENT)
|
||||
&& \in_array($code, $this->ancientToExclude, true)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -54,7 +54,7 @@ final class PermissionsGroupController extends AbstractController
|
||||
{
|
||||
$permissionsGroup = $this->permissionsGroupRepository->find($id);
|
||||
|
||||
if (!$permissionsGroup) {
|
||||
if (null === $permissionsGroup) {
|
||||
throw $this->createNotFoundException('Unable to find PermissionsGroup entity.');
|
||||
}
|
||||
|
||||
@@ -157,11 +157,11 @@ final class PermissionsGroupController extends AbstractController
|
||||
$permissionsGroup = $this->permissionsGroupRepository->find($pgid);
|
||||
$roleScope = $this->roleScopeRepository->find($rsid);
|
||||
|
||||
if (!$permissionsGroup) {
|
||||
if (null === $permissionsGroup) {
|
||||
throw $this->createNotFoundException('Unable to find PermissionsGroup entity.');
|
||||
}
|
||||
|
||||
if (!$roleScope) {
|
||||
if (null === $roleScope) {
|
||||
throw $this->createNotFoundException('Unable to find RoleScope entity');
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ final class PermissionsGroupController extends AbstractController
|
||||
{
|
||||
$permissionsGroup = $this->permissionsGroupRepository->find($id);
|
||||
|
||||
if (!$permissionsGroup) {
|
||||
if (null === $permissionsGroup) {
|
||||
throw $this->createNotFoundException('Unable to find PermissionsGroup entity.');
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ final class PermissionsGroupController extends AbstractController
|
||||
{
|
||||
$permissionsGroup = $this->permissionsGroupRepository->find($id);
|
||||
|
||||
if (!$permissionsGroup) {
|
||||
if (null === $permissionsGroup) {
|
||||
throw $this->createNotFoundException('Unable to find PermissionsGroup entity.');
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ final class PermissionsGroupController extends AbstractController
|
||||
$permissionsGroup = $this->permissionsGroupRepository
|
||||
->find($id);
|
||||
|
||||
if (!$permissionsGroup) {
|
||||
if (null === $permissionsGroup) {
|
||||
throw $this->createNotFoundException('Unable to find PermissionsGroup entity.');
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class UserController extends CRUDController
|
||||
|
||||
$user = $em->getRepository(User::class)->find($uid);
|
||||
|
||||
if (!$user) {
|
||||
if (null === $user) {
|
||||
throw $this->createNotFoundException('Unable to find User entity.');
|
||||
}
|
||||
|
||||
@@ -110,14 +110,14 @@ class UserController extends CRUDController
|
||||
|
||||
$user = $em->getRepository(User::class)->find($uid);
|
||||
|
||||
if (!$user) {
|
||||
if (null === $user) {
|
||||
throw $this->createNotFoundException('Unable to find User entity.');
|
||||
}
|
||||
|
||||
$groupCenter = $em->getRepository(GroupCenter::class)
|
||||
->find($gcid);
|
||||
|
||||
if (!$groupCenter) {
|
||||
if (null === $groupCenter) {
|
||||
throw $this->createNotFoundException('Unable to find groupCenter entity');
|
||||
}
|
||||
|
||||
@@ -434,7 +434,7 @@ class UserController extends CRUDController
|
||||
'permissionsGroup' => $permissionsGroup,
|
||||
]);
|
||||
|
||||
if (!$groupCenterManaged) {
|
||||
if (null === $groupCenterManaged) {
|
||||
$groupCenter = new GroupCenter();
|
||||
$groupCenter->setCenter($center);
|
||||
$groupCenter->setPermissionsGroup($permissionsGroup);
|
||||
|
||||
@@ -36,7 +36,7 @@ class AddressType extends AbstractType
|
||||
{
|
||||
$builder
|
||||
->add('street', TextType::class, [
|
||||
'required' => !$options['has_no_address'], // true if has no address is false
|
||||
'required' => false === $options['has_no_address'], // true if has no address is false
|
||||
])
|
||||
->add('streetNumber', TextType::class, [
|
||||
'required' => false,
|
||||
@@ -44,10 +44,10 @@ class AddressType extends AbstractType
|
||||
->add('postCode', PostalCodeType::class, [
|
||||
'label' => 'Postal code',
|
||||
'placeholder' => 'Choose a postal code',
|
||||
'required' => !$options['has_no_address'], // true if has no address is false
|
||||
'required' => false === $options['has_no_address'], // true if has no address is false
|
||||
]);
|
||||
|
||||
if ($options['has_valid_from']) {
|
||||
if (true === $options['has_valid_from']) {
|
||||
$builder
|
||||
->add(
|
||||
'validFrom',
|
||||
@@ -58,7 +58,7 @@ class AddressType extends AbstractType
|
||||
);
|
||||
}
|
||||
|
||||
if ($options['has_no_address']) {
|
||||
if (true === $options['has_no_address']) {
|
||||
$builder
|
||||
->add('isNoAddress', ChoiceType::class, [
|
||||
'required' => true,
|
||||
|
||||
@@ -30,7 +30,7 @@ final class ChillTextareaType extends AbstractType
|
||||
{
|
||||
public function buildView(FormView $view, FormInterface $form, array $options): void
|
||||
{
|
||||
if (!$options['disable_editor']) {
|
||||
if (false === $options['disable_editor']) {
|
||||
$view->vars['attr']['ckeditor'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ class UserType extends AbstractType
|
||||
]);
|
||||
|
||||
// @phpstan-ignore-next-line
|
||||
if ($options['is_creation'] && $this->parameterBag->get('chill_main.access_user_change_password')) {
|
||||
if ((true === $options['is_creation']) && $this->parameterBag->get('chill_main.access_user_change_password')) {
|
||||
$builder->add('plainPassword', RepeatedType::class, [
|
||||
'mapped' => false,
|
||||
'type' => PasswordType::class,
|
||||
|
||||
@@ -96,12 +96,12 @@ class SearchApiQuery
|
||||
{
|
||||
$isMultiple = \count($this->whereClauses);
|
||||
$where =
|
||||
($isMultiple ? '(' : '').
|
||||
($isMultiple > 0 ? '(' : '').
|
||||
\implode(
|
||||
($isMultiple ? ')' : '').' AND '.($isMultiple ? '(' : ''),
|
||||
($isMultiple > 0 ? ')' : '').' AND '.($isMultiple > 0 ? '(' : ''),
|
||||
$this->whereClauses
|
||||
).
|
||||
($isMultiple ? ')' : '');
|
||||
($isMultiple > 0 ? ')' : '');
|
||||
|
||||
$select = $this->buildSelectClause($countOnly);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user