Skip to content

Commit

Permalink
[TASK] Fix phpstan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
torben-fr authored and Riiiad committed Jul 23, 2024
1 parent 113941e commit 9b04a0c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
22 changes: 13 additions & 9 deletions Classes/Controller/JobController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
namespace FGTCLB\AcademicJobs\Controller;

use FGTCLB\AcademicJobs\DateTime\IsoDateTime;
use FGTCLB\AcademicJobs\Domain\Model\Contact;
use FGTCLB\AcademicJobs\Domain\Model\Job;
use FGTCLB\AcademicJobs\Domain\Repository\ContactRepository;
use FGTCLB\AcademicJobs\Domain\Repository\JobRepository;
use FGTCLB\AcademicJobs\Event\AfterSaveJobEvent;
use FGTCLB\AcademicJobs\Property\TypeConverter\JobAvatarImageUploadConverter;
Expand All @@ -27,7 +25,6 @@ class JobController extends ActionController

public function __construct(
private readonly JobRepository $jobRepository,
private readonly ContactRepository $contactRepository,
private readonly PersistenceManagerInterface $persistenceManager,
private readonly ImageService $imageService,
protected readonly BackendUriBuilder $backendUriBuilder,
Expand All @@ -45,6 +42,7 @@ public function showAction(Job $job): ResponseInterface
$description = strip_tags($job->getDescription());
$image = $this->getImageUri($job->getImage());

/** @var array<string, string> */
$metaTags = [
'title' => $title,
'description' => $description,
Expand All @@ -68,21 +66,23 @@ public function showAction(Job $job): ResponseInterface
return $this->htmlResponse();
}

/**
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference|null $imageObject
*/
public function getImageUri($imageObject): ?string
{
if ($imageObject === null) {
return null;
}
$originalResource = $imageObject->getOriginalResource();

if ($originalResource === null) {
return null;
}

return $this->imageService->getImageUri($originalResource, true);
}

private function setMetaTags(array $metaTags)
/**
* @param array<string, string> $metaTags
*/
private function setMetaTags(array $metaTags): void
{
$metaTagManager = GeneralUtility::makeInstance(MetaTagManagerRegistry::class);

Expand Down Expand Up @@ -165,7 +165,11 @@ public function saveJobAction(Job $job): void
$afterSaveJobEvent = new AfterSaveJobEvent($job);
$this->eventDispatcher->dispatch($afterSaveJobEvent);

$this->sendEmail($job->getUid());
$uid = $job->getUid();

if ($uid !== null) {
$this->sendEmail($uid);
}

$this->redirect('list');
}
Expand Down
4 changes: 4 additions & 0 deletions Classes/Domain/Repository/ContactRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@

namespace FGTCLB\AcademicJobs\Domain\Repository;

use FGTCLB\AcademicJobs\Domain\Model\Contact;
use TYPO3\CMS\Extbase\Persistence\Repository;

/**
* @extends Repository<Contact>
*/
class ContactRepository extends Repository
{
}
3 changes: 3 additions & 0 deletions Classes/Domain/Repository/JobRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
use TYPO3\CMS\Extbase\Persistence\Repository;

/**
* @extends Repository<Job>
*/
class JobRepository extends Repository
{
protected $defaultOrderings = [
Expand Down

0 comments on commit 9b04a0c

Please sign in to comment.