mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
cs: Switch to a stricter way of coding - this might break in a lot of places.
This commit is contained in:
@@ -7,6 +7,15 @@
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers.
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Command;
|
||||
|
||||
use Chill\CustomFieldsBundle\Service\CustomFieldProvider;
|
||||
@@ -273,7 +282,7 @@ final class ImportPeopleFromCSVCommand extends Command
|
||||
protected function createPerson(array $row, array $headers): Person
|
||||
{
|
||||
// trying to get the opening date
|
||||
$openingDateString = trim($row[array_search('opening_date', $headers)]);
|
||||
$openingDateString = trim($row[array_search('opening_date', $headers, true)]);
|
||||
$openingDate = $this->processDate($openingDateString, $this->input->getOption('opening_date_format'));
|
||||
|
||||
// @TODO: Fix the constructor parameter, $openingDate does not exists.
|
||||
@@ -358,7 +367,7 @@ final class ImportPeopleFromCSVCommand extends Command
|
||||
}
|
||||
|
||||
// handle address
|
||||
if (in_array('postalcode', $headers)) {
|
||||
if (in_array('postalcode', $headers, true)) {
|
||||
if (!empty($postalCodeValue)) {
|
||||
$address = new Address();
|
||||
$postalCode = $this->guessPostalCode($postalCodeValue, $localityValue ?? '');
|
||||
@@ -369,7 +378,7 @@ final class ImportPeopleFromCSVCommand extends Command
|
||||
|
||||
$address->setPostcode($postalCode);
|
||||
|
||||
if (in_array('street1', $headers)) {
|
||||
if (in_array('street1', $headers, true)) {
|
||||
$address->setStreetAddress1($street1Value);
|
||||
}
|
||||
$address->setValidFrom(new DateTime('today'));
|
||||
@@ -481,7 +490,7 @@ final class ImportPeopleFromCSVCommand extends Command
|
||||
return $this->em->getRepository(Center::class)->find($this->input->getOption('force-center'));
|
||||
}
|
||||
|
||||
$columnCenter = array_search('center', $headers);
|
||||
$columnCenter = array_search('center', $headers, true);
|
||||
$centerName = trim($row[$columnCenter]);
|
||||
|
||||
try {
|
||||
@@ -775,7 +784,7 @@ final class ImportPeopleFromCSVCommand extends Command
|
||||
|
||||
$resource = fopen($filename, 'rb');
|
||||
|
||||
if (false == $resource) {
|
||||
if (false === $resource) {
|
||||
throw new RuntimeException("The file '{$filename}' could not be opened.");
|
||||
}
|
||||
|
||||
@@ -870,7 +879,7 @@ final class ImportPeopleFromCSVCommand extends Command
|
||||
// we could guess an answer !
|
||||
$this->logger->info('This question accept multiple answers');
|
||||
$this->cacheAnswersMapping[$cf->getSlug()][$value] =
|
||||
false == $view->vars['multiple'] ? $values[0] : [$values[0]];
|
||||
false === $view->vars['multiple'] ? $values[0] : [$values[0]];
|
||||
$this->logger->info(sprintf(
|
||||
"Guessed that value '%s' match with key '%s' "
|
||||
. 'because the CSV and the label are equals.',
|
||||
@@ -1097,8 +1106,8 @@ final class ImportPeopleFromCSVCommand extends Command
|
||||
foreach ($firstRow as $key => $content) {
|
||||
$content = trim($content);
|
||||
|
||||
if (in_array($content, $matchedColumnHeaders)) {
|
||||
$information = array_search($content, $matchedColumnHeaders);
|
||||
if (in_array($content, $matchedColumnHeaders, true)) {
|
||||
$information = array_search($content, $matchedColumnHeaders, true);
|
||||
$headers[$key] = $information;
|
||||
$this->logger->notice("Matched {$information} on column {$key} (displayed in the file as '{$content}')");
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user