Breaking-97210-TypesAddedToMethodSignaturesOrClassProperties.rst 2.11 KB
Newer Older
1
.. include:: /Includes.rst.txt
2

3
4
5
=======================================================================
Breaking: #97210 - Types added to method signatures or class properties
=======================================================================
6
7
8
9
10
11
12
13
14
15
16

See :issue:`97210`

Description
===========

The following PHP classes have had parameter and return types added to their method
signatures. The types are consistent with existing docblock-documented type
expectations and existing behavior.

- :php:`\TYPO3\CMS\Core\Utility\ArrayUtility`
17
- :php:`\TYPO3\CMS\Core\Utility\ClassNamingUtility`
18
- :php:`\TYPO3\CMS\Core\Utility\CsvUtility`
19
- :php:`\TYPO3\CMS\Core\Utility\CommandUtility`
20
- :php:`\TYPO3\CMS\Core\Utility\DebugUtility`
21
- :php:`\TYPO3\CMS\Core\Utility\DiffUtility`
22
- :php:`\TYPO3\CMS\Core\Utility\ExtensionManagementUtility`
23
- :php:`\TYPO3\CMS\Core\Utility\MailUtility`
24
- :php:`\TYPO3\CMS\Core\Utility\MathUtility`
25
26
- :php:`\TYPO3\CMS\Core\Utility\PathUtility`
- :php:`\TYPO3\CMS\Core\Utility\RootlineUtility`
27
- :php:`\TYPO3\CMS\Core\Utility\StringUtility`
28
- :php:`\TYPO3\CMS\Core\Utility\VersionNumberUtility`
29

30
31
32
The following PHP classes have added public class property types:

- :php:`\TYPO3\CMS\Core\Utility\DiffUtility`
33
34
35
36
37
38
39
40
41
42
43
44

Impact
======

Calling any of these methods with incompatible types now throws a :php:`\TypeError`,
especially if the calling code is within :php:`declare(strict_types=1);` context.
Before the result of such method calls was undefined or inconsistent.


Affected Installations
======================

45
Code routines that are passing an invalid type will need to ensure they pass a correct type.
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

If a code file is running with :php:`declare(strict_types=1);`, that includes, for instance,
passing a numeric string to a method that expects an int or float. Those will need to be
properly cast before being passed.

The extension scanner will not find affected extensions.

Migration
=========

Any code that is already passing the expected type to these methods will be unaffected.
Code that is passing an incorrect type will need to pass the correct type, possibly
including an explicit cast.

.. index:: PHP-API, NotScanned, ext:core