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 class Command implements RendererInterface
{ {
public function getHtmlFromMjml($mjml) public function getHtmlFromMjml($mjml): string
{ {
$conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['mjml']); $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['mjml']);
@ -36,7 +36,7 @@ class Command implements RendererInterface
* @param string $args * @param string $args
* @return string * @return string
*/ */
protected function getEscapedCommand(string $cmd, string $args) protected function getEscapedCommand(string $cmd, string $args): string
{ {
$escapedCmd = escapeshellcmd($cmd); $escapedCmd = escapeshellcmd($cmd);

View file

@ -12,5 +12,5 @@ interface RendererInterface
* @param string $mjml * @param string $mjml
* @return string * @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 class MjmlBasedView extends StandaloneView
{ {
/** protected RendererInterface $renderer;
* @var RendererInterface
*/
protected $renderer;
public function __construct(ContentObjectRenderer $contentObject = null, RendererInterface $renderer = null) 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)); return $this->renderer->getHtmlFromMjml(parent::render($actionName));
} }

View file

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

View file

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

View file

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

View file

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

View file

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