Skip to content

Commit

Permalink
Adds type hints and enforces strict types (Resolves #133)
Browse files Browse the repository at this point in the history
  • Loading branch information
maechler committed Feb 25, 2023
1 parent 03392f7 commit eefa422
Show file tree
Hide file tree
Showing 63 changed files with 475 additions and 771 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
run: composer require typo3/cms-core="${TYPO3_VERSION}"

- name: PHPCS
run: .Build/bin/phpcs -n --standard=PSR2 Classes/
run: .Build/bin/phpcs -n --standard=PSR12 Classes/

- name: Unit Tests
run: .Build/bin/phpunit --testdox -c .Build/vendor/typo3/testing-framework/Resources/Core/Build/UnitTests.xml Tests/Unit/;
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 3.0.0 - Not yet released

- Adds type hints and enforces strict types, [#133](https://github.com/bithost-gmbh/pdfviewhelpers/issues/133)
- Removes deprecated classes EmptyFPDI and EmptyTCPDF
- Drops support for TYPO3 9 LTS
- Drops support for PHP < 7.4
Expand Down
7 changes: 4 additions & 3 deletions Classes/Exception/Exception.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php

declare(strict_types=1);

namespace Bithost\Pdfviewhelpers\Exception;

/***
/* * *
*
* This file is part of the "PDF ViewHelpers" Extension for TYPO3 CMS.
*
Expand All @@ -26,7 +28,7 @@
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***/
* * */

/**
* Exception
Expand All @@ -35,5 +37,4 @@
*/
class Exception extends \Exception
{

}
7 changes: 4 additions & 3 deletions Classes/Exception/ValidationException.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php

declare(strict_types=1);

namespace Bithost\Pdfviewhelpers\Exception;

/***
/* * *
*
* This file is part of the "PDF ViewHelpers" Extension for TYPO3 CMS.
*
Expand All @@ -26,7 +28,7 @@
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***/
* * */

/**
* ValidationException
Expand All @@ -35,5 +37,4 @@
*/
class ValidationException extends Exception
{

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php

declare(strict_types=1);

namespace Bithost\Pdfviewhelpers\Hooks;

/***
/* * *
*
* This file is part of the "PDF ViewHelpers" Extension for TYPO3 CMS.
*
Expand All @@ -26,27 +28,25 @@
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***/
* * */

use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;

/**
* TypoScriptFrontendController
*
* @author Markus Mächler <markus.maechler@bithost.ch>, Esteban Gehring <esteban.gehring@bithost.ch>
*/
class TypoScriptFrontendController implements SingletonInterface
class TypoScriptFrontendControllerHook implements SingletonInterface
{
/**
* Prevent any output when a pdf is rendered, especially any headers being set!
*
* @param array $params Parameters from frontend
* @param object $ref TSFE object
* @return void
*/
public function isOutputting(&$params, $ref)
public function isOutputting(array &$params, TypoScriptFrontendController $ref): void
{
if (isset($params['pObj']->applicationData['tx_pdfviewhelpers']['pdfOutput'])
if (
isset($params['pObj']->applicationData['tx_pdfviewhelpers']['pdfOutput'])
&& $params['pObj']->applicationData['tx_pdfviewhelpers']['pdfOutput'] === true
) {
$params['enableOutput'] = false;
Expand Down
3 changes: 2 additions & 1 deletion Classes/Middleware/Frontend/StopOutputMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
{
$response = $handler->handle($request);

if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() >= 11
if (
GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() >= 11
&& ($GLOBALS['TSFE']->applicationData['tx_pdfviewhelpers']['pdfOutput'] ?? false)
) {
return new NullResponse();
Expand Down
Loading

0 comments on commit eefa422

Please sign in to comment.