Skip to content

Commit

Permalink
[CLEANUP] Clean up the PHPDoc (#26)
Browse files Browse the repository at this point in the history
Also add a missing type hint.
  • Loading branch information
oliverklee authored and helhum committed Jun 23, 2016
1 parent 3bc8616 commit ae77d9c
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 39 deletions.
3 changes: 0 additions & 3 deletions Classes/Configuration/ConfigurationBuildingException.php
Expand Up @@ -27,9 +27,6 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

/**
* Class ConfigurationBuildingException
*/
class ConfigurationBuildingException extends \Exception
{
}
13 changes: 7 additions & 6 deletions Classes/Configuration/RecordRenderingConfigurationBuilder.php
Expand Up @@ -30,9 +30,6 @@
use Helhum\TyposcriptRendering\Renderer\RenderingContext;
use TYPO3\CMS\Core\Utility\MathUtility;

/**
* Class RecordRenderingConfigurationBuilder
*/
class RecordRenderingConfigurationBuilder
{
/**
Expand All @@ -52,7 +49,8 @@ public function __construct(RenderingContext $renderingContext)
* @param string $extensionName
* @param string $pluginName
* @param string $contextRecord
* @return array
*
* @return string[]
*/
public function configurationFor($extensionName, $pluginName, $contextRecord = 'currentPage')
{
Expand All @@ -69,8 +67,9 @@ public function configurationFor($extensionName, $pluginName, $contextRecord = '
* Resolves the table name and uid for the record the rendering is based upon.
* Falls back to current page if none is available
*
* @param $contextRecord
* @return array table name as first and uid as second index of the array
* @param string $contextRecord
*
* @return string[] table name as first and uid as second index of the array
*
* @throws ConfigurationBuildingException
*/
Expand Down Expand Up @@ -99,7 +98,9 @@ protected function resolveTableNameAndUidFromContextString($contextRecord)
*
* @param string $extensionName
* @param string $pluginName
*
* @return string
*
* @see \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin()
*/
protected function buildPluginSignature($extensionName, $pluginName)
Expand Down
12 changes: 10 additions & 2 deletions Classes/Core/FrontendRenderingProvisioner.php
Expand Up @@ -42,6 +42,8 @@ class FrontendRenderingProvisioner
{
/**
* @param TypoScriptFrontendController $typoScriptFrontendController
*
* @return void
*/
public function provision(TypoScriptFrontendController $typoScriptFrontendController)
{
Expand All @@ -55,6 +57,8 @@ public function provision(TypoScriptFrontendController $typoScriptFrontendContro

/**
* @param TypoScriptFrontendController $typoScriptFrontendController
*
* @return void
*/
protected function configureLinkBuilding(TypoScriptFrontendController $typoScriptFrontendController)
{
Expand Down Expand Up @@ -103,6 +107,8 @@ protected function configureLinkBuilding(TypoScriptFrontendController $typoScrip

/**
* @param TypoScriptFrontendController $typoScriptFrontendController
*
* @return void
*/
protected function configurePageRenderer(TypoScriptFrontendController $typoScriptFrontendController)
{
Expand Down Expand Up @@ -141,9 +147,11 @@ protected function configurePageRenderer(TypoScriptFrontendController $typoScrip
}

/**
* @param $typoScriptFrontendController
* @param TypoScriptFrontendController $typoScriptFrontendController
*
* @return void
*/
protected function configureImageProcessing($typoScriptFrontendController)
protected function configureImageProcessing(TypoScriptFrontendController $typoScriptFrontendController)
{
$GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'] = isset($typoScriptFrontendController->config['config']['noScaleUp']) ? '' . $typoScriptFrontendController->config['config']['noScaleUp'] : $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];
$typoScriptFrontendController->TYPO3_CONF_VARS['GFX']['im_noScaleUp'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];
Expand Down
3 changes: 0 additions & 3 deletions Classes/Exception.php
Expand Up @@ -27,9 +27,6 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

/**
* Class Exception
*/
class Exception extends \TYPO3\CMS\Core\Error\Exception
{
}
3 changes: 3 additions & 0 deletions Classes/Mvc/Request.php
Expand Up @@ -47,6 +47,7 @@ public function __construct(array $arguments)

/**
* @param string $argumentName
*
* @return bool
*/
public function hasArgument($argumentName)
Expand All @@ -56,7 +57,9 @@ public function hasArgument($argumentName)

/**
* @param string $argumentName
*
* @return mixed
*
* @throws \InvalidArgumentException
*/
public function getArgument($argumentName)
Expand Down
7 changes: 3 additions & 4 deletions Classes/Mvc/RequestBuilder.php
Expand Up @@ -29,17 +29,16 @@

use Helhum\TyposcriptRendering\Exception;

/**
* Class RequestBuilder
*/
class RequestBuilder
{
/**
* @param array $rawRequestArgument
*
* @return Request
*
* @throws \Helhum\TyposcriptRendering\Exception
*/
public function build($rawRequestArgument)
public function build(array $rawRequestArgument)
{
if (empty($rawRequestArgument['context']) || !is_string($rawRequestArgument['context'])) {
throw new Exception('tx_typoscriptrendering|context must not be empty and must be of type string!', 1403793452);
Expand Down
2 changes: 2 additions & 0 deletions Classes/Mvc/Response.php
Expand Up @@ -39,6 +39,8 @@ class Response

/**
* @param string $content
*
* @return void
*/
public function setContent($content)
{
Expand Down
3 changes: 3 additions & 0 deletions Classes/Renderer/RecordRenderer.php
Expand Up @@ -41,6 +41,7 @@ class RecordRenderer implements RenderingInterface
* @param Request $request
* @param Response $response
* @param RenderingContext $renderingContext
*
* @return void
*/
public function renderRequest(Request $request, Response $response, RenderingContext $renderingContext)
Expand All @@ -54,6 +55,7 @@ public function renderRequest(Request $request, Response $response, RenderingCon
* Whether the required arguments for rendering are present or not
*
* @param Request $request
*
* @return bool
*/
public function canRender(Request $request)
Expand All @@ -64,6 +66,7 @@ public function canRender(Request $request)
/**
* @param Request $request
* @param RenderingContext $renderingContext
*
* @return array
*/
protected function resolveRenderingConfiguration(Request $request, RenderingContext $renderingContext)
Expand Down
8 changes: 5 additions & 3 deletions Classes/Renderer/RenderingContext.php
Expand Up @@ -29,16 +29,18 @@

use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;

/**
* Class RenderingContext
*/
class RenderingContext
{
/**
* @var TypoScriptFrontendController
*/
protected $frontendController;

/**
* Constructor.
*
* @param TypoScriptFrontendController $frontendController
*/
public function __construct(TypoScriptFrontendController $frontendController)
{
$this->frontendController = $frontendController;
Expand Down
5 changes: 2 additions & 3 deletions Classes/Renderer/RenderingInterface.php
Expand Up @@ -30,9 +30,6 @@
use Helhum\TyposcriptRendering\Mvc\Request;
use Helhum\TyposcriptRendering\Mvc\Response;

/**
* Interface RenderingInterface
*/
interface RenderingInterface
{
/**
Expand All @@ -42,6 +39,7 @@ interface RenderingInterface
* @param Request $request
* @param Response $response
* @param RenderingContext $renderingContext
*
* @return void
*/
public function renderRequest(Request $request, Response $response, RenderingContext $renderingContext);
Expand All @@ -50,6 +48,7 @@ public function renderRequest(Request $request, Response $response, RenderingCon
* Whether the required arguments for rendering are present or not
*
* @param Request $request
*
* @return bool
*/
public function canRender(Request $request);
Expand Down
11 changes: 9 additions & 2 deletions Classes/RenderingDispatcher.php
Expand Up @@ -52,13 +52,14 @@ class RenderingDispatcher
protected $requestBuilder;

/**
* @var array
* @var string[]
*/
protected $renderer = array();

/**
* @param RequestBuilder $requestBuilder
* @param array $renderer
*
* @param string[] $renderer
*/
public function __construct(RequestBuilder $requestBuilder = null, array $renderer = null)
{
Expand All @@ -68,6 +69,8 @@ public function __construct(RequestBuilder $requestBuilder = null, array $render

/**
* @param TypoScriptFrontendController $typoScriptFrontendController
*
* @return void
*/
public function checkDataSubmission(TypoScriptFrontendController $typoScriptFrontendController)
{
Expand All @@ -91,6 +94,8 @@ public function checkDataSubmission(TypoScriptFrontendController $typoScriptFron
}

/**
* @return void
*
* @throws Exception
*/
protected function ensureRequiredEnvironment()
Expand All @@ -108,7 +113,9 @@ protected function ensureRequiredEnvironment()

/**
* @param Request $request
*
* @return RenderingInterface
*
* @throws Exception
*/
protected function resolveRenderer(Request $request)
Expand Down
2 changes: 1 addition & 1 deletion Classes/ViewHelpers/Uri/AjaxActionViewHelper.php
Expand Up @@ -99,7 +99,7 @@ public function render($action = null, array $arguments = array(), $controller =
* @param string $pluginName
* @param string $contextRecord
*
* @return array
* @return string[]
*/
public function buildTypoScriptRenderingConfiguration($extensionName, $pluginName, $contextRecord)
{
Expand Down
10 changes: 7 additions & 3 deletions Tests/Functional/AbstractRenderingTestCase.php
Expand Up @@ -31,17 +31,17 @@
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
* Class RenderingTest
* Test case.
*/
abstract class AbstractRenderingTestCase extends FunctionalTestCase
{
/**
* @var array
* @var string[]
*/
protected $testExtensionsToLoad = array('typo3conf/ext/typoscript_rendering');

/**
* @var array
* @var string[]
*/
protected $coreExtensionsToLoad = array('fluid');

Expand All @@ -59,6 +59,7 @@ public function setUp()
* @param int $pageId
* @param int $languageId
* @param string $path
*
* @return string
*/
protected function getRenderUrl($pageId, $languageId, $path)
Expand All @@ -70,6 +71,8 @@ protected function getRenderUrl($pageId, $languageId, $path)
/**
* @param int $pageId
* @param array $typoScriptFiles
*
* @return void
*/
protected function setUpFrontendRootPage($pageId, array $typoScriptFiles = array())
{
Expand All @@ -84,6 +87,7 @@ protected function setUpFrontendRootPage($pageId, array $typoScriptFiles = array
/**
* @param array $requestArguments
* @param bool $failOnFailure
*
* @return Response
*/
protected function fetchFrontendResponse(array $requestArguments, $failOnFailure = true)
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/RenderingTest.php
Expand Up @@ -30,7 +30,7 @@
require_once __DIR__ . '/AbstractRenderingTestCase.php';

/**
* Class RenderingTest
* Test case.
*/
class RenderingTest extends AbstractRenderingTestCase
{
Expand Down
Expand Up @@ -33,7 +33,7 @@
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;

/**
* Class RecordRenderingConfigurationBuilderTest
* Test case.
*/
class RecordRenderingConfigurationBuilderTest extends UnitTestCase
{
Expand Down Expand Up @@ -117,14 +117,14 @@ public function pluginContextDataProvider()
}

/**
* @param $extensionName
* @param $pluginName
* @param $recordContext
* @param $expectedConfiguration
* @param string $extensionName
* @param string $pluginName
* @param string $recordContext
* @param string[] $expectedConfiguration
* @test
* @dataProvider pluginContextDataProvider
*/
public function buildingConfigurationWorks($extensionName, $pluginName, $recordContext, $expectedConfiguration)
public function buildingConfigurationWorks($extensionName, $pluginName, $recordContext, array $expectedConfiguration)
{
$this->typoScriptControllerMock->id = 42;
$this->assertSame($expectedConfiguration, $this->configurationBuilder->configurationFor($extensionName, $pluginName, $recordContext));
Expand Down
6 changes: 4 additions & 2 deletions Tests/Unit/Renderer/RecordRendererTest.php
Expand Up @@ -31,9 +31,10 @@
use Helhum\TyposcriptRendering\Renderer\RecordRenderer;
use Helhum\TyposcriptRendering\Renderer\RenderingContext;
use TYPO3\CMS\Core\Tests\UnitTestCase;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;

/**
* Class RecordRendererTest
* Test case.
*/
class RecordRendererTest extends UnitTestCase
{
Expand Down Expand Up @@ -107,13 +108,14 @@ public function configurationDataProvider()

/**
* @param array $requestArguments
* @param array $expectedConfiguration
* @param string[] $expectedConfiguration
* @param string $pageId
* @test
* @dataProvider configurationDataProvider
*/
public function configurationIsGeneratedCorrectlyFromRequest(array $requestArguments, array $expectedConfiguration, $pageId = '42')
{
/** @var TypoScriptFrontendController|\PHPUnit_Framework_MockObject_MockObject $tsfeMock */
$tsfeMock = $this->getMock('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', array(), array(), '', false);
$pageRepositoryMock = $this->getMock('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
$pageRepositoryMock->expects($this->any())->method('getRootLine')->willReturn(
Expand Down

3 comments on commit ae77d9c

@DavidBruchmann
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for useless comment perhaps but it's written in
PSR-2:

All PHP files MUST end with a single blank line.

@oliverklee
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran php-cs-fixer for PSR-2 in commit 3487e2f . Is anything missing?

(Just to clarify things: "a single blank line" means "a single linefeed character after the last non-whitespace character", not two linefeeds, AFAIK.)

@DavidBruchmann
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes sorry, don't find the file anymore. Possible I messed with an old version.

Please sign in to comment.