mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-22 19: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) - Drop the dependency of roave/security-advisories (#41)
### Fixed ### Fixed
- Fix code inspection warnings (#55)
- Use the new annotations for lazy loading (#54) - Use the new annotations for lazy loading (#54)
- Update and pin the dev dependencies (#45) - Update and pin the dev dependencies (#45)
- Drop an obsolete "replace" entry from composer.json (#42) - 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; namespace OliverKlee\Tea\Domain\Model\Product;
use TYPO3\CMS\Extbase\Annotation\ORM\Lazy;
use TYPO3\CMS\Extbase\Domain\Model\FileReference; use TYPO3\CMS\Extbase\Domain\Model\FileReference;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy; use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
use TYPO3\CMS\Extbase\Annotation\ORM\Lazy;
/** /**
* This class represents a tea (flavor), e.g., "Earl Grey". * This class represents a tea (flavor), e.g., "Earl Grey".
@ -51,10 +51,7 @@ class Tea extends AbstractEntity
$this->description = $description; $this->description = $description;
} }
/** public function getImage(): ?FileReference
* @return FileReference|null
*/
public function getImage()
{ {
if ($this->image instanceof LazyLoadingProxy) { if ($this->image instanceof LazyLoadingProxy) {
$this->image = $this->image->_loadRealInstance(); $this->image = $this->image->_loadRealInstance();

View file

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

View file

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

View file

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

View file

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

View file

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