diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon
index b88679016..05c574064 100644
--- a/phpstan-baseline.neon
+++ b/phpstan-baseline.neon
@@ -170,11 +170,6 @@ parameters:
count: 1
path: src/Bundle/ChillCalendarBundle/Entity/Calendar.php
- -
- message: "#^Class RuntimeException referenced with incorrect case\\: RunTimeException\\.$#"
- count: 5
- path: src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php
-
-
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
count: 1
@@ -685,11 +680,6 @@ parameters:
count: 1
path: src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php
- -
- message: "#^Call to method Chill\\\\MainBundle\\\\Export\\\\Formatter\\\\SpreadSheetFormatter\\:\\:generateContent\\(\\) with incorrect case\\: generatecontent$#"
- count: 1
- path: src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php
-
-
message: "#^Foreach overwrites \\$key with its key variable\\.$#"
count: 1
@@ -1020,11 +1010,6 @@ parameters:
count: 1
path: src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
- -
- message: "#^Call to method Chill\\\\PersonBundle\\\\Entity\\\\AccompanyingPeriod\\:\\:getOpenParticipations\\(\\) with incorrect case\\: getOPenParticipations$#"
- count: 2
- path: src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
-
-
message: "#^Implicit array creation is not allowed \\- variable \\$centers might not exist\\.$#"
count: 1
diff --git a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php
index b037975ab..9da4803ed 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php
@@ -45,25 +45,25 @@ class CreateFieldsOnGroupCommand extends Command
{
const ARG_PATH = 'path';
const ARG_DELETE = 'delete';
-
+
/**
* @var CustomFieldProvider
*/
private $customFieldProvider;
-
+
/**
* @var EntityManager
*/
private $entityManager;
-
+
/**
* @var ValidatorInterface
*/
private $validator;
-
+
private $availableLanguages;
private $customizablesEntities;
-
+
/**
* CreateFieldsOnGroupCommand constructor.
*
@@ -87,7 +87,7 @@ class CreateFieldsOnGroupCommand extends Command
$this->customizablesEntities = $customizablesEntities;
parent::__construct();
}
-
+
protected function configure()
{
$this->setName('chill:custom_fields:populate_group')
@@ -111,7 +111,7 @@ class CreateFieldsOnGroupCommand extends Command
$em->remove($field);
}
}
-
+
/**
* @param InputInterface $input
* @param OutputInterface $output
@@ -120,18 +120,18 @@ class CreateFieldsOnGroupCommand extends Command
protected function execute(InputInterface $input, OutputInterface $output)
{
$helper = $this->getHelperSet()->get('question');
-
+
$em = $this->entityManager;
-
+
$customFieldsGroups = $em
->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')
->findAll();
-
+
if (count($customFieldsGroups) === 0) {
$output->writeln('There aren\'t any CustomFieldsGroup recorded'
. ' Please create at least one.');
- }
-
+ }
+
$table = new Table($output);
$table
->setHeaders(array_merge(
@@ -141,7 +141,7 @@ class CreateFieldsOnGroupCommand extends Command
->setRows($this->_prepareRows($customFieldsGroups))
->render()
;
-
+
$question = new Question(
"Enter the customfieldGroup's id on which the custom fields should be added: ");
$question->setNormalizer(
@@ -151,24 +151,23 @@ class CreateFieldsOnGroupCommand extends Command
return $customFieldsGroup;
}
}
- throw new \RunTimeException('The id does not match an existing '
- . 'CustomFieldsGroup');
+ throw new \RuntimeException('The id does not match an existing CustomFieldsGroup');
}
);
$customFieldsGroup = $helper->ask($input, $output, $question);
-
+
if ($input->getOption(self::ARG_DELETE)) {
$this->deleteFieldsForCFGroup($customFieldsGroup);
}
-
- $fieldsInput = $this->_parse($input->getArgument(self::ARG_PATH),
+
+ $fieldsInput = $this->_parse($input->getArgument(self::ARG_PATH),
$output);
-
+
$fields = $this->_addFields($customFieldsGroup, $fieldsInput, $output);
}
-
- private function _prepareRows ($customFieldsGroups)
+
+ private function _prepareRows ($customFieldsGroups)
{
$rows = array();
$languages = $this->availableLanguages;
@@ -177,8 +176,8 @@ class CreateFieldsOnGroupCommand extends Command
foreach ($this->customizablesEntities as $entry) {
$customizableEntities[$entry['class']] = $entry['name'];
}
-
- array_walk($customFieldsGroups,
+
+ array_walk($customFieldsGroups,
function(CustomFieldsGroup $customFieldGroup, $key)
use ($languages, &$rows, $customizableEntities) {
//set id and entity
@@ -186,7 +185,7 @@ class CreateFieldsOnGroupCommand extends Command
$customFieldGroup->getId(),
$customizableEntities[$customFieldGroup->getEntity()]
);
-
+
foreach ($languages as $lang) {
//todo replace with service to find lang when available
$row[] = (isset($customFieldGroup->getName()[$lang])) ?
@@ -196,42 +195,42 @@ class CreateFieldsOnGroupCommand extends Command
$rows[] = $row;
}
);
-
+
return $rows;
}
-
+
private function _parse($path, OutputInterface $output)
{
$parser = new Parser();
-
+
if (!file_exists($path)) {
- throw new \RunTimeException("file does not exist");
+ throw new \RuntimeException("file does not exist");
}
-
+
try {
$values = $parser->parse(file_get_contents($path));
} catch (ParseException $ex) {
- throw new \RunTimeException("The yaml file is not valid", 0, $ex);
+ throw new \RuntimeException("The yaml file is not valid", 0, $ex);
}
-
+
return $values;
}
-
+
private function _addFields(CustomFieldsGroup $group, $values, OutputInterface $output)
{
-
+
$em = $this->entityManager;
$languages = $this->availableLanguages;
-
+
foreach($values['fields'] as $slug => $field) {
//check the cf type exists
$cfType = $this->customFieldProvider->getCustomFieldByType($field['type']);
if ($cfType === NULL) {
- throw new \RunTimeException('the type '.$field['type'].' '
+ throw new \RuntimeException('the type '.$field['type'].' '
. 'does not exists');
}
-
+
$cf = new CustomField();
$cf->setSlug($slug)
->setName($field['name'])
@@ -239,7 +238,7 @@ class CreateFieldsOnGroupCommand extends Command
->setOrdering($field['ordering'])
->setType($field['type'])
->setCustomFieldsGroup($group);
-
+
//add to table
$names = array();
foreach ($languages as $lang) {
@@ -248,17 +247,17 @@ class CreateFieldsOnGroupCommand extends Command
$cf->getName()[$lang] :
'Not available in this language';
}
-
+
if ($this->validator->validate($cf)) {
$em->persist($cf);
$output->writeln("Adding Custom Field of type "
.$cf->getType()."\t with slug ".$cf->getSlug().
"\t and names : ".implode($names, ', ')."");
} else {
- throw new \RunTimeException("Error in field ".$slug);
+ throw new \RuntimeException("Error in field ".$slug);
}
}
-
+
$em->flush();
}
}
diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php
index d14ecb9ad..aed10a29f 100644
--- a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php
+++ b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php
@@ -229,7 +229,7 @@ class SpreadSheetFormatter implements FormatterInterface
$this->getContentType($this->formatterData['format']));
$this->tempfile = \tempnam(\sys_get_temp_dir(), '');
- $this->generatecontent();
+ $this->generateContent();
$f = \fopen($this->tempfile, 'r');
$response->setContent(\stream_get_contents($f));
diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
index 6c9c84b56..d08f39b1e 100644
--- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
+++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
@@ -544,7 +544,7 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
*/
public function actualParticipationsByHousehold(): array
{
- $participations = $this->getOPenParticipations()->toArray();
+ $participations = $this->getOpenParticipations()->toArray();
$households = [];
foreach ($participations as $p) {
@@ -1074,7 +1074,7 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
*/
public function getAvailablePersonLocation(): Collection
{
- return $this->getOPenParticipations()
+ return $this->getOpenParticipations()
->filter(function(AccompanyingPeriodParticipation $p) {
return $p->getPerson()->hasCurrentHouseholdAddress();
})