mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-10 00:16:13 +01:00

[CLEANUP] Fix code inspection warnings (#57)

This commit is contained in:
Oliver Klee 2019-08-12 17:43:02 +02:00 committed by GitHub
parent 82eaf794d4
commit b519583431
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 22 deletions

View file

@ -30,6 +30,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
- Drop the dependency of roave/security-advisories (#41)
### Fixed
- Fix code inspection warnings (#55)
- Use the new annotations for lazy loading (#54)
- Update and pin the dev dependencies (#45)
- Drop an obsolete "replace" entry from composer.json (#42)

View file

@ -3,10 +3,10 @@ declare(strict_types=1);
namespace OliverKlee\Tea\Domain\Model\Product;
use TYPO3\CMS\Extbase\Annotation\ORM\Lazy;
use TYPO3\CMS\Extbase\Domain\Model\FileReference;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
use TYPO3\CMS\Extbase\Annotation\ORM\Lazy;
/**
* This class represents a tea (flavor), e.g., "Earl Grey".
@ -51,10 +51,7 @@ class Tea extends AbstractEntity
$this->description = $description;
}
/**
* @return FileReference|null
*/
public function getImage()
public function getImage(): ?FileReference
{
if ($this->image instanceof LazyLoadingProxy) {
$this->image = $this->image->_loadRealInstance();

View file

@ -3,11 +3,14 @@ declare(strict_types=1);
namespace OliverKlee\Tea\Domain\Repository\Traits;
use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
use TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface;
/**
* This trait for repositories makes the repository ignore the storage page setting when fetching models.
*
* @property ObjectManagerInterface $objectManager
*
* @author Oliver Klee <typo3-coding@oliverklee.de
*/
trait StoragePageAgnosticTrait

View file

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
namespace Helper;

View file

@ -25,6 +25,5 @@
<uid_foreign>3</uid_foreign>
<tablenames>tx_tea_domain_model_product_tea</tablenames>
<fieldname>image</fieldname>
<l10n_diffsource></l10n_diffsource>
</sys_file_reference>
</dataset>

View file

@ -30,32 +30,23 @@ class TeaControllerTest extends UnitTestCase
*/
private $viewProphecy = null;
/**
* @var TemplateView|ProphecySubjectInterface
*/
private $view = null;
/**
* @var TeaRepository|ObjectProphecy
*/
private $teaRepositoryProphecy = null;
/**
* @var TeaRepository|ProphecySubjectInterface
*/
private $teaRepository = null;
protected function setUp(): void
{
$this->subject = new TeaController();
$this->viewProphecy = $this->prophesize(TemplateView::class);
$this->view = $this->viewProphecy->reveal();
$this->inject($this->subject, 'view', $this->view);
$view = $this->viewProphecy->reveal();
$this->inject($this->subject, 'view', $view);
$this->teaRepositoryProphecy = $this->prophesize(TeaRepository::class);
$this->teaRepository = $this->teaRepositoryProphecy->reveal();
$this->subject->injectTeaRepository($this->teaRepository);
/** @var TeaRepository|ProphecySubjectInterface $teaRepository */
$teaRepository = $this->teaRepositoryProphecy->reveal();
$this->subject->injectTeaRepository($teaRepository);
}
/**

View file

@ -28,8 +28,7 @@ class TeaRepositoryTest extends UnitTestCase
protected function setUp(): void
{
$objectManagerProphecy = $this->prophesize(ObjectManagerInterface::class);
$this->objectManager = $objectManagerProphecy->reveal();
$this->objectManager = $this->prophesize(ObjectManagerInterface::class)->reveal();
$this->subject = new TeaRepository($this->objectManager);
}