Skip to content

Commit

Permalink
[BUGFIX] Fix the return type annotations of JsonView
Browse files Browse the repository at this point in the history
transformValue will return the argument (mixed) untransformed if it is no
array or object and thus needs to return mixed as well.

transformObject will return a string for DateTime and hence needs to have
string as an additional return type.

Resolves: #84570
Releases: master, 8.7
Change-Id: I4d73f060eebb20b6f521fa685eca99acb688c702
Reviewed-on: https://review.typo3.org/56499
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
  • Loading branch information
oliverklee authored and NeoBlack committed Apr 4, 2018
1 parent 8ae0820 commit de0dd5a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions typo3/sysext/extbase/Classes/Mvc/View/JsonView.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public function render()
* Loads the configuration and transforms the value to a serializable
* array.
*
* @return array An array containing the values, ready to be JSON encoded
* @return mixed
* @api
*/
protected function renderArray()
Expand All @@ -261,7 +261,7 @@ protected function renderArray()
*
* @param mixed $value The value to transform
* @param array $configuration Configuration for transforming the value
* @return array The transformed value
* @return mixed The transformed value
*/
protected function transformValue($value, array $configuration)
{
Expand Down Expand Up @@ -294,7 +294,7 @@ protected function transformValue($value, array $configuration)
*
* @param object $object Object to traverse
* @param array $configuration Configuration for transforming the given object or NULL
* @return array Object structure as an array
* @return array|string Object structure as an array or as a rendered string (for a DateTime instance)
*/
protected function transformObject($object, array $configuration)
{
Expand Down

0 comments on commit de0dd5a

Please sign in to comment.