phpstan boolean corrections

This commit is contained in:
2025-10-09 13:57:30 +02:00
parent 03fa79c93b
commit b132956ddc
37 changed files with 149 additions and 623 deletions

View File

@@ -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)
)
);

View File

@@ -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.');
}

View File

@@ -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);

View File

@@ -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,

View File

@@ -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;
}
}

View File

@@ -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,

View File

@@ -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);