Commit b551d5f8 authored by Susanne Moog's avatar Susanne Moog Committed by Benni Mack
Browse files

[TASK] PHP7 compliance - part 1

Fixes or skips unit tests and declaration errors on PHP7.

Change-Id: I45fb09253c7efbc8116c3b2a27586b3f504b71e2
Resolves: #68194
Releases: master
Reviewed-on: http://review.typo3.org/41274


Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benni Mack's avatarBenjamin Mack <benni@typo3.org>
Tested-by: Benni Mack's avatarBenjamin Mack <benni@typo3.org>
parent bbc101c2
......@@ -90,7 +90,7 @@ class SortedTreeNodeCollection extends \TYPO3\CMS\Backend\Tree\TreeNodeCollectio
* @param \TYPO3\CMS\Backend\Tree\TreeNode $node
* @return void
*/
public function append(\TYPO3\CMS\Backend\Tree\TreeNode $node) {
public function append($node) {
parent::append($node);
$this->asort();
$this->normalize();
......
......@@ -96,7 +96,7 @@ class FolderTreeView extends AbstractTreeView {
* @internal
* @see \TYPO3\CMS\Backend\Tree\View\PageTreeView::PMicon()
*/
public function PMicon(\TYPO3\CMS\Core\Resource\Folder $folderObject, $subFolderCounter, $totalSubFolders, $nextCount, $isExpanded) {
public function PMicon($folderObject, $subFolderCounter, $totalSubFolders, $nextCount, $isExpanded) {
$icon = '';
if ($nextCount) {
$cmd = $this->generateExpandCollapseParameter($this->bank, !$isExpanded, $folderObject);
......@@ -147,7 +147,7 @@ class FolderTreeView extends AbstractTreeView {
* @return string The processed icon input value.
* @internal
*/
public function wrapIcon($icon, \TYPO3\CMS\Core\Resource\Folder $folderObject) {
public function wrapIcon($icon, $folderObject) {
// Add title attribute to input icon tag
$theFolderIcon = '';
// Wrap icon in click-menu link.
......@@ -167,12 +167,12 @@ class FolderTreeView extends AbstractTreeView {
* Wrapping $title in a-tags.
*
* @param string $title Title string
* @param \TYPO3\CMS\Core\Resource\Folder $folderObject the folder record
* @param \TYPO3\CMS\Core\Resource\Folder $folderObject the folder record
* @param int $bank Bank pointer (which mount point number)
* @return string
* @internal
*/
public function wrapTitle($title, \TYPO3\CMS\Core\Resource\Folder $folderObject, $bank = 0) {
public function wrapTitle($title, $folderObject, $bank = 0) {
// Check storage access to wrap with click menu
if ($folderObject instanceof \TYPO3\CMS\Core\Resource\InaccessibleFolder) {
return $title;
......@@ -189,7 +189,7 @@ class FolderTreeView extends AbstractTreeView {
* @param \TYPO3\CMS\Core\Resource\Folder $folderObject The folder object
* @return int The "uid" field value.
*/
public function getId(\TYPO3\CMS\Core\Resource\Folder $folderObject) {
public function getId($folderObject) {
return GeneralUtility::md5Int($folderObject->getCombinedIdentifier());
}
......@@ -199,7 +199,7 @@ class FolderTreeView extends AbstractTreeView {
* @param \TYPO3\CMS\Core\Resource\Folder $folderObject The folder object
* @return string The jump-url parameter.
*/
public function getJumpToParam(\TYPO3\CMS\Core\Resource\Folder $folderObject) {
public function getJumpToParam($folderObject) {
return rawurlencode($folderObject->getCombinedIdentifier());
}
......@@ -221,7 +221,7 @@ class FolderTreeView extends AbstractTreeView {
* @param \TYPO3\CMS\Core\Resource\Folder $folderObject The folder to be used
* @return string The attribute value (is htmlspecialchared() already)
*/
public function getTitleAttrib(\TYPO3\CMS\Core\Resource\Folder $folderObject) {
public function getTitleAttrib($folderObject) {
return htmlspecialchars($folderObject->getName());
}
......
......@@ -180,9 +180,10 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
*
* @param string $table Table name
* @param int $id Current page id
* @param string $fields
* @return string HTML for listing.
*/
public function getTable($table, $id) {
public function getTable($table, $id, $fields = '') {
if (isset($this->externalTables[$table])) {
return $this->getExternalTables($id, $table);
} else {
......
......@@ -1182,7 +1182,7 @@ class BackendUtilityTest extends UnitTestCase {
eval(
'namespace ' . __NAMESPACE__ . ';' .
'class ' . $className . ' extends \\TYPO3\\CMS\\Backend\\Utility\\BackendUtility {' .
' static public function getPagesTSconfig() {' .
' static public function getPagesTSconfig($id, $rootLine = NULL, $returnPartArray = false) {' .
' return array();' .
' }' .
'}'
......
......@@ -22,7 +22,7 @@ class ExcludeFieldsReturnsCorrectFieldListFixture extends \TYPO3\CMS\Backend\Uti
/**
* @return array
*/
static public function getRegisteredFlexForms() {
static public function getRegisteredFlexForms($table = 'tt_content') {
return array();
}
}
\ No newline at end of file
}
......@@ -23,7 +23,7 @@ class ExcludeFieldsReturnsCorrectListWithFlexFormFieldsFixture extends \TYPO3\CM
* @param string $table
* @return array
*/
static public function getRegisteredFlexForms($table) {
static public function getRegisteredFlexForms($table = 'tt_content') {
static $called = 0;
++$called;
if ($called === 1) {
......@@ -67,4 +67,4 @@ class ExcludeFieldsReturnsCorrectListWithFlexFormFieldsFixture extends \TYPO3\CM
return array();
}
}
}
\ No newline at end of file
}
......@@ -22,7 +22,7 @@ class LabelFromItemListMergedReturnsCorrectFieldsFixture extends \TYPO3\CMS\Back
/**
* @return array
*/
static public function getPagesTSconfig() {
static public function getPagesTSconfig($id, $rootLine = NULL, $returnPartArray = FALSE) {
return array();
}
}
\ No newline at end of file
}
......@@ -22,7 +22,7 @@ class ProcessedValueForGroupWithMultipleAllowedTablesFixture extends \TYPO3\CMS\
/**
* Get record WSOL
*/
static public function getRecordWSOL() {
static public function getRecordWSOL($table, $uid, $fields = '*', $where = '', $useDeleteClause = TRUE, $unsetMovePointers = FALSE) {
static $called = 0;
++$called;
if ($called === 1) {
......@@ -36,7 +36,7 @@ class ProcessedValueForGroupWithMultipleAllowedTablesFixture extends \TYPO3\CMS\
/**
* Get record title
*/
static public function getRecordTitle() {
static public function getRecordTitle($table, $row, $prep = FALSE, $forceResult = TRUE) {
static $called = 0;
++$called;
if ($called === 1) {
......@@ -46,4 +46,4 @@ class ProcessedValueForGroupWithMultipleAllowedTablesFixture extends \TYPO3\CMS\
return 'Configuration 2';
}
}
}
\ No newline at end of file
}
......@@ -22,7 +22,7 @@ class ProcessedValueForGroupWithOneAllowedTableFixture extends \TYPO3\CMS\Backen
/**
* Get record WSOL
*/
static public function getRecordWSOL() {
static public function getRecordWSOL($table, $uid, $fields = '*', $where = '', $useDeleteClause = TRUE, $unsetMovePointers = FALSE) {
static $called = 0;
++$called;
if ($called === 1) {
......@@ -36,7 +36,7 @@ class ProcessedValueForGroupWithOneAllowedTableFixture extends \TYPO3\CMS\Backen
/**
* Get record title
*/
static public function getRecordTitle() {
static public function getRecordTitle($table, $row, $prep = FALSE, $forceResult = TRUE) {
static $called = 0;
++$called;
if ($called === 1) {
......@@ -46,4 +46,4 @@ class ProcessedValueForGroupWithOneAllowedTableFixture extends \TYPO3\CMS\Backen
return 'Page 2';
}
}
}
\ No newline at end of file
}
......@@ -27,7 +27,7 @@ class ProcessedValueForSelectWithMMRelationFixture extends \TYPO3\CMS\Backend\Ut
*
* @return string
*/
static public function getRecordTitle($table, $row) {
static public function getRecordTitle($table, $row, $prep = FALSE, $forceResult = TRUE) {
return $row['title'];
}
}
\ No newline at end of file
}
......@@ -60,7 +60,7 @@ class FailsafePackageManager extends PackageManager {
*
* @return void
*/
protected function registerPackagesFromConfiguration() {
protected function registerPackagesFromConfiguration($registerOnlyNewPackages = FALSE) {
$this->packageStatesConfiguration['packages']['install']['state'] = 'active';
parent::registerPackagesFromConfiguration();
}
......
......@@ -23,10 +23,10 @@ class ExtJsArrayTreeRenderer extends \TYPO3\CMS\Backend\Tree\Renderer\ExtJsJsonT
* Gets the node array. If the TCA configuration has defined items,
* they are added to rootlevel on top of the tree
*
* @param \TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeNode $node
* @param \TYPO3\CMS\Backend\Tree\TreeRepresentationNode|DatabaseTreeNode $node
* @return array
*/
protected function getNodeArray(DatabaseTreeNode $node) {
protected function getNodeArray(\TYPO3\CMS\Backend\Tree\TreeRepresentationNode $node) {
$nodeArray = parent::getNodeArray($node);
$nodeArray = array_merge($nodeArray, array(
'expanded' => $node->getExpanded(),
......@@ -42,7 +42,7 @@ class ExtJsArrayTreeRenderer extends \TYPO3\CMS\Backend\Tree\Renderer\ExtJsJsonT
/**
* Renders a node collection recursive or just a single instance
*
* @param \TYPO3\CMS\Backend\Tree\TreeNodeCollection $node
* @param \TYPO3\CMS\Backend\Tree\AbstractTree $tree
* @param bool $recursive
* @return array
*/
......
......@@ -94,7 +94,7 @@ class ExtractorRegistryTest extends UnitTestCase {
/**
* @test
*/
public function registeredExtractorClassWithSamePriorityAreReturnedInSameOrderAsTheyWereAdded() {
public function registeredExtractorClassWithSamePriorityAreAllReturned() {
$extractorClass1 = 'b70551b2b2db62b6b15a9bbfcbd50614';
$extractorObject1 = $this->getMock(\TYPO3\CMS\Core\Resource\Index\ExtractorInterface::class, array(), array(), $extractorClass1);
......@@ -114,8 +114,8 @@ class ExtractorRegistryTest extends UnitTestCase {
$extractorRegistry->registerExtractionService($extractorClass2);
$extractorInstances = $extractorRegistry->getExtractors();
$this->assertTrue($extractorInstances[0] instanceof $extractorClass1);
$this->assertTrue($extractorInstances[1] instanceof $extractorClass2);
$this->assertContains($extractorObject1, $extractorInstances);
$this->assertContains($extractorObject2, $extractorInstances);
}
/**
......
......@@ -109,7 +109,7 @@ class RendererRegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
/**
* @test
*/
public function registeredFileRendererClassWithSamePriorityAreReturnedInSameOrderAsTheyWereAdded() {
public function registeredFileRendererClassWithSamePriorityAreAllReturned() {
$rendererClass1 = $this->getUniqueId('myRenderer1');
$rendererObject1 = $this->getMock(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class, array(), array(), $rendererClass1);
$rendererObject1->expects($this->any())->method('getPriority')->will($this->returnValue(1));
......@@ -128,8 +128,8 @@ class RendererRegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
$rendererRegistry->registerRendererClass($rendererClass2);
$rendererInstances = $rendererRegistry->getRendererInstances();
$this->assertTrue($rendererInstances[0] instanceof $rendererClass1);
$this->assertTrue($rendererInstances[1] instanceof $rendererClass2);
$this->assertContains($rendererObject1, $rendererInstances);
$this->assertContains($rendererObject2, $rendererInstances);
}
/**
......
......@@ -28,7 +28,7 @@ class GeneralUtilityMinifyJavaScriptFixture extends GeneralUtility {
* @throws \UnexpectedValueException
* @throws \RuntimeException
*/
static public function devLog($errorMessage) {
static public function devLog($errorMessage, $extKey, $severity = 0, $dataVar = FALSE) {
if ($errorMessage !== 'Error minifying java script: foo') {
throw new \UnexpectedValueException('broken');
}
......
......@@ -119,7 +119,7 @@ class LazyObjectStorage extends \TYPO3\CMS\Extbase\Persistence\ObjectStorage imp
*
* @see \TYPO3\CMS\Extbase\Persistence\ObjectStorage::addAll
*/
public function addAll($storage) {
public function addAll(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $storage) {
$this->initialize();
parent::addAll($storage);
}
......@@ -255,7 +255,7 @@ class LazyObjectStorage extends \TYPO3\CMS\Extbase\Persistence\ObjectStorage imp
*
* @see \TYPO3\CMS\Extbase\Persistence\ObjectStorage::removeAll
*/
public function removeAll($storage) {
public function removeAll(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $storage) {
$this->initialize();
parent::removeAll($storage);
}
......
......@@ -55,6 +55,9 @@ class RequestBuilderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
protected $mockRequest;
protected function setUp() {
if (PHP_VERSION_ID >= 70000) {
$this->markTestSkipped('Skipped because of PHP 7 memory bug.');
}
$this->requestBuilder = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder::class, array('dummy'));
$this->configuration = array(
'userFunc' => 'Tx_Extbase_Dispatcher->dispatch',
......
......@@ -613,7 +613,7 @@ class FileList extends AbstractRecordList {
*
* @return string URL
*/
public function listURL() {
public function listURL($altId = '') {
return GeneralUtility::linkThisScript(array(
'target' => rawurlencode($this->folderObject->getCombinedIdentifier()),
'imagemode' => $this->thumbs
......
......@@ -32,7 +32,7 @@ class FileListFolderTree extends \TYPO3\CMS\Backend\Tree\View\FolderTreeView {
* @param \TYPO3\CMS\Core\Resource\Folder $folderObject the folder object
* @return string folder icon
*/
public function wrapIcon($theFolderIcon, \TYPO3\CMS\Core\Resource\Folder $folderObject) {
public function wrapIcon($theFolderIcon, $folderObject) {
$theFolderIcon = parent::wrapIcon($theFolderIcon, $folderObject);
// Wrap icon in a drag/drop span.
return '<span class="dragIcon" id="dragIconID_' . $this->getJumpToParam($folderObject) . '">' . $theFolderIcon . '</span>';
......@@ -47,7 +47,7 @@ class FileListFolderTree extends \TYPO3\CMS\Backend\Tree\View\FolderTreeView {
* @return string
* @access private
*/
public function wrapTitle($title, \TYPO3\CMS\Core\Resource\Folder $folderObject, $bank = 0) {
public function wrapTitle($title, $folderObject, $bank = 0) {
$theFolderTitle = parent::wrapTitle($title, $folderObject, $bank);
// Wrap title in a drag/drop span.
return '<span class="dragTitle" id="dragTitleID_' . $this->getJumpToParam($folderObject) . '">' . $theFolderTitle . '</span>';
......
......@@ -65,10 +65,11 @@ abstract class AbstractConditionViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHel
/**
* renders <f:then> child if $condition is true, otherwise renders <f:else> child.
*
* @param string $condition
* @return string the rendered string
* @api
*/
public function render() {
public function render($condition = '') {
if (static::evaluateCondition($this->arguments)) {
return $this->renderThenChild();
} else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment