From 538697c31dea932a6bee008621b18d907500e1e7 Mon Sep 17 00:00:00 2001
From: Xavier Perseguers <xavier@typo3.org>
Date: Tue, 20 Sep 2011 00:02:51 +0200
Subject: [PATCH] [BUGFIX] Invalid method signature for
 t3lib_tree_extdirect_Node::toArray()

Method toArray() from t3lib_tree_Node is not properly overriden in subclasses.

Furthermore, many phpDoc comments are wrongly returning void instead of bool.

Change-Id: I99bea296df305673d5c111fc9e5b92ea42599c5f
Fixes: #30060
Releases: 4.6
Reviewed-on: http://review.typo3.org/5088
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
---
 .../class.t3lib_tree_representationnode.php   |  3 +-
 .../class.t3lib_tree_extdirect_node.php       |  3 +-
 .../class.t3lib_tree_pagetree_node.php        | 29 ++++++++++---------
 3 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/t3lib/tree/class.t3lib_tree_representationnode.php b/t3lib/tree/class.t3lib_tree_representationnode.php
index ffb0e9f047f1..8a9482a39354 100644
--- a/t3lib/tree/class.t3lib_tree_representationnode.php
+++ b/t3lib/tree/class.t3lib_tree_representationnode.php
@@ -150,9 +150,10 @@ class t3lib_tree_RepresentationNode extends t3lib_tree_Node {
 	/**
 	 * Returns the node in an array representation that can be used for serialization
 	 *
+	 * @param bool $addChildNodes
 	 * @return array
 	 */
-	public function toArray() {
+	public function toArray($addChildNodes = TRUE) {
 		$arrayRepresentation = parent::toArray();
 		$arrayRepresentation = array_merge($arrayRepresentation, array(
 																	  'label' => $this->label,
diff --git a/t3lib/tree/extdirect/class.t3lib_tree_extdirect_node.php b/t3lib/tree/extdirect/class.t3lib_tree_extdirect_node.php
index cc40c30522c3..625ad0028aac 100644
--- a/t3lib/tree/extdirect/class.t3lib_tree_extdirect_node.php
+++ b/t3lib/tree/extdirect/class.t3lib_tree_extdirect_node.php
@@ -550,9 +550,10 @@ class t3lib_tree_extdirect_Node extends t3lib_tree_Node {
 	/**
 	 * Returns the node in an array representation that can be used for serialization
 	 *
+	 * @param bool $addChildNodes
 	 * @return array
 	 */
-	public function toArray() {
+	public function toArray($addChildNodes = TRUE) {
 		$arrayRepresentation = array(
 			'serializeClassName' => get_class($this),
 			'id' => $this->getId(),
diff --git a/t3lib/tree/pagetree/class.t3lib_tree_pagetree_node.php b/t3lib/tree/pagetree/class.t3lib_tree_pagetree_node.php
index b969183204b6..91af17c4d330 100644
--- a/t3lib/tree/pagetree/class.t3lib_tree_pagetree_node.php
+++ b/t3lib/tree/pagetree/class.t3lib_tree_pagetree_node.php
@@ -147,7 +147,7 @@ class t3lib_tree_pagetree_Node extends t3lib_tree_extdirect_Node {
 	/**
 	 * Checks if the user may create pages below the given page
 	 *
-	 * @return void
+	 * @return bool
 	 */
 	protected function canCreate() {
 		if (!isset($this->cachedAccessRights['create'])) {
@@ -161,7 +161,7 @@ class t3lib_tree_pagetree_Node extends t3lib_tree_extdirect_Node {
 	/**
 	 * Checks if the user has editing rights
 	 *
-	 * @return void
+	 * @return bool
 	 */
 	protected function canEdit() {
 		if (!isset($this->cachedAccessRights['edit'])) {
@@ -175,7 +175,7 @@ class t3lib_tree_pagetree_Node extends t3lib_tree_extdirect_Node {
 	/**
 	 * Checks if the user has the right to delete the page
 	 *
-	 * @return void
+	 * @return bool
 	 */
 	protected function canRemove()	{
 		if (!isset($this->cachedAccessRights['remove'])) {
@@ -193,7 +193,7 @@ class t3lib_tree_pagetree_Node extends t3lib_tree_extdirect_Node {
 	/**
 	 * Checks if the page can be disabled
 	 *
-	 * @return void
+	 * @return bool
 	 */
 	public function canBeDisabledAndEnabled() {
 		return $this->canEdit($this->record);
@@ -202,7 +202,7 @@ class t3lib_tree_pagetree_Node extends t3lib_tree_extdirect_Node {
 	/**
 	 * Checks if the page is allowed to can be cut
 	 *
-	 * @return void
+	 * @return bool
 	 */
 	public function canBeCut() {
 		return $this->canEdit($this->record) && intval($this->record['t3ver_state']) !== 2;
@@ -211,7 +211,7 @@ class t3lib_tree_pagetree_Node extends t3lib_tree_extdirect_Node {
 	/**
 	 * Checks if the page is allowed to be edited
 	 *
-	 * @return void
+	 * @return bool
 	 */
 	public function canBeEdited() {
 		return $this->canEdit($this->record);
@@ -220,7 +220,7 @@ class t3lib_tree_pagetree_Node extends t3lib_tree_extdirect_Node {
 	/**
 	 * Checks if the page is allowed to be copied
 	 *
-	 * @return void
+	 * @return bool
 	 */
 	public function canBeCopied() {
 		return $this->canCreate($this->record) && intval($this->record['t3ver_state']) !== 2;
@@ -229,7 +229,7 @@ class t3lib_tree_pagetree_Node extends t3lib_tree_extdirect_Node {
 	/**
 	 * Checks if there can be new pages created
 	 *
-	 * @return void
+	 * @return bool
 	 */
 	public function canCreateNewPages() {
 		return $this->canCreate($this->record);
@@ -238,7 +238,7 @@ class t3lib_tree_pagetree_Node extends t3lib_tree_extdirect_Node {
 	/**
 	 * Checks if the page is allowed to be removed
 	 *
-	 * @return void
+	 * @return bool
 	 */
 	public function canBeRemoved() {
 		return $this->canRemove($this->record) && intval($this->record['t3ver_state']) !== 2;
@@ -265,7 +265,7 @@ class t3lib_tree_pagetree_Node extends t3lib_tree_extdirect_Node {
 	/**
 	 * Checks if the page is allowed to show history
 	 *
-	 * @return void
+	 * @return bool
 	 */
 	public function canShowHistory() {
 		return TRUE;
@@ -274,7 +274,7 @@ class t3lib_tree_pagetree_Node extends t3lib_tree_extdirect_Node {
 	/**
 	 * Checks if the page is allowed to be viewed
 	 *
-	 * @return void
+	 * @return bool
 	 */
 	public function canBeViewed() {
 		return TRUE;
@@ -283,7 +283,7 @@ class t3lib_tree_pagetree_Node extends t3lib_tree_extdirect_Node {
 	/**
 	 * Checks if the page is allowed to show info
 	 *
-	 * @return void
+	 * @return bool
 	 */
 	public function canShowInfo() {
 		return TRUE;
@@ -292,7 +292,7 @@ class t3lib_tree_pagetree_Node extends t3lib_tree_extdirect_Node {
 	/**
 	 * Checks if the page is allowed to be a temporary mount point
 	 *
-	 * @return void
+	 * @return bool
 	 */
 	public function canBeTemporaryMountPoint() {
 		return TRUE;
@@ -301,9 +301,10 @@ class t3lib_tree_pagetree_Node extends t3lib_tree_extdirect_Node {
 	/**
 	 * Returns the node in an array representation that can be used for serialization
 	 *
+	 * @param bool $addChildNodes
 	 * @return array
 	 */
-	public function toArray() {
+	public function toArray($addChildNodes = TRUE) {
 		$arrayRepresentation = parent::toArray();
 
 		$arrayRepresentation['id'] = 'p' . dechex($this->getId()) . ($this->getMountPoint() ? '-' . dechex($this->getMountPoint()) : '');
-- 
GitLab