Commit cd34ee6e authored by Benni Mack's avatar Benni Mack
Browse files

[!!!][TASK] Remove legacy ArrayAccess functionality of LinkResult

The introduced LinkResult object and its functionality
has had a fallback built via ArrayAccess for the
LinkBuilderInterface to be compatible with array-ish
LinkResult objects to access the previously returned array
until TYPO3 v11 LTS.

This change now removes the legacy layer, as TYPO3 only
works with the LinkResult object directly everywhere.

Resolves: #97546
Related: #96107
Related: #96317
Releases: main
Change-Id: I733c85359b2f8b5886626a67fe106806f5405c7b
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74509


Reviewed-by: Oliver Hader's avatarOliver Hader <oliver.hader@typo3.org>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 803f9dfe
...@@ -369,6 +369,7 @@ The following fallbacks have been removed: ...@@ -369,6 +369,7 @@ The following fallbacks have been removed:
- Extbase no longer determines types from doc block annotations for dependency injection methods and actions with validators, - Extbase no longer determines types from doc block annotations for dependency injection methods and actions with validators,
defined types in method signatures must be used. defined types in method signatures must be used.
- Accessing core related caches with :php:`cache_` prefix has been removed. - Accessing core related caches with :php:`cache_` prefix has been removed.
- Accessing :php:`\TYPO3\CMS\Frontend\Typolink\LinkResult` properties as arrays - ArrayAccess functionality removed
The following database tables have been removed: The following database tables have been removed:
......
...@@ -20,10 +20,10 @@ namespace TYPO3\CMS\Frontend\Typolink; ...@@ -20,10 +20,10 @@ namespace TYPO3\CMS\Frontend\Typolink;
use TYPO3\CMS\Core\LinkHandling\LinkService; use TYPO3\CMS\Core\LinkHandling\LinkService;
/** /**
* This class represents a created link to a resource (page, email etc), coming from linkService * This class represents a created link to a resource (page, email etc.), coming from LinkService.
* and after it was executed by the LinkBuilders (mostly in Frontend) after it is called from Typolink. * After it was executed by the LinkBuilders (mostly in Frontend) after it is called from Typolink.
*/ */
class LinkResult implements LinkResultInterface, \JsonSerializable, \ArrayAccess class LinkResult implements LinkResultInterface, \JsonSerializable
{ {
protected string $type = LinkService::TYPE_UNKNOWN; protected string $type = LinkService::TYPE_UNKNOWN;
protected string $url; protected string $url;
...@@ -194,89 +194,4 @@ class LinkResult implements LinkResultInterface, \JsonSerializable, \ArrayAccess ...@@ -194,89 +194,4 @@ class LinkResult implements LinkResultInterface, \JsonSerializable, \ArrayAccess
return ''; return '';
} }
} }
/**
* Kept for legacy reasons, will be removed in TYPO3 v12.0.
* This is built because the LinkBuilders now return an object instead an array with three items.
*/
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
switch ($offset) {
case 0:
case '0':
return $this->url !== '';
case 1:
case '1':
return $this->linkText !== null;
case 2:
case '2':
return $this->target !== '';
default:
return false;
}
}
// @todo Will this also removed in TYPO3 v12.0, like offsetExists ?
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
switch ($offset) {
case 0:
case '0':
return $this->getUrl();
case 1:
case '1':
return $this->getLinkText();
case 2:
case '2':
return $this->getTarget();
default:
return null;
}
}
// @todo Will this also removed in TYPO3 v12.0, like offsetExists ?
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
switch ($offset) {
case 0:
case '0':
$this->url = (string)$value;
break;
case 1:
case '1':
$this->linkText = (string)$value;
break;
case 2:
case '2':
$this->target = (string)$value;
break;
default:
// do nothing
}
}
// @todo Will this also removed in TYPO3 v12.0, like offsetExists ?
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
switch ($offset) {
case 0:
case '0':
$this->url = '';
break;
case 1:
case '1':
$this->linkText = null;
break;
case 2:
case '2':
$this->target = '';
break;
default:
// do nothing
}
}
} }
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