Skip to content

Commit

Permalink
[TASK] Raise PHP Language Level to 8.1 (#1577)
Browse files Browse the repository at this point in the history
Resolves: #1568
  • Loading branch information
DanielSiepmann authored Feb 3, 2025
1 parent 4442952 commit 39ed4cf
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 33 deletions.
25 changes: 7 additions & 18 deletions Classes/Controller/FrontEndEditorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,10 @@
*/
class FrontEndEditorController extends ActionController
{
private Context $context;

private TeaRepository $teaRepository;

public function __construct(Context $context, TeaRepository $teaRepository)
{
$this->context = $context;
$this->teaRepository = $teaRepository;
}
public function __construct(
private readonly Context $context,
private readonly TeaRepository $teaRepository,
) {}

public function indexAction(): ResponseInterface
{
Expand All @@ -48,9 +43,7 @@ private function getUidOfLoggedInUser(): int
return $userUid;
}

/**
* @Extbase\IgnoreValidation("tea")
*/
#[Extbase\IgnoreValidation(['argumentName' => 'tea'])]
public function editAction(Tea $tea): ResponseInterface
{
$this->checkIfUserIsOwner($tea);
Expand Down Expand Up @@ -79,9 +72,7 @@ public function updateAction(Tea $tea): ResponseInterface
return $this->redirect('index');
}

/**
* @Extbase\IgnoreValidation("tea")
*/
#[Extbase\IgnoreValidation(['argumentName' => 'tea'])]
public function newAction(?Tea $tea = null): ResponseInterface
{
// Note: We are using `makeInstance` here instead of `new` to allow for XCLASSing.
Expand All @@ -100,9 +91,7 @@ public function createAction(Tea $tea): ResponseInterface
return $this->redirect('index');
}

/**
* @Extbase\IgnoreValidation("tea")
*/
#[Extbase\IgnoreValidation(['argumentName' => 'tea'])]
public function deleteAction(Tea $tea): ResponseInterface
{
$this->checkIfUserIsOwner($tea);
Expand Down
9 changes: 3 additions & 6 deletions Classes/Controller/TeaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@
*/
class TeaController extends ActionController
{
private TeaRepository $teaRepository;

public function __construct(TeaRepository $teaRepository)
{
$this->teaRepository = $teaRepository;
}
public function __construct(
private readonly TeaRepository $teaRepository,
) {}

public function indexAction(): ResponseInterface
{
Expand Down
12 changes: 4 additions & 8 deletions Classes/Domain/Model/Tea.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,18 @@
*/
class Tea extends AbstractEntity
{
/**
* @Extbase\Validate("StringLength", options={"maximum": 255})
* @Extbase\Validate("NotEmpty")
*/
#[Extbase\Validate(['validator' => 'StringLength', 'options' => ['maximum' => 255]])]
#[Extbase\Validate(['validator' => 'NotEmpty'])]
protected string $title = '';

/**
* @Extbase\Validate("StringLength", options={"maximum": 2000})
*/
#[Extbase\Validate(['validator' => 'StringLength', 'options' => ['maximum' => 2000]])]
protected string $description = '';

/**
* @var FileReference|null
* @phpstan-var FileReference|LazyLoadingProxy|null
* @Extbase\ORM\Lazy
*/
#[Extbase\ORM\Lazy]
protected $image;

// Note: We cannot use `@var` for the more specific type annotation here as this confuses the Extbase type mapper.
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
__DIR__ . '/ext_emconf.php',
__DIR__ . '/ext_localconf.php',
])
->withPhpVersion(PhpVersion::PHP_74)
->withPhpVersion(PhpVersion::PHP_81)
->withPhpSets(
true
)
Expand Down

0 comments on commit 39ed4cf

Please sign in to comment.