mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-22 18:56:14 +01:00

[CLEANUP] Use strict types, scalar type hinting and return types

This commit is contained in:
Oliver Klee 2017-09-08 18:04:28 +02:00
parent 3cc3fd09b1
commit 563f4befbf
17 changed files with 66 additions and 30 deletions

View file

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace OliverKlee\Tea\Domain\Model; namespace OliverKlee\Tea\Domain\Model;
/* /*
@ -30,7 +32,7 @@ class Addition extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
/** /**
* @return string $title * @return string $title
*/ */
public function getTitle() public function getTitle(): string
{ {
return $this->title; return $this->title;
} }
@ -40,7 +42,7 @@ class Addition extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
* *
* @return void * @return void
*/ */
public function setTitle($title) public function setTitle(string $title)
{ {
$this->title = $title; $this->title = $title;
} }

View file

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace OliverKlee\Tea\Domain\Model; namespace OliverKlee\Tea\Domain\Model;
/* /*
@ -14,6 +16,8 @@ namespace OliverKlee\Tea\Domain\Model;
* The TYPO3 project - inspiring people to share! * The TYPO3 project - inspiring people to share!
*/ */
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
/** /**
* This model represents a good cup of tea. * This model represents a good cup of tea.
* *
@ -68,7 +72,7 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/** /**
* @return float $size * @return float $size
*/ */
public function getSize() public function getSize(): float
{ {
return $this->size; return $this->size;
} }
@ -78,13 +82,13 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* *
* @return void * @return void
*/ */
public function setSize($size) public function setSize(float $size)
{ {
$this->size = $size; $this->size = $size;
} }
/** /**
* @return \OliverKlee\Tea\Domain\Model\TeaType $type * @return TeaType|null $type
*/ */
public function getType() public function getType()
{ {
@ -92,11 +96,11 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
} }
/** /**
* @param \OliverKlee\Tea\Domain\Model\TeaType $type * @param TeaType $type
* *
* @return void * @return void
*/ */
public function setType(\OliverKlee\Tea\Domain\Model\TeaType $type) public function setType(TeaType $type)
{ {
$this->type = $type; $this->type = $type;
} }
@ -104,7 +108,7 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/** /**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\OliverKlee\Tea\Domain\Model\Addition> $additions * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\OliverKlee\Tea\Domain\Model\Addition> $additions
*/ */
public function getAdditions() public function getAdditions(): ObjectStorage
{ {
return $this->additions; return $this->additions;
} }
@ -114,7 +118,7 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* *
* @return void * @return void
*/ */
public function setAdditions(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $additions) public function setAdditions(ObjectStorage $additions)
{ {
$this->additions = $additions; $this->additions = $additions;
} }
@ -126,7 +130,7 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* *
* @return void * @return void
*/ */
public function addAddition(\OliverKlee\Tea\Domain\Model\Addition $addition) public function addAddition(Addition $addition)
{ {
$this->additions->attach($addition); $this->additions->attach($addition);
} }
@ -138,7 +142,7 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* *
* @return void * @return void
*/ */
public function removeAddition(\OliverKlee\Tea\Domain\Model\Addition $additionToRemove) public function removeAddition(Addition $additionToRemove)
{ {
$this->additions->detach($additionToRemove); $this->additions->detach($additionToRemove);
} }
@ -146,7 +150,7 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/** /**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\OliverKlee\Tea\Domain\Model\Testimonial> $testimonials * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\OliverKlee\Tea\Domain\Model\Testimonial> $testimonials
*/ */
public function getTestimonials() public function getTestimonials(): ObjectStorage
{ {
return $this->testimonials; return $this->testimonials;
} }
@ -156,7 +160,7 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* *
* @return void * @return void
*/ */
public function setTestimonials(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $testimonials) public function setTestimonials(ObjectStorage $testimonials)
{ {
$this->testimonials = $testimonials; $this->testimonials = $testimonials;
} }
@ -168,7 +172,7 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* *
* @return void * @return void
*/ */
public function addTestimonial(\OliverKlee\Tea\Domain\Model\Testimonial $testimonial) public function addTestimonial(Testimonial $testimonial)
{ {
$this->testimonials->attach($testimonial); $this->testimonials->attach($testimonial);
} }
@ -180,7 +184,7 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* *
* @return void * @return void
*/ */
public function removeTestimonial(\OliverKlee\Tea\Domain\Model\Testimonial $testimonialToRemove) public function removeTestimonial(Testimonial $testimonialToRemove)
{ {
$this->testimonials->detach($testimonialToRemove); $this->testimonials->detach($testimonialToRemove);
} }

View file

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace OliverKlee\Tea\Domain\Model; namespace OliverKlee\Tea\Domain\Model;
/* /*
@ -33,9 +35,9 @@ class TeaType extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
protected $caffeinated = false; protected $caffeinated = false;
/** /**
* @return string $title * @return string
*/ */
public function getTitle() public function getTitle(): string
{ {
return $this->title; return $this->title;
} }
@ -45,15 +47,15 @@ class TeaType extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* *
* @return void * @return void
*/ */
public function setTitle($title) public function setTitle(string $title)
{ {
$this->title = $title; $this->title = $title;
} }
/** /**
* @return bool $caffeinated * @return bool
*/ */
public function getCaffeinated() public function getCaffeinated(): bool
{ {
return $this->caffeinated; return $this->caffeinated;
} }
@ -63,7 +65,7 @@ class TeaType extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* *
* @return void * @return void
*/ */
public function setCaffeinated($caffeinated) public function setCaffeinated(bool $caffeinated)
{ {
$this->caffeinated = $caffeinated; $this->caffeinated = $caffeinated;
} }
@ -71,7 +73,7 @@ class TeaType extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/** /**
* @return bool * @return bool
*/ */
public function isCaffeinated() public function isCaffeinated(): bool
{ {
return $this->getCaffeinated(); return $this->getCaffeinated();
} }

View file

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace OliverKlee\Tea\Domain\Model; namespace OliverKlee\Tea\Domain\Model;
/* /*
@ -37,7 +39,7 @@ class Testimonial extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
protected $text = ''; protected $text = '';
/** /**
* @return \DateTime $dateOfPosting * @return \DateTime|null
*/ */
public function getDateOfPosting() public function getDateOfPosting()
{ {
@ -49,7 +51,7 @@ class Testimonial extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* *
* @return void * @return void
*/ */
public function setDateOfPosting($dateOfPosting) public function setDateOfPosting(\DateTime $dateOfPosting)
{ {
$this->dateOfPosting = $dateOfPosting; $this->dateOfPosting = $dateOfPosting;
} }
@ -57,7 +59,7 @@ class Testimonial extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/** /**
* @return int $numberOfConsumedCups * @return int $numberOfConsumedCups
*/ */
public function getNumberOfConsumedCups() public function getNumberOfConsumedCups(): int
{ {
return $this->numberOfConsumedCups; return $this->numberOfConsumedCups;
} }
@ -67,15 +69,15 @@ class Testimonial extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* *
* @return void * @return void
*/ */
public function setNumberOfConsumedCups($numberOfConsumedCups) public function setNumberOfConsumedCups(int $numberOfConsumedCups)
{ {
$this->numberOfConsumedCups = $numberOfConsumedCups; $this->numberOfConsumedCups = $numberOfConsumedCups;
} }
/** /**
* @return string $text * @return string
*/ */
public function getText() public function getText(): string
{ {
return $this->text; return $this->text;
} }
@ -85,7 +87,7 @@ class Testimonial extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* *
* @return void * @return void
*/ */
public function setText($text) public function setText(string $text)
{ {
$this->text = $text; $this->text = $text;
} }

View file

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace OliverKlee\Tea\Domain\Repository; namespace OliverKlee\Tea\Domain\Repository;
/* /*

View file

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace OliverKlee\Tea\Domain\Repository; namespace OliverKlee\Tea\Domain\Repository;
/* /*

View file

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace OliverKlee\Tea\Utility; namespace OliverKlee\Tea\Utility;
/* /*
@ -31,7 +33,7 @@ class FileUtility
* *
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public function concatenate($targetFilePath, array $sourceFilePaths) public function concatenate(string $targetFilePath, array $sourceFilePaths)
{ {
if ($targetFilePath === '') { if ($targetFilePath === '') {
throw new \InvalidArgumentException('$targetFileName must not be empty.', 1445631384); throw new \InvalidArgumentException('$targetFileName must not be empty.', 1445631384);

View file

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace OliverKlee\Tea\Tests\Functional\Domain\Repository; namespace OliverKlee\Tea\Tests\Functional\Domain\Repository;
/* /*

View file

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace OliverKlee\Tea\Tests\Functional\Domain\Repository; namespace OliverKlee\Tea\Tests\Functional\Domain\Repository;
/* /*

View file

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace OliverKlee\Tea\Tests\Functional\Utility; namespace OliverKlee\Tea\Tests\Functional\Utility;
/* /*

View file

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace OliverKlee\Tea\Tests\Unit\Controller; namespace OliverKlee\Tea\Tests\Unit\Controller;
/* /*

View file

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace OliverKlee\Tea\Tests\Unit\Domain\Model; namespace OliverKlee\Tea\Tests\Unit\Domain\Model;
/* /*

View file

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace OliverKlee\Tea\Tests\Unit\Domain\Model; namespace OliverKlee\Tea\Tests\Unit\Domain\Model;
/* /*

View file

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace OliverKlee\Tea\Tests\Unit\Domain\Model; namespace OliverKlee\Tea\Tests\Unit\Domain\Model;
/* /*

View file

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace OliverKlee\Tea\Tests\Unit\Domain\Model; namespace OliverKlee\Tea\Tests\Unit\Domain\Model;
/* /*

View file

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace OliverKlee\Tea\Tests\Unit\Domain\Repository; namespace OliverKlee\Tea\Tests\Unit\Domain\Repository;
/* /*

View file

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace OliverKlee\Tea\Tests\Unit\Domain\Repository; namespace OliverKlee\Tea\Tests\Unit\Domain\Repository;
/* /*