cs: Enable risky rule is_null.

This commit is contained in:
Pol Dellaiera 2021-11-30 10:22:38 +01:00
parent e11c249131
commit 3631fd99fd
No known key found for this signature in database
GPG Key ID: D476DFE9C67467CA
6 changed files with 11 additions and 17 deletions

View File

@ -36,7 +36,7 @@ $riskyRules = [
'php_unit_no_expectation_annotation' => false, 'php_unit_no_expectation_annotation' => false,
'declare_strict_types' => false, 'declare_strict_types' => false,
'function_to_constant' => false, 'function_to_constant' => false,
'is_null' => false, 'is_null' => true,
'native_function_invocation' => false, 'native_function_invocation' => false,
'ternary_to_elvis_operator' => false, 'ternary_to_elvis_operator' => false,
// 'no_trailing_whitespace_in_string' => false, // 'no_trailing_whitespace_in_string' => false,

View File

@ -520,8 +520,8 @@ class ExportManager
if ($element instanceof ExportInterface || $element instanceof DirectExportInterface) { if ($element instanceof ExportInterface || $element instanceof DirectExportInterface) {
$role = $element->requiredRole(); $role = $element->requiredRole();
} elseif ($element instanceof ModifierInterface) { } elseif ($element instanceof ModifierInterface) {
if (is_null($element->addRole())) { if (null === $element->addRole()) {
if (is_null($export)) { if (null === $export) {
throw new LogicException('The export should not be null: as the ' throw new LogicException('The export should not be null: as the '
. 'ModifierInstance element is not an export, we should ' . 'ModifierInstance element is not an export, we should '
. 'be aware of the export to determine which role is required'); . 'be aware of the export to determine which role is required');

View File

@ -342,20 +342,17 @@ class SpreadSheetFormatter implements FormatterInterface
switch ($this->formatterData['format']) { switch ($this->formatterData['format']) {
case 'ods': case 'ods':
$writer = \PhpOffice\PhpSpreadsheet\IOFactory $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Ods');
::createWriter($spreadsheet, 'Ods');
break; break;
case 'xlsx': case 'xlsx':
$writer = \PhpOffice\PhpSpreadsheet\IOFactory $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
::createWriter($spreadsheet, 'Xlsx');
break; break;
case 'csv': case 'csv':
$writer = \PhpOffice\PhpSpreadsheet\IOFactory $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Csv');
::createWriter($spreadsheet, 'Csv');
break; break;

View File

@ -167,23 +167,20 @@ class SpreadsheetListFormatter implements FormatterInterface
switch ($this->formatterData['format']) { switch ($this->formatterData['format']) {
case 'ods': case 'ods':
$writer = \PhpOffice\PhpSpreadsheet\IOFactory $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Ods');
::createWriter($spreadsheet, 'Ods');
$contentType = 'application/vnd.oasis.opendocument.spreadsheet'; $contentType = 'application/vnd.oasis.opendocument.spreadsheet';
break; break;
case 'xlsx': case 'xlsx':
$writer = \PhpOffice\PhpSpreadsheet\IOFactory $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
::createWriter($spreadsheet, 'Xlsx');
$contentType = 'application/vnd.openxmlformats-officedocument.' $contentType = 'application/vnd.openxmlformats-officedocument.'
. 'spreadsheetml.sheet'; . 'spreadsheetml.sheet';
break; break;
case 'csv': case 'csv':
$writer = \PhpOffice\PhpSpreadsheet\IOFactory $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Csv');
::createWriter($spreadsheet, 'Csv');
$contentType = 'text/csv'; $contentType = 'text/csv';
break; break;

View File

@ -69,7 +69,7 @@ class RoleScopeScopePresence extends ConstraintValidator
} elseif // if the scope should be null } elseif // if the scope should be null
( (
in_array($value->getRole(), $this->roleProvider->getRolesWithoutScopes()) in_array($value->getRole(), $this->roleProvider->getRolesWithoutScopes())
&& !is_null($value->getScope()) && null !== $value->getScope()
) { ) {
$this->context->buildViolation($constraint->messageNullRequired) $this->context->buildViolation($constraint->messageNullRequired)
->setParameter('%role%', $this->translator->trans($value->getRole())) ->setParameter('%role%', $this->translator->trans($value->getRole()))

View File

@ -183,7 +183,7 @@ class HouseholdMemberController extends ApiController
$_format, $_format,
['groups' => ['read']] ['groups' => ['read']]
); );
} catch (Exception\InvalidArgumentException | Exception\UnexpectedValueException $e) { } catch (Exception\InvalidArgumentException|Exception\UnexpectedValueException $e) {
throw new BadRequestException("Deserialization error: {$e->getMessage()}", 45896, $e); throw new BadRequestException("Deserialization error: {$e->getMessage()}", 45896, $e);
} }