php 7.4 + code cleanup

This commit is contained in:
Daniel Huf 2021-01-26 10:15:06 +01:00
parent 04988e3565
commit 7d85973bd1
8 changed files with 16 additions and 22 deletions

View file

@ -7,7 +7,7 @@ use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
class Command implements RendererInterface
{
public function getHtmlFromMjml($mjml)
public function getHtmlFromMjml($mjml): string
{
$conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['mjml']);
@ -36,7 +36,7 @@ class Command implements RendererInterface
* @param string $args
* @return string
*/
protected function getEscapedCommand(string $cmd, string $args)
protected function getEscapedCommand(string $cmd, string $args): string
{
$escapedCmd = escapeshellcmd($cmd);

View file

@ -12,5 +12,5 @@ interface RendererInterface
* @param string $mjml
* @return string
*/
public function getHtmlFromMjml($mjml);
public function getHtmlFromMjml($mjml): string;
}

View file

@ -7,10 +7,7 @@ use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
class MjmlBasedView extends StandaloneView
{
/**
* @var RendererInterface
*/
protected $renderer;
protected RendererInterface $renderer;
public function __construct(ContentObjectRenderer $contentObject = null, RendererInterface $renderer = null)
{
@ -22,7 +19,7 @@ class MjmlBasedView extends StandaloneView
}
}
public function render($actionName = null)
public function render($actionName = null): string
{
return $this->renderer->getHtmlFromMjml(parent::render($actionName));
}

View file

@ -8,7 +8,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
abstract class AbstractUnitTestCase extends UnitTestCase
{
public function setUp()
public function setUp(): void
{
parent::setUp();

View file

@ -11,12 +11,9 @@ use TYPO3\CMS\Extbase\Object\ObjectManager;
class CommandTest extends AbstractUnitTestCase
{
/**
* @var ObjectManager
*/
protected $objectManager;
protected ObjectManager $objectManager;
public function setUp()
public function setUp(): void
{
parent::setUp();
$this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
@ -25,7 +22,7 @@ class CommandTest extends AbstractUnitTestCase
/**
* @test
*/
public function htmlIsReturnedForMjml()
public function htmlIsReturnedForMjml(): void
{
// Mock extension to be active, to enable path fetching to call node binary.
$packageMock = $this->getMockBuilder(Package::class)

View file

@ -31,7 +31,7 @@ class MjmlBasedViewTest extends AbstractUnitTestCase
/**
* @test
*/
public function viewCallsRendererAndReturnsRenderedHtml()
public function viewCallsRendererAndReturnsRenderedHtml(): void
{
$expectedHtml = '<h1>Simple HTML</h1>';
$rendererMock = $this->getMockBuilder(RendererInterface::class)->getMock();

View file

@ -15,9 +15,9 @@
}
},
"require": {
"php": "^7.1",
"typo3/cms-core": "^8.7.0 || ^9.5.0 || ^10.4.0",
"typo3/cms-form": "^8.7.0 || ^9.5.0 || ^10.4.0"
"php": "^7.4",
"typo3/cms-core": "^9.5.0 || ^10.4.0",
"typo3/cms-form": "^9.5.0 || ^10.4.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.2.0",

View file

@ -5,7 +5,7 @@ $EM_CONF[$_EXTKEY] = [
'description' => 'Mjml view using mjml over npm',
'category' => 'misc',
'shy' => 0,
'version' => '1.0.6',
'version' => '2.0.0',
'state' => 'stable',
'clearCacheOnLoad' => 1,
'author' => '',
@ -17,8 +17,8 @@ $EM_CONF[$_EXTKEY] = [
],
'constraints' => [
'depends' => [
'php' => '7.1.0-7.3.99',
'typo3' => '8.7.0-9.5.99',
'php' => '7.4.0-7.4.99',
'typo3' => '9.5.17-10.9.99',
'extbase' => '',
],
'conflicts' => [