Skip to content

Commit

Permalink
Bugfix/php8 issues (#337)
Browse files Browse the repository at this point in the history
Fixed some php8 issues and share viewcontext of configuration with request
  • Loading branch information
digedag authored Nov 12, 2023
1 parent 482410a commit d722aa7
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 11 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
Changelog
---------

v1.18.0 (??.10.2023)
v1.18.0 (??.11.2023)

* Auto-detect module identifier to avoid boilerblade-code
* BC: Parameter type of exceptions changed in ExceptionHandlerInterface to \Throwable
* Share ViewContext instance of current configuration with current request
* Fixed some PHP 8 issues

v1.17.4 (22.09.2023)

Expand Down
2 changes: 1 addition & 1 deletion Classes/Backend/Form/ToolBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ public function getStoredRequestData($key, $changed = [], $modName = 'DEFRNBASEM
}
$ret = BackendUtility::getModuleData([$key => ''], $changed, $modName);

return $ret[$key];
return $ret[$key] ?? null;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Classes/Backend/Module/ModFuncFrame.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function render(IModFunc $modFunc, callable $renderFunc, ServerRequestInt
$this->currentModule = $request->getAttribute('module');
$this->getLanguageService()->includeLLFile('EXT:rn_base/Resources/Private/Language/locallang.xlf');
$config = $this->getConfigurations();
$files = $config->get('languagefiles.');
$files = $config->get('languagefiles.') ?? [];
foreach ($files as $filename) {
$this->getLanguageService()->includeLLFile($filename);
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Backend/Utility/Tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ protected function prepareRow($entry, $columns, $formTool, $options)
* Liefert die passenden Überschrift für die Tabelle.
*
* @param array $columns
* @param array $options
* @param DataModel $options
* @param \Sys25\RnBase\Backend\Form\ToolBox $formTool
*
* @return array
Expand Down
3 changes: 2 additions & 1 deletion Classes/Configuration/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use ArrayObject;
use Sys25\RnBase\Exception\SkipActionException;
use Sys25\RnBase\Frontend\Marker\FormatUtil;
use Sys25\RnBase\Frontend\View\ViewContext;
use Sys25\RnBase\Utility\Arrays;
use Sys25\RnBase\Utility\Debug;
use Sys25\RnBase\Utility\Extensions;
Expand Down Expand Up @@ -200,7 +201,7 @@ class Processor implements ConfigurationInterface
public function __construct()
{
$this->_dataStore = new ArrayObject();
$this->_viewData = new ArrayObject();
$this->_viewData = new ViewContext();
$this->_keepVars = new ArrayObject();
$this->localLangUtil = tx_rnbase::makeInstance(Language::class);
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Repository/FeUserRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function getInstance(int $uid)
if (!$uid) {
throw new Exception('No uid for fe_user given!');
}
if (!is_object(self::$instances[$uid])) {
if (!isset(self::$instances[$uid])) {
self::$instances[$uid] = $this->findByUidForced($uid);
}

Expand Down
4 changes: 2 additions & 2 deletions Classes/Frontend/Marker/BaseMarker.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public static function initLink(&$markerArray, &$subpartArray, &$wrappedSubpartA
return; // Nothing to do
}

$linkObj = &$formatter->getConfigurations()->createLink();
$linkObj = $formatter->getConfigurations()->createLink();
$token = self::getToken();
$linkObj->label($token);
$links = $formatter->getConfigurations()->get($confId.'links.');
Expand Down Expand Up @@ -357,7 +357,7 @@ protected function getDefaultMarkerArray()
*/
protected static function getEmptyInstance($classname)
{
if (!is_object(self::$emptyObjects[$classname])) {
if (!isset(self::$emptyObjects[$classname])) {
/* @var $dummy DomainModelInterface */
$dummyInstance = tx_rnbase::makeInstance($classname, ['uid' => 0]);
if ($dummyInstance instanceof DomainModelInterface
Expand Down
3 changes: 1 addition & 2 deletions Classes/Frontend/Request/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Sys25\RnBase\Configuration\ConfigurationInterface;
use Sys25\RnBase\Frontend\View\ContextInterface;
use Sys25\RnBase\Frontend\View\ViewContext;

/***************************************************************
* Copyright notice
Expand Down Expand Up @@ -47,7 +46,7 @@ public function __construct(
$this->configurations = $configurations;
$this->confId = $confId;
$this->parameters = $parameters;
$this->viewContext = new ViewContext();
$this->viewContext = $configurations->getViewData();
}

public function getConfigurations(): ConfigurationInterface
Expand Down
2 changes: 1 addition & 1 deletion Classes/Search/SearchBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public function search(array $fields, array $options = [])

continue;
}
list($tableAlias, $col) = explode('.', $field);
list($tableAlias, $col) = array_pad(explode('.', $field), 2, null);
if (!isset($col)) {
$orderby[] = $tableAlias.' '.('DESC' == strtoupper($order) ? 'DESC' : 'ASC');
} else {
Expand Down
1 change: 1 addition & 0 deletions Classes/Utility/Files.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public static function getFileResource($fName, $options = [])
if (null === $incFile) {
$incFile = self::getFileName($fName);
}
$ret = '';
if ($incFile) {
// Im BE muss ein absoluter Pfad verwendet werden
$fullPath = Environment::isBackend() ? Environment::getPublicPath().$incFile : $incFile;
Expand Down

0 comments on commit d722aa7

Please sign in to comment.