Skip to content

Commit

Permalink
fix phpstan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rserry committed Jan 10, 2024
1 parent d717b57 commit d5e6f81
Show file tree
Hide file tree
Showing 30 changed files with 85 additions and 78 deletions.
7 changes: 7 additions & 0 deletions module/BrBundle/Controller/Admin/Match/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,14 @@ public function addAction()
$profile = $form->hydrateObject();
$this->getEntityManager()->persist($profile);
$pmap = new ProfileCompanyMap($company, $profile);
} else {
$this->flashMessenger()->error(
'Error',
'Something went wrong.'
);
return new ViewModel();
}

$this->getEntityManager()->persist($pmap);

// // Add new features with their importances
Expand Down
52 changes: 30 additions & 22 deletions module/BrBundle/Controller/Career/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public function qrAction()
return new ViewModel();
}


$person = null;
if ($this->getAuthentication()->isAuthenticated()) {
$person = $this->getAuthentication()->getPersonObject();
}
Expand Down Expand Up @@ -331,6 +331,8 @@ public function qrAction()
->getRepository('BrBundle\Entity\Event\Visitor')
->findByEventAndQr($event, $qr);

$color = null;
$textColor = null;
if ($visitor == null) {
// If there is no such result, then the person must be entering
$entry = true;
Expand Down Expand Up @@ -369,7 +371,7 @@ public function qrAction()
'entry' => $entry,
'firstTime' => ($previousVisits == null),
'color' => $color,
'textColor' => $textColor
'textColor' => $textColor,
)
);
}
Expand Down Expand Up @@ -414,11 +416,12 @@ public function overviewMatchesAction()
return new ViewModel();
}

$person = null;
if ($this->getAuthentication()->isAuthenticated()) {
$person = $this->getAuthentication()->getPersonObject();
}

if ($person === null || !($person instanceof Corporate)) {
if (!($person instanceof Corporate)) {
$this->flashMessenger()->error(
'Error',
"You are not logged in and can't view any matches!"
Expand All @@ -444,6 +447,8 @@ public function overviewMatchesAction()
->getResult();

$entries = array();
$gradesMapEnabled = null;
$gradesMap = null;
if (!is_null($matches) && in_array($this->getCurrentAcademicYear(), $person->getCompany()->getCvBookYears())) {
$gradesMapEnabled = $this->getEntityManager()->getRepository('CommonBundle\Entity\General\Config')
->getConfigValue('br.cv_grades_map_enabled');
Expand All @@ -455,7 +460,7 @@ public function overviewMatchesAction()
foreach ($matches as $match) {
$entry = $match->getStudentCV($this->getEntityManager(), $this->getCurrentAcademicYear());

if ($entry != false) {
if ($entry) {
$entries[] = array('id' => $match->getId(), 'cv' => $entry);
}
}
Expand Down Expand Up @@ -487,30 +492,33 @@ public function csvAction() {
return new ViewModel();
}

$person = null;
if ($this->getAuthentication()->isAuthenticated()) {
$person = $this->getAuthentication()->getPersonObject();
}

$companyMap = $this->getEntityManager()
->getRepository('BrBundle\Entity\Event\CompanyMap')
->findByEventAndCompany($event, $person->getCompany());
if ($person instanceof Corporate) {
$companyMap = $this->getEntityManager()
->getRepository('BrBundle\Entity\Event\CompanyMap')
->findByEventAndCompany($event, $person->getCompany());

$matches = $this->getEntityManager()
->getRepository('BrBundle\Entity\Event\Connection')
->findAllByCompanyMapQuery($companyMap)
->getResult();
$matches = $this->getEntityManager()
->getRepository('BrBundle\Entity\Event\Connection')
->findAllByCompanyMapQuery($companyMap)
->getResult();

foreach ($matches as $match) {
$subscription = $match->getSubscription();
$results[] = array(
$subscription->getFirstName(),
$subscription->getLastName(),
$subscription->getStudyString(),
$subscription->getSpecialization(),
$subscription->getEmail(),
$subscription->getPhoneNumber(),
$match->getNotes(),
);
foreach ($matches as $match) {
$subscription = $match->getSubscription();
$results[] = array(
$subscription->getFirstName(),
$subscription->getLastName(),
$subscription->getStudyString(),
$subscription->getSpecialization(),
$subscription->getEmail(),
$subscription->getPhoneNumber(),
$match->getNotes(),
);
}
}
$document = new CsvGenerator($heading, $results);
$document->generateDocument($file);
Expand Down
23 changes: 14 additions & 9 deletions module/BrBundle/Controller/Career/MatchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

use BrBundle\Entity\Company;
use BrBundle\Entity\Connection;
use BrBundle\Entity\Match\Profile\CompanyProfile;
use BrBundle\Entity\Match\Profile\ProfileFeatureMap;
use BrBundle\Entity\Match\Profile\ProfileStudentMap;
use BrBundle\Entity\Match\Profile\StudentProfile;
use BrBundle\Entity\Match\Wave;
use Laminas\Mail\Message;
use Laminas\View\Model\ViewModel;
Expand Down Expand Up @@ -166,14 +168,14 @@ public function addProfileAction()
// Get the correct form by profile type and check whether there already exists one of this type!
if ($type == 'company') {
foreach ($profiles as $p) {
if ($p instanceof Match\Profile\CompanyProfile) {
if ($p instanceof CompanyProfile) {
return new ViewModel();
}
}
$form = $this->getForm('br_career_match_company_add');
} else {
foreach ($profiles as $p) {
if ($p instanceof Match\Profile\StudentProfile) {
if ($p instanceof StudentProfile) {
return new ViewModel();
}
}
Expand All @@ -197,10 +199,11 @@ public function addProfileAction()
$form->setData($formData);

if ($form->isValid()) {
$profile = null;
if ($type == 'company') {
$profile = new Match\Profile\CompanyProfile();
$profile = new CompanyProfile();
} elseif ($type == 'student') {
$profile = new Match\Profile\StudentProfile();
$profile = new StudentProfile();
}
$this->getEntityManager()->persist($profile);

Expand Down Expand Up @@ -296,15 +299,16 @@ public function viewProfileAction()
}

// Get the correct form by profile type and check whether there already exists one of this type!
$profile = null;
if ($type == 'company') {
foreach ($profiles as $p) {
if ($p->getProfile() instanceof Match\Profile\CompanyProfile) {
if ($p->getProfile() instanceof CompanyProfile) {
$profile = $p->getProfile();
}
}
} else {
foreach ($profiles as $p) {
if ($p->getProfile() instanceof Match\Profile\StudentProfile) {
if ($p->getProfile() instanceof StudentProfile) {
$profile = $p->getProfile();
}
}
Expand All @@ -313,7 +317,7 @@ public function viewProfileAction()
return new ViewModel(
array(
'type' => $type,
'features' => $profile->getFeatures()->toArray(),
'features' => $profile ? $profile->getFeatures()->toArray() : null,
)
);
}
Expand All @@ -337,16 +341,17 @@ public function editProfileAction()

$form = null;
// Get the correct form by profile type and check whether there already exists one of this type!
$profile = null;
if ($type == 'company') {
foreach ($profiles as $p) {
if ($p->getProfile() instanceof Match\Profile\CompanyProfile) {
if ($p->getProfile() instanceof CompanyProfile) {
$profile = $p->getProfile();
$form = $this->getForm('br_career_match_company_edit', array('profile' => $profile));
}
}
} else {
foreach ($profiles as $p) {
if ($p->getProfile() instanceof Match\Profile\StudentProfile) {
if ($p->getProfile() instanceof StudentProfile) {
$profile = $p->getProfile();
$form = $this->getForm('br_career_match_student_edit', array('profile' => $profile));
}
Expand Down
22 changes: 13 additions & 9 deletions module/BrBundle/Controller/Corporate/MatchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

namespace BrBundle\Controller\Corporate;

use BrBundle\Entity\Connection;
use BrBundle\Entity\Match\Profile\CompanyProfile;
use BrBundle\Entity\Match\Profile\ProfileCompanyMap;
use BrBundle\Entity\Match\Profile\ProfileFeatureMap;
use BrBundle\Entity\Match\Profile\StudentProfile;
use BrBundle\Entity\Match\Wave;
use Laminas\View\Model\ViewModel;

Expand Down Expand Up @@ -159,7 +160,7 @@ public function addProfileAction()
// Get the correct form by profile type and check whether there already exists one of this type!
if ($type == 'company') {
foreach ($profiles as $p) {
if (!is_null($profiles) && $p instanceof Match\Profile\CompanyProfile) {
if (!is_null($profiles) && $p instanceof CompanyProfile) {
$this->redirect()->toRoute(
'br_corporate_match',
array(
Expand All @@ -173,7 +174,7 @@ public function addProfileAction()
$form = $this->getForm('br_corporate_match_company_add');
} else {
foreach ($profiles as $p) {
if (!is_null($profiles) && $p instanceof Match\Profile\StudentProfile) {
if (!is_null($profiles) && $p instanceof StudentProfile) {
$this->redirect()->toRoute(
'br_corporate_match',
array(
Expand Down Expand Up @@ -203,10 +204,11 @@ public function addProfileAction()
$form->setData($formData);

if ($form->isValid()) {
$profile = null;
if ($type == 'company') {
$profile = new Match\Profile\CompanyProfile();
$profile = new CompanyProfile();
} elseif ($type == 'student') {
$profile = new Match\Profile\StudentProfile();
$profile = new StudentProfile();
}
$this->getEntityManager()->persist($profile);

Expand Down Expand Up @@ -305,15 +307,16 @@ public function viewProfileAction()
}

// Get the correct form by profile type and check whether there already exists one of this type!
$profile = null;
if ($type == 'company') {
foreach ($profiles as $p) {
if ($p->getProfile() instanceof Match\Profile\CompanyProfile) {
if ($p->getProfile() instanceof CompanyProfile) {
$profile = $p->getProfile();
}
}
} else {
foreach ($profiles as $p) {
if ($p->getProfile() instanceof Match\Profile\StudentProfile) {
if ($p->getProfile() instanceof StudentProfile) {
$profile = $p->getProfile();
}
}
Expand Down Expand Up @@ -354,16 +357,17 @@ public function editProfileAction()

$form = null;
// Get the correct form by profile type and check whether there already exists one of this type!
$profile = null;
if ($type == 'company') {
foreach ($profiles as $p) {
if ($p->getProfile() instanceof Match\Profile\CompanyProfile) {
if ($p->getProfile() instanceof CompanyProfile) {
$profile = $p->getProfile();
$form = $this->getForm('br_corporate_match_company_edit', array('profile' => $profile));
}
}
} else {
foreach ($profiles as $p) {
if ($p->getProfile() instanceof Match\Profile\StudentProfile) {
if ($p->getProfile() instanceof StudentProfile) {
$profile = $p->getProfile();
$form = $this->getForm('br_corporate_match_student_edit', array('profile' => $profile));
}
Expand Down
1 change: 1 addition & 0 deletions module/BrBundle/Entity/Company/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use BrBundle\Entity\User\Person\Corporate;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use RuntimeException;

/**
* This entity stores the node item.
Expand Down
2 changes: 1 addition & 1 deletion module/BrBundle/Hydrator/Event/Company.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected function doExtract($object = null)
protected function doHydrate(array $data, $object = null)
{
if ($object === null) {
$object = new EventEntity();
$object = new EventEntity($this->getPersonEntity());
}

$object = $this->stdHydrate($data, $object, self::$stdKeys);
Expand Down
1 change: 0 additions & 1 deletion module/BrBundle/Repository/Company.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public function findAllAttendingJobfair()
->where(
$query->expr()->eq('c.attendsJobfair', 'true'),
)
->setParameter('name', '%' . strtolower($name) . '%')
->orderBy('c.name', 'ASC')
->getQuery();
}
Expand Down
1 change: 0 additions & 1 deletion module/BrBundle/Resources/translations/career.en.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'Most Recent' => 'Most Recent',
'All' => 'All',
'View Site' => 'View Site',
'Events' => 'Events',
'View Jobs' => 'View Jobs',

'Welcome to the online BR platform! Here you can find interesting job or internship offers, check out the latest event info or just explore what kind of companies are out there.' => 'Welcome to the online BR platform! Here you can find interesting job or internship offers, check out the latest event info or just explore what kind of companies are out there.',
Expand Down
1 change: 0 additions & 1 deletion module/BrBundle/Resources/translations/career.nl.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'Most Recent' => 'Meest Recent',
'All' => 'Alle',
'View Site' => 'Website bekijken',
'Events' => 'Evenementen',
'View Jobs' => 'Jobs bekijken',

'Welcome to the online BR platform! Here you can find interesting job or internship offers, check out the latest event info or just explore what kind of companies are out there.' => 'Welkom bij het online BR platform! Hier kan je op een eenvoudige wijze interessante job- en stage-aanbiedingen bekijken, de laatste informatie over bedrijfsevenementen terugvinden of gewoon eens het bedrijvenlandschap verkennen.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ private function getData(EntityManager $entityManager, AcademicYear $academicYea
$data = array();
foreach ($articles as $article) {
$codes = $this->getSubjectCode($entityManager, $academicYear, $article);
$articleData = array();
if ($codes) {
foreach ($codes as $code) {
$articleData = array(
Expand Down
1 change: 1 addition & 0 deletions module/CudiBundle/Form/Admin/Stock/Order/SetDelivered.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function init()
->findAllByOrderOnBarcode($this->order);
}

$items = array();
foreach ($orderItems as $item) {
$items[] = array(
'type' => 'text',
Expand Down
1 change: 0 additions & 1 deletion module/CudiBundle/Resources/translations/site.en.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
'Disable catalog update mails' => 'Disable catalog update mails',

'Color' => 'Color',
'Bought' => 'Bought',

'You sent out a mail for the selected retail!' => 'You sent out a mail for the selected retail!',
'You canceled your interest in the selected retail!' => 'You canceled your interest in the selected retail!',
Expand Down
1 change: 0 additions & 1 deletion module/CudiBundle/Resources/translations/site.nl.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
'Disable catalog update mails' => 'Disable catalog update mails',

'Color' => 'Color',
'Bought' => 'Bought',

'You sent out a mail for the selected retail!' => 'Er is een e-mail verzonden naar de verkoper!',
'You canceled your interest in the selected retail!' => 'Je hebt je aanvraag voor de geselecteerde aanbieding verwijderd!',
Expand Down
2 changes: 1 addition & 1 deletion module/GalleryBundle/Controller/GalleryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ private function getPhotoEntity()
return $photo;
}

private function getEventEntityByPoster()
private function getAlbumEntityByPoster()
{
$album = $this->getEntityById('GalleryBundle\Entity\Album', 'name', 'poster');

Expand Down
Loading

0 comments on commit d5e6f81

Please sign in to comment.