Commit a8dc4ee9 authored by Stefan Froemken's avatar Stefan Froemken
Browse files

Repair most of PhpStorms Inspection hints/errors

* remove unused variables
* correct Method annotations
* add @throws annotation
* correct amount of method parameters
* correct incompatible return type

I have not updated deprecation problems
parent 69a39400
Pipeline #2558 passed with stages
in 2 minutes and 13 seconds
......@@ -189,7 +189,7 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti
* WORKAROUND for #33788
*
* @param string $uri The URI
* @return void
* @return string
*/
protected function addBaseUriIfNecessary($uri)
{
......
......@@ -70,6 +70,7 @@ abstract class AbstractTerBasedController extends \T3o\TerFe2\Controller\Abstrac
/**
* Initializes the view, add login state to template variables
*
* @param \TYPO3\CMS\Extbase\Mvc\View\ViewInterface $view
* @return void
*/
public function initializeView(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface $view)
......@@ -108,6 +109,7 @@ abstract class AbstractTerBasedController extends \T3o\TerFe2\Controller\Abstrac
* Create a connection to the TER server
*
* @return \T3o\TerFe2\Service\Ter The TER connection
* @throws \Exception
*/
protected function getTerConnection()
{
......
......@@ -329,6 +329,7 @@ class ExtensionController extends \T3o\TerFe2\Controller\AbstractController
* @param string $format Format of the file output
* @ignorevalidation $extension
* @return void
* @throws \Exception
*/
public function downloadAction(\T3o\TerFe2\Domain\Model\Extension $extension, $versionString = '', $format = '')
{
......
......@@ -249,7 +249,7 @@ class RegisterkeyController extends \T3o\TerFe2\Controller\AbstractTerBasedContr
*/
public function keepAction(\T3o\TerFe2\Domain\Model\Extension $extension)
{
$extension->setExpire(0);
$extension->setExpire(null);
$this->extensionRepository->update($extension);
$this->redirect('index', 'Registerkey');
}
......
......@@ -25,7 +25,6 @@ namespace T3o\TerFe2\Domain\Model;
* This copyright notice MUST APPEAR in all copies of the script!
******************************************************************/
use TYPO3\CMS\Extbase\Domain\Model\FrontendUser;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
/**
......
......@@ -601,9 +601,9 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
}
/**
* @param \DateTime $expire
* @param \DateTime|null $expire
*/
public function setExpire(\DateTime $expire)
public function setExpire(\DateTime $expire = null)
{
$this->expire = $expire;
}
......
......@@ -915,7 +915,7 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Setter for softwareRelations
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage <\T3o\TerFe2\Domain\Model\Relation> $softwareRelations Relations
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $softwareRelations Relations
* @return void
*/
public function setSoftwareRelations(ObjectStorage $softwareRelations)
......@@ -926,7 +926,7 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Getter for softwareRelations
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3o\TerFe2\Domain\Model\Relation> Relations
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage Relations
*/
public function getSoftwareRelations(): ObjectStorage
{
......
......@@ -34,8 +34,8 @@ abstract class AbstractRepository extends \TYPO3\CMS\Extbase\Persistence\Reposit
/**
* Returns a query for objects of this repository
*
* @param string $offset Offset to start with
* @param string $count Count of result
* @param int $offset Offset to start with
* @param int $count Count of result
* @param array $ordering Ordering <-> Direction
* @return \TYPO3\CMS\Extbase\Persistence\QueryInterface
*/
......@@ -61,10 +61,10 @@ abstract class AbstractRepository extends \TYPO3\CMS\Extbase\Persistence\Reposit
/**
* Returns all objects
*
* @param string $offset Offset to start with
* @param string $count Count of result
* @param string $ordering Ordering <-> Direction
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage Objects
* @param int $offset Offset to start with
* @param int $count Count of result
* @param array $ordering Ordering <-> Direction
* @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface Objects
*/
public function findAll($offset = 0, $count = 0, array $ordering = array())
{
......
......@@ -44,9 +44,8 @@ class ExtensionManagerCacheEntryRepository extends \T3o\TerFe2\Domain\Repository
$query = $this->createQuery($offset, $count);
$query->getQuerySettings()->setRespectStoragePage(false);
$query->getQuerySettings()->setRespectSysLanguage(false);
$query->getQuerySettings()->setReturnRawQueryResult(true);
$query->matching($query->greaterThan('lastuploaddate', (int)$lastUpdateDate));
return $query->execute();
return $query->execute(true);
}
......@@ -62,15 +61,14 @@ class ExtensionManagerCacheEntryRepository extends \T3o\TerFe2\Domain\Repository
$query = $this->createQuery(0, 1);
$query->getQuerySettings()->setRespectStoragePage(false);
$query->getQuerySettings()->setRespectSysLanguage(false);
$query->getQuerySettings()->setReturnRawQueryResult(true);
$query->matching(
$query->logicalAnd(
$query->logicalAnd([
$query->equals('extkey', $extKey),
$query->equals('version', $versionString)
)
])
);
$rows = $query->execute();
$rows = $query->execute(true);
if (is_array($rows)) {
return reset($rows);
}
......
......@@ -64,7 +64,7 @@ class ExtensionRepository extends \T3o\TerFe2\Domain\Repository\AbstractReposito
*
* @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
* @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint
* @return \TYPO3\CMS\Extbase\Persistence\QueryInterface
* @return void
*/
protected function match(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query, \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint)
{
......@@ -73,10 +73,10 @@ class ExtensionRepository extends \T3o\TerFe2\Domain\Repository\AbstractReposito
return;
}
$query->matching($query->logicalAnd(
$query->matching($query->logicalAnd([
$query->logicalNot($query->equals('lastVersion.reviewState', -1)),
$constraint
));
]));
}
......@@ -128,7 +128,7 @@ class ExtensionRepository extends \T3o\TerFe2\Domain\Repository\AbstractReposito
* Returns new and updated extensions
*
* @param integer $latestCount Count of extensions
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage Objects
* @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface Objects
*/
public function findLatest($latestCount = 0)
{
......@@ -153,9 +153,8 @@ class ExtensionRepository extends \T3o\TerFe2\Domain\Repository\AbstractReposito
}
/**
*
* @param string $frontendUser
* @return \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult|NULL
* @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface
*/
public function findByFrontendUserAndExpiring($frontendUser)
{
......@@ -192,14 +191,14 @@ class ExtensionRepository extends \T3o\TerFe2\Domain\Repository\AbstractReposito
$query->getQuerySettings()->setRespectSysLanguage(false);
$constraints = array(
$query->equals('frontendUser', $frontendUser),
$query->logicalAnd(
$query->logicalAnd([
$query->logicalNot(
$query->equals('uid', $extension->getUid())
),
$query->logicalNot(
$query->equals('lastVersion.state', 'obsolete')
)
),
]),
$query->greaterThanOrEqual('lastVersion.review_state', '0'),
$query->greaterThanOrEqual('versions', '1')
);
......
......@@ -52,7 +52,7 @@ class VersionRepository extends \T3o\TerFe2\Domain\Repository\AbstractRepository
*
* @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
* @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint
* @return \TYPO3\CMS\Extbase\Persistence\QueryInterface
* @return void
*/
protected function match(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query, \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint)
{
......@@ -62,10 +62,10 @@ class VersionRepository extends \T3o\TerFe2\Domain\Repository\AbstractRepository
}
$query->matching(
$query->logicalAnd(
$query->logicalAnd([
$query->greaterThanOrEqual('reviewState', 0),
$constraint
)
])
);
}
......@@ -82,10 +82,10 @@ class VersionRepository extends \T3o\TerFe2\Domain\Repository\AbstractRepository
$query->getQuerySettings()->setRespectStoragePage(false);
$query->getQuerySettings()->setRespectSysLanguage(false);
$query->matching(
$query->logicalAnd(
$query->logicalAnd([
$query->equals('extension', $extension),
$query->equals('versionString', $versionString)
)
])
);
return $query->execute()->getFirst();
}
......@@ -97,7 +97,7 @@ class VersionRepository extends \T3o\TerFe2\Domain\Repository\AbstractRepository
* @param \T3o\TerFe2\Domain\Model\Extension $extension The extension object
* @param integer $count Count of versions to return
* @param boolean $skipLatest Skip latest version
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage Objects
* @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface Objects
*/
public function getVersionHistory($extension, $count = 0, $skipLatest = true)
{
......@@ -108,12 +108,12 @@ class VersionRepository extends \T3o\TerFe2\Domain\Repository\AbstractRepository
if (!empty($skipLatest)) {
$query->matching(
$query->logicalAnd(
$query->logicalAnd([
$query->equals('extension', $extension),
$query->logicalNot(
$query->equals('uid', (int)$extension->getLastVersion()->getUid())
)
)
])
);
} else {
$query->matching($query->equals('extension', $extension));
......
......@@ -131,6 +131,7 @@ abstract class AbstractPersistence implements \T3o\TerFe2\Persistence\Persistenc
* @param string $key Name of the value
* @param mixed $value Value content
* @return void
* @throws \Exception
*/
public function set($key, $value)
{
......@@ -163,7 +164,7 @@ abstract class AbstractPersistence implements \T3o\TerFe2\Persistence\Persistenc
/**
* Add multiple values
*
* @param array $value Key <-> value pairs
* @param array $values Key <-> value pairs
* @return void
*/
public function addMultiple(array $values)
......
......@@ -70,7 +70,7 @@ interface PersistenceInterface
/**
* Add multiple values
*
* @param array $value Key <-> value pairs
* @param array $values Key <-> value pairs
* @return void
*/
public function addMultiple(array $values);
......
......@@ -30,11 +30,11 @@ namespace T3o\TerFe2\Persistence;
*/
class Session extends \T3o\TerFe2\Persistence\AbstractPersistence
{
/**
* Load content
*
* @return void
* @throws \Exception
*/
public function load()
{
......@@ -47,11 +47,11 @@ class Session extends \T3o\TerFe2\Persistence\AbstractPersistence
}
}
/**
* Save content
*
* @return void
* @throws \Exception
*/
public function save()
{
......
......@@ -59,8 +59,6 @@ abstract class AbstractProvider implements \T3o\TerFe2\Provider\ProviderInterfac
/**
* Get or create absolute path to image cache directory
*
* @return void
*/
public function __construct()
{
......
......@@ -181,7 +181,9 @@ class FileProvider extends \T3o\TerFe2\Provider\AbstractProvider
*
* @param string $extension Extension key
* @param string $version Version string
* @param string $fileHash hash of file
* @return array Extension info array
* @throws \Exception
*/
protected function getExtensionInfo($extension, $version, $fileHash)
{
......@@ -250,7 +252,7 @@ class FileProvider extends \T3o\TerFe2\Provider\AbstractProvider
$extensionModel = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension::class);
$states = $extensionModel->getDefaultState(null);
$states = array_flip($states);
$categories = Category::getDefaultCategories(null);
$categories = Category::getDefaultCategories();
$categories = array_flip($categories);
$extensions = array();
......
......@@ -117,7 +117,9 @@ class MirrorProvider extends \T3o\TerFe2\Provider\FileProvider
*
* @param string $extension Extension key
* @param string $version Version string
* @param string $fileHash Hash of file
* @return array Extension info array
* @throws \Exception
*/
protected function getExtensionInfo($extension, $version, $fileHash)
{
......
......@@ -57,6 +57,7 @@ class ProviderManager implements \TYPO3\CMS\Core\SingletonInterface
*
* @param string $name Name of the provider
* @return \T3o\TerFe2\Provider\ProviderInterface Extension provider
* @throws \Exception
*/
public function getProvider($name)
{
......
......@@ -61,6 +61,7 @@ class SoapProvider extends \T3o\TerFe2\Provider\AbstractProvider
* Initialize provider
*
* @return void
* @throws \Exception
*/
public function initializeProvider()
{
......@@ -104,6 +105,7 @@ class SoapProvider extends \T3o\TerFe2\Provider\AbstractProvider
* @param integer $offset Offset to start with
* @param integer $count Extension count to load
* @return array Extension rows
* @throws \Exception
*/
public function getExtensions($lastRun, $offset, $count)
{
......@@ -126,6 +128,7 @@ class SoapProvider extends \T3o\TerFe2\Provider\AbstractProvider
* @param \T3o\TerFe2\Domain\Model\Version $version Version object
* @param string $fileType File type
* @return string Url to file
* @throws \Exception
*/
public function getFileUrl(\T3o\TerFe2\Domain\Model\Version $version, $fileType)
{
......@@ -151,6 +154,7 @@ class SoapProvider extends \T3o\TerFe2\Provider\AbstractProvider
* @param \T3o\TerFe2\Domain\Model\Version $version Version object
* @param string $fileType File type
* @return string File name
* @throws \Exception
*/
public function getFileName(\T3o\TerFe2\Domain\Model\Version $version, $fileType)
{
......@@ -175,6 +179,7 @@ class SoapProvider extends \T3o\TerFe2\Provider\AbstractProvider
*
* @param \T3o\TerFe2\Domain\Model\Version $version Version object
* @return array Version details
* @throws \Exception
*/
public function getVersionDetails(\T3o\TerFe2\Domain\Model\Version $version)
{
......
......@@ -126,6 +126,7 @@ class Mirror implements \TYPO3\CMS\Core\SingletonInterface
*
* @param boolean $refresh Generate new mirror url
* @return string Mirror url
* @throws \Exception
*/
public function getMirror($refresh = false)
{
......@@ -183,6 +184,7 @@ class Mirror implements \TYPO3\CMS\Core\SingletonInterface
*
* @param string $filename File name to check
* @return string Url to file on mirror server
* @throws \Exception
*/
public function getUrlToFile($filename)
{
......@@ -215,6 +217,7 @@ class Mirror implements \TYPO3\CMS\Core\SingletonInterface
*
* @param string $filename File name to fetch
* @return string File content
* @throws \Exception
*/
public function getFile($filename)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment