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,
'declare_strict_types' => false,
'function_to_constant' => false,
'is_null' => false,
'is_null' => true,
'native_function_invocation' => false,
'ternary_to_elvis_operator' => false,
// 'no_trailing_whitespace_in_string' => false,

View File

@ -520,8 +520,8 @@ class ExportManager
if ($element instanceof ExportInterface || $element instanceof DirectExportInterface) {
$role = $element->requiredRole();
} elseif ($element instanceof ModifierInterface) {
if (is_null($element->addRole())) {
if (is_null($export)) {
if (null === $element->addRole()) {
if (null === $export) {
throw new LogicException('The export should not be null: as the '
. 'ModifierInstance element is not an export, we should '
. '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']) {
case 'ods':
$writer = \PhpOffice\PhpSpreadsheet\IOFactory
::createWriter($spreadsheet, 'Ods');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Ods');
break;
case 'xlsx':
$writer = \PhpOffice\PhpSpreadsheet\IOFactory
::createWriter($spreadsheet, 'Xlsx');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
break;
case 'csv':
$writer = \PhpOffice\PhpSpreadsheet\IOFactory
::createWriter($spreadsheet, 'Csv');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Csv');
break;

View File

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

View File

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

View File

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