mirror of
https://github.com/FriendsOfTYPO3/tea.git
synced 2024-12-22 23:06:11 +01:00
[CLEANUP] Use strict types, scalar type hinting and return types
This commit is contained in:
parent
3cc3fd09b1
commit
563f4befbf
17 changed files with 66 additions and 30 deletions
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OliverKlee\Tea\Domain\Model;
|
||||
|
||||
/*
|
||||
|
@ -30,7 +32,7 @@ class Addition extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
|
|||
/**
|
||||
* @return string $title
|
||||
*/
|
||||
public function getTitle()
|
||||
public function getTitle(): string
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
@ -40,7 +42,7 @@ class Addition extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setTitle($title)
|
||||
public function setTitle(string $title)
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OliverKlee\Tea\Domain\Model;
|
||||
|
||||
/*
|
||||
|
@ -14,6 +16,8 @@ namespace OliverKlee\Tea\Domain\Model;
|
|||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
|
||||
|
||||
/**
|
||||
* This model represents a good cup of tea.
|
||||
*
|
||||
|
@ -68,7 +72,7 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
|||
/**
|
||||
* @return float $size
|
||||
*/
|
||||
public function getSize()
|
||||
public function getSize(): float
|
||||
{
|
||||
return $this->size;
|
||||
}
|
||||
|
@ -78,13 +82,13 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSize($size)
|
||||
public function setSize(float $size)
|
||||
{
|
||||
$this->size = $size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \OliverKlee\Tea\Domain\Model\TeaType $type
|
||||
* @return TeaType|null $type
|
||||
*/
|
||||
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
|
||||
*/
|
||||
public function setType(\OliverKlee\Tea\Domain\Model\TeaType $type)
|
||||
public function setType(TeaType $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
|
||||
*/
|
||||
public function getAdditions()
|
||||
public function getAdditions(): ObjectStorage
|
||||
{
|
||||
return $this->additions;
|
||||
}
|
||||
|
@ -114,7 +118,7 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAdditions(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $additions)
|
||||
public function setAdditions(ObjectStorage $additions)
|
||||
{
|
||||
$this->additions = $additions;
|
||||
}
|
||||
|
@ -126,7 +130,7 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addAddition(\OliverKlee\Tea\Domain\Model\Addition $addition)
|
||||
public function addAddition(Addition $addition)
|
||||
{
|
||||
$this->additions->attach($addition);
|
||||
}
|
||||
|
@ -138,7 +142,7 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function removeAddition(\OliverKlee\Tea\Domain\Model\Addition $additionToRemove)
|
||||
public function removeAddition(Addition $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
|
||||
*/
|
||||
public function getTestimonials()
|
||||
public function getTestimonials(): ObjectStorage
|
||||
{
|
||||
return $this->testimonials;
|
||||
}
|
||||
|
@ -156,7 +160,7 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setTestimonials(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $testimonials)
|
||||
public function setTestimonials(ObjectStorage $testimonials)
|
||||
{
|
||||
$this->testimonials = $testimonials;
|
||||
}
|
||||
|
@ -168,7 +172,7 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addTestimonial(\OliverKlee\Tea\Domain\Model\Testimonial $testimonial)
|
||||
public function addTestimonial(Testimonial $testimonial)
|
||||
{
|
||||
$this->testimonials->attach($testimonial);
|
||||
}
|
||||
|
@ -180,7 +184,7 @@ class TeaBeverage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function removeTestimonial(\OliverKlee\Tea\Domain\Model\Testimonial $testimonialToRemove)
|
||||
public function removeTestimonial(Testimonial $testimonialToRemove)
|
||||
{
|
||||
$this->testimonials->detach($testimonialToRemove);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OliverKlee\Tea\Domain\Model;
|
||||
|
||||
/*
|
||||
|
@ -33,9 +35,9 @@ class TeaType extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
|||
protected $caffeinated = false;
|
||||
|
||||
/**
|
||||
* @return string $title
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
public function getTitle(): string
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
@ -45,15 +47,15 @@ class TeaType extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setTitle($title)
|
||||
public function setTitle(string $title)
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool $caffeinated
|
||||
* @return bool
|
||||
*/
|
||||
public function getCaffeinated()
|
||||
public function getCaffeinated(): bool
|
||||
{
|
||||
return $this->caffeinated;
|
||||
}
|
||||
|
@ -63,7 +65,7 @@ class TeaType extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setCaffeinated($caffeinated)
|
||||
public function setCaffeinated(bool $caffeinated)
|
||||
{
|
||||
$this->caffeinated = $caffeinated;
|
||||
}
|
||||
|
@ -71,7 +73,7 @@ class TeaType extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
|||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isCaffeinated()
|
||||
public function isCaffeinated(): bool
|
||||
{
|
||||
return $this->getCaffeinated();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OliverKlee\Tea\Domain\Model;
|
||||
|
||||
/*
|
||||
|
@ -37,7 +39,7 @@ class Testimonial extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
|||
protected $text = '';
|
||||
|
||||
/**
|
||||
* @return \DateTime $dateOfPosting
|
||||
* @return \DateTime|null
|
||||
*/
|
||||
public function getDateOfPosting()
|
||||
{
|
||||
|
@ -49,7 +51,7 @@ class Testimonial extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setDateOfPosting($dateOfPosting)
|
||||
public function setDateOfPosting(\DateTime $dateOfPosting)
|
||||
{
|
||||
$this->dateOfPosting = $dateOfPosting;
|
||||
}
|
||||
|
@ -57,7 +59,7 @@ class Testimonial extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
|||
/**
|
||||
* @return int $numberOfConsumedCups
|
||||
*/
|
||||
public function getNumberOfConsumedCups()
|
||||
public function getNumberOfConsumedCups(): int
|
||||
{
|
||||
return $this->numberOfConsumedCups;
|
||||
}
|
||||
|
@ -67,15 +69,15 @@ class Testimonial extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setNumberOfConsumedCups($numberOfConsumedCups)
|
||||
public function setNumberOfConsumedCups(int $numberOfConsumedCups)
|
||||
{
|
||||
$this->numberOfConsumedCups = $numberOfConsumedCups;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string $text
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
public function getText(): string
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
|
@ -85,7 +87,7 @@ class Testimonial extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setText($text)
|
||||
public function setText(string $text)
|
||||
{
|
||||
$this->text = $text;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OliverKlee\Tea\Domain\Repository;
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OliverKlee\Tea\Domain\Repository;
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OliverKlee\Tea\Utility;
|
||||
|
||||
/*
|
||||
|
@ -31,7 +33,7 @@ class FileUtility
|
|||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function concatenate($targetFilePath, array $sourceFilePaths)
|
||||
public function concatenate(string $targetFilePath, array $sourceFilePaths)
|
||||
{
|
||||
if ($targetFilePath === '') {
|
||||
throw new \InvalidArgumentException('$targetFileName must not be empty.', 1445631384);
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OliverKlee\Tea\Tests\Functional\Domain\Repository;
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OliverKlee\Tea\Tests\Functional\Domain\Repository;
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OliverKlee\Tea\Tests\Functional\Utility;
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OliverKlee\Tea\Tests\Unit\Controller;
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OliverKlee\Tea\Tests\Unit\Domain\Model;
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OliverKlee\Tea\Tests\Unit\Domain\Model;
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OliverKlee\Tea\Tests\Unit\Domain\Model;
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OliverKlee\Tea\Tests\Unit\Domain\Model;
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OliverKlee\Tea\Tests\Unit\Domain\Repository;
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OliverKlee\Tea\Tests\Unit\Domain\Repository;
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue