cs: Enable more risky rules.

This commit is contained in:
Pol Dellaiera
2021-11-30 11:37:57 +01:00
parent c8195e6df5
commit a9188355c5
193 changed files with 306 additions and 63 deletions

View File

@@ -38,7 +38,11 @@ use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Form\FormFactory;
use Symfony\Component\Form\FormFactoryInterface;
use function array_key_exists;
use function count;
use function file_get_contents;
use function get_class;
use function in_array;
use function is_array;
use function json_decode;
final class ImportPeopleFromCSVCommand extends Command
@@ -352,7 +356,7 @@ final class ImportPeopleFromCSVCommand extends Command
}
// handle address
if (\in_array('postalcode', $headers)) {
if (in_array('postalcode', $headers)) {
if (!empty($postalCodeValue)) {
$address = new Address();
$postalCode = $this->guessPostalCode($postalCodeValue, $localityValue ?? '');
@@ -363,7 +367,7 @@ final class ImportPeopleFromCSVCommand extends Command
$address->setPostcode($postalCode);
if (\in_array('street1', $headers)) {
if (in_array('street1', $headers)) {
$address->setStreetAddress1($street1Value);
}
$address->setValidFrom(new DateTime('today'));
@@ -516,13 +520,13 @@ final class ImportPeopleFromCSVCommand extends Command
->getResult();
if (count($centers) > 1) {
if (\strtolower($centers[0]->getName()) === \strtolower($centerName)) {
if (strtolower($centers[0]->getName()) === strtolower($centerName)) {
return $centers[0];
}
}
$centersByName = [];
$names = \array_map(function (Center $c) use (&$centersByName) {
$names = array_map(function (Center $c) use (&$centersByName) {
$n = $c->getName();
$centersByName[$n] = $c;
@@ -605,7 +609,7 @@ final class ImportPeopleFromCSVCommand extends Command
}
$postalCodeByName = [];
$names = \array_map(function (PostalCode $pc) use (&$postalCodeByName) {
$names = array_map(function (PostalCode $pc) use (&$postalCodeByName) {
$n = $pc->getName();
$postalCodeByName[$n] = $pc;