Skip to content

Commit 16a851a

Browse files
committed
N°8851 - Explicit nullable in functions parameters
1 parent 2247691 commit 16a851a

File tree

82 files changed

+173
-173
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+173
-173
lines changed

application/cmdbabstract.class.inc.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6037,7 +6037,7 @@ final protected function FireEventUnArchive(): void
60376037
* @return void
60386038
* @since 3.1.0
60396039
*/
6040-
final public function AddAttributeFlags(string $sAttCode, int $iFlags, string $sTargetState = '', string $sReason = null): void
6040+
final public function AddAttributeFlags(string $sAttCode, int $iFlags, string $sTargetState = '', ?string $sReason = null): void
60416041
{
60426042
if (!isset($this->aAttributesFlags[$sTargetState])) {
60436043
$this->aAttributesFlags[$sTargetState] = [];
@@ -6060,7 +6060,7 @@ final public function AddAttributeFlags(string $sAttCode, int $iFlags, string $s
60606060
* @return void
60616061
* @since 3.1.0
60626062
*/
6063-
final public function ForceAttributeFlags(string $sAttCode, int $iFlags, string $sTargetState = '', string $sReason = null): void
6063+
final public function ForceAttributeFlags(string $sAttCode, int $iFlags, string $sTargetState = '', ?string $sReason = null): void
60646064
{
60656065
if (!isset($this->aAttributesFlags[$sTargetState])) {
60666066
$this->aAttributesFlags[$sTargetState] = [];
@@ -6101,7 +6101,7 @@ final protected function GetExtensionsAttributeFlags(string $sAttCode, array &$a
61016101
* @return void
61026102
* @since 3.1.0
61036103
*/
6104-
final public function AddInitialAttributeFlags(string $sAttCode, int $iFlags, string $sReason = null)
6104+
final public function AddInitialAttributeFlags(string $sAttCode, int $iFlags, ?string $sReason = null)
61056105
{
61066106
if (!isset($this->aInitialAttributesFlags)) {
61076107
$this->aInitialAttributesFlags = [];
@@ -6123,7 +6123,7 @@ final public function AddInitialAttributeFlags(string $sAttCode, int $iFlags, st
61236123
* @return void
61246124
* @since 3.1.0
61256125
*/
6126-
final public function ForceInitialAttributeFlags(string $sAttCode, int $iFlags, string $sReason = null)
6126+
final public function ForceInitialAttributeFlags(string $sAttCode, int $iFlags, ?string $sReason = null)
61276127
{
61286128
if (!isset($this->aInitialAttributesFlags)) {
61296129
$this->aInitialAttributesFlags = [];

application/newsroomprovider.class.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function SetConfig(Config $oConfig);
3434
* @param User $oUser The user for who to check if the provider is applicable.
3535
* return bool
3636
*/
37-
public function IsApplicable(User $oUser = null);
37+
public function IsApplicable(?User $oUser = null);
3838

3939
/**
4040
* The human readable (localized) label for this provider
@@ -139,7 +139,7 @@ abstract public function GetMarkAllAsReadURL();
139139
*/
140140
abstract public function GetViewAllURL();
141141

142-
public function IsApplicable(User $oUser = null)
142+
public function IsApplicable(?User $oUser = null)
143143
{
144144
return false;
145145
}

application/query.class.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function GetAttributeFlags($sAttCode, &$aReasons = [], $sTargetState = ''
151151
* @return string|null
152152
* @since 3.1.0
153153
*/
154-
abstract public function GetExportUrl(array $aValues = null): ?string;
154+
abstract public function GetExportUrl(?array $aValues = null): ?string;
155155

156156
/**
157157
* Update last export information.
@@ -227,7 +227,7 @@ public static function Init()
227227
}
228228

229229
/** @inheritdoc */
230-
public function GetExportUrl(array $aValues = null): ?string
230+
public function GetExportUrl(?array $aValues = null): ?string
231231
{
232232
try {
233233
// retrieve attributes

application/utils.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,7 @@ public static function DebugBacktrace($iLimit = 5)
12841284
* @throws \CoreException
12851285
* @throws \Exception
12861286
*/
1287-
public static function ExecITopScript(string $sScriptName, array $aArguments, string $sAuthUser = null, string $sAuthPwd = null)
1287+
public static function ExecITopScript(string $sScriptName, array $aArguments, ?string $sAuthUser = null, ?string $sAuthPwd = null)
12881288
{
12891289
$aDisabled = explode(', ', ini_get('disable_functions'));
12901290
if (in_array('exec', $aDisabled)) {
@@ -1374,7 +1374,7 @@ public static function GetDataPath(): string
13741374
* @return string A path to a folder into which any module can store cache data
13751375
* The corresponding folder is created or cleaned upon code compilation
13761376
*/
1377-
public static function GetCachePath(string $sEnvironment = null): string
1377+
public static function GetCachePath(?string $sEnvironment = null): string
13781378
{
13791379
if (is_null($sEnvironment)) {
13801380
$sEnvironment = MetaModel::GetEnvironment();

core/attributedef.class.inc.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ public function MakeValue()
912912
return call_user_func($sComputeFunc);
913913
}
914914

915-
abstract public function GetDefaultValue(DBObject $oHostObject = null);
915+
abstract public function GetDefaultValue(?DBObject $oHostObject = null);
916916

917917
//
918918
// To be overloaded in subclasses
@@ -1476,7 +1476,7 @@ public function GetEditClass()
14761476
return "";
14771477
}
14781478

1479-
public function GetDefaultValue(DBObject $oHostObject = null)
1479+
public function GetDefaultValue(?DBObject $oHostObject = null)
14801480
{
14811481
return null;
14821482
}
@@ -1622,7 +1622,7 @@ public function GetPrerequisiteAttributes($sClass = null)
16221622
* @throws \CoreException
16231623
* @throws \CoreWarning
16241624
*/
1625-
public function GetDefaultValue(DBObject $oHostObject = null)
1625+
public function GetDefaultValue(?DBObject $oHostObject = null)
16261626
{
16271627
if ($oHostObject === null) {
16281628
return null;
@@ -2639,7 +2639,7 @@ public function GetSQLExpr()
26392639
return $this->Get("sql");
26402640
}
26412641

2642-
public function GetDefaultValue(DBObject $oHostObject = null)
2642+
public function GetDefaultValue(?DBObject $oHostObject = null)
26432643
{
26442644
return $this->MakeRealValue("", $oHostObject);
26452645
}
@@ -2728,7 +2728,7 @@ public static function ListExpectedParams()
27282728
return array_merge(parent::ListExpectedParams(), ["default_value", "is_null_allowed"]);
27292729
}
27302730

2731-
public function GetDefaultValue(DBObject $oHostObject = null)
2731+
public function GetDefaultValue(?DBObject $oHostObject = null)
27322732
{
27332733
return $this->MakeRealValue($this->Get("default_value"), $oHostObject);
27342734
}
@@ -2917,7 +2917,7 @@ protected function GetSQLCol($bFullSpec = false)
29172917
return "INT(11)".($bFullSpec ? " DEFAULT 0" : "");
29182918
}
29192919

2920-
public function GetDefaultValue(DBObject $oHostObject = null)
2920+
public function GetDefaultValue(?DBObject $oHostObject = null)
29212921
{
29222922
return 0;
29232923
}
@@ -3649,7 +3649,7 @@ public function __construct($sCode, $aParams)
36493649
parent::__construct($sCode, $aParams);
36503650
}
36513651

3652-
public function GetDefaultValue(DBObject $oHostObject = null)
3652+
public function GetDefaultValue(?DBObject $oHostObject = null)
36533653
{
36543654
$sDefault = parent::GetDefaultValue($oHostObject);
36553655
if (!$this->IsNullAllowed() && $this->IsNull($sDefault)) {
@@ -3843,7 +3843,7 @@ public function SetFixedValue($sValue)
38433843
$this->m_sValue = $sValue;
38443844
}
38453845

3846-
public function GetDefaultValue(DBObject $oHostObject = null)
3846+
public function GetDefaultValue(?DBObject $oHostObject = null)
38473847
{
38483848
return $this->m_sValue;
38493849
}
@@ -4730,7 +4730,7 @@ public function GetAsPlainText($value, $oHostObj = null)
47304730
}
47314731
}
47324732

4733-
public function GetDefaultValue(DBObject $oHostObject = null)
4733+
public function GetDefaultValue(?DBObject $oHostObject = null)
47344734
{
47354735
return new ormCaseLog();
47364736
}
@@ -6128,7 +6128,7 @@ public static function GetAsUnixSeconds($value)
61286128
return $iUnixSeconds;
61296129
}
61306130

6131-
public function GetDefaultValue(DBObject $oHostObject = null)
6131+
public function GetDefaultValue(?DBObject $oHostObject = null)
61326132
{
61336133
$sDefaultValue = $this->Get('default_value');
61346134
if (utils::IsNotNullOrEmptyString($sDefaultValue)) {
@@ -6812,7 +6812,7 @@ public function GetDisplayStyle()
68126812
return $this->GetOptional('display_style', 'select');
68136813
}
68146814

6815-
public function GetDefaultValue(DBObject $oHostObject = null)
6815+
public function GetDefaultValue(?DBObject $oHostObject = null)
68166816
{
68176817
return 0;
68186818
}
@@ -7547,7 +7547,7 @@ public function GetSQLExpr()
75477547
return $oExtAttDef->GetSQLExpr();
75487548
}
75497549

7550-
public function GetDefaultValue(DBObject $oHostObject = null)
7550+
public function GetDefaultValue(?DBObject $oHostObject = null)
75517551
{
75527552
$oExtAttDef = $this->GetExtAttDef();
75537553

@@ -7910,12 +7910,12 @@ public function IsWritable()
79107910
return true;
79117911
}
79127912

7913-
public function GetDefaultValue(DBObject $oHostObject = null)
7913+
public function GetDefaultValue(?DBObject $oHostObject = null)
79147914
{
79157915
return new ormDocument('', '', '');
79167916
}
79177917

7918-
public function IsNullAllowed(DBObject $oHostObject = null)
7918+
public function IsNullAllowed(?DBObject $oHostObject = null)
79197919
{
79207920
return $this->GetOptional("is_null_allowed", false);
79217921
}
@@ -8295,7 +8295,7 @@ public function MakeRealValue($proposedValue, $oHostObj)
82958295
return $oDoc;
82968296
}
82978297

8298-
public function GetDefaultValue(DBObject $oHostObject = null)
8298+
public function GetDefaultValue(?DBObject $oHostObject = null)
82998299
{
83008300
return new ormDocument('', '', '');
83018301
}
@@ -8481,7 +8481,7 @@ public function IsWritable()
84818481
return true;
84828482
}
84838483

8484-
public function GetDefaultValue(DBObject $oHostObject = null)
8484+
public function GetDefaultValue(?DBObject $oHostObject = null)
84858485
{
84868486
return $this->NewStopWatch();
84878487
}
@@ -9348,7 +9348,7 @@ public function IsWritable()
93489348
return false;
93499349
}
93509350

9351-
public function GetDefaultValue(DBObject $oHostObject = null)
9351+
public function GetDefaultValue(?DBObject $oHostObject = null)
93529352
{
93539353
return null;
93549354
}
@@ -9566,7 +9566,7 @@ public function IsWritable()
95669566
return true;
95679567
}
95689568

9569-
public function GetDefaultValue(DBObject $oHostObject = null)
9569+
public function GetDefaultValue(?DBObject $oHostObject = null)
95709570
{
95719571
return "";
95729572
}
@@ -10146,7 +10146,7 @@ public function RequiresFullTextIndex()
1014610146
return true;
1014710147
}
1014810148

10149-
public function GetDefaultValue(DBObject $oHostObject = null)
10149+
public function GetDefaultValue(?DBObject $oHostObject = null)
1015010150
{
1015110151
return null;
1015210152
}
@@ -11359,7 +11359,7 @@ public function GetNullValue()
1135911359
return new ormTagSet(MetaModel::GetAttributeOrigin($this->GetHostClass(), $this->GetCode()), $this->GetCode(), $this->GetMaxItems());
1136011360
}
1136111361

11362-
public function GetDefaultValue(DBObject $oHostObject = null)
11362+
public function GetDefaultValue(?DBObject $oHostObject = null)
1136311363
{
1136411364
$oTagSet = new ormTagSet(MetaModel::GetAttributeOrigin($this->GetHostClass(), $this->GetCode()), $this->GetCode(), $this->GetMaxItems());
1136511365
$oTagSet->SetValues([]);
@@ -11867,7 +11867,7 @@ public function SetFixedValue($sValue)
1186711867
$this->m_sValue = $sValue;
1186811868
}
1186911869

11870-
public function GetDefaultValue(DBObject $oHostObject = null)
11870+
public function GetDefaultValue(?DBObject $oHostObject = null)
1187111871
{
1187211872
return $this->m_sValue;
1187311873
}
@@ -12030,7 +12030,7 @@ public function GetMaxSize()
1203012030
return 20;
1203112031
}
1203212032

12033-
public function GetDefaultValue(DBObject $oHostObject = null)
12033+
public function GetDefaultValue(?DBObject $oHostObject = null)
1203412034
{
1203512035
$sRet = 'disabled';
1203612036
if ($this->Get('enabled')) {
@@ -12466,7 +12466,7 @@ public static function LoadFromClassTables()
1246612466
return false;
1246712467
} // See ReadValue...
1246812468

12469-
public function GetDefaultValue(DBObject $oHostObject = null)
12469+
public function GetDefaultValue(?DBObject $oHostObject = null)
1247012470
{
1247112471
return new ormCustomFieldsValue($oHostObject, $this->GetCode());
1247212472
}
@@ -13053,7 +13053,7 @@ public function GetSQLExpr()
1305313053
return null;
1305413054
}
1305513055

13056-
public function GetDefaultValue(DBObject $oHostObject = null)
13056+
public function GetDefaultValue(?DBObject $oHostObject = null)
1305713057
{
1305813058
return $this->MakeRealValue(false, $oHostObject);
1305913059
}

core/bulkchange.class.inc.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class CellStatus_SearchIssue extends CellStatus_Issue
199199
* @param null $sAllowedValues : used for additional message that provides allowed values $sAllowedValues for current class
200200
* @param string|null $sAllowedValuesSearch : used to search all allowed values
201201
*/
202-
public function __construct($sSerializedSearch, $sReason, $sClass = null, $sAllowedValues = null, string $sAllowedValuesSearch = null)
202+
public function __construct($sSerializedSearch, $sReason, $sClass = null, $sAllowedValues = null, ?string $sAllowedValuesSearch = null)
203203
{
204204
parent::__construct(null, null, $sReason);
205205
$this->sSerializedSearch = $sSerializedSearch;
@@ -873,7 +873,7 @@ protected function PrepareMissingObject(&$oTargetObj, &$aErrors)
873873
return $aResults;
874874
}
875875

876-
protected function CreateObject(&$aResult, $iRow, $aRowData, CMDBChange $oChange = null)
876+
protected function CreateObject(&$aResult, $iRow, $aRowData, ?CMDBChange $oChange = null)
877877
{
878878
$oTargetObj = MetaModel::NewObject($this->m_sClass);
879879

@@ -962,7 +962,7 @@ protected function CreateObject(&$aResult, $iRow, $aRowData, CMDBChange $oChange
962962
* @throws \MySQLException
963963
* @throws \MySQLHasGoneAwayException
964964
*/
965-
protected function UpdateObject(&$aResult, $iRow, $oTargetObj, $aRowData, CMDBChange $oChange = null)
965+
protected function UpdateObject(&$aResult, $iRow, $oTargetObj, $aRowData, ?CMDBChange $oChange = null)
966966
{
967967
$aResult[$iRow] = $this->PrepareObject($oTargetObj, $aRowData, $aErrors);
968968

@@ -1005,7 +1005,7 @@ protected function UpdateObject(&$aResult, $iRow, $oTargetObj, $aRowData, CMDBCh
10051005
*
10061006
* @throws \BulkChangeException
10071007
*/
1008-
protected function UpdateMissingObject(&$aResult, $iRow, $oTargetObj, CMDBChange $oChange = null)
1008+
protected function UpdateMissingObject(&$aResult, $iRow, $oTargetObj, ?CMDBChange $oChange = null)
10091009
{
10101010
$aResult[$iRow] = $this->PrepareMissingObject($oTargetObj, $aErrors);
10111011

@@ -1040,7 +1040,7 @@ protected function UpdateMissingObject(&$aResult, $iRow, $oTargetObj, CMDBChange
10401040
}
10411041
}
10421042

1043-
public function Process(CMDBChange $oChange = null)
1043+
public function Process(?CMDBChange $oChange = null)
10441044
{
10451045
if ($oChange) {
10461046
CMDBObject::SetCurrentChange($oChange);

core/dbobject.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2569,7 +2569,7 @@ final public function CheckToWrite($bDoComputeValues = true)
25692569
*
25702570
* @see \RestUtils::FindObjectFromKey for the same check in the REST endpoint
25712571
*/
2572-
final public function CheckChangedExtKeysValues(callable $oIsObjectLoadableCallback = null)
2572+
final public function CheckChangedExtKeysValues(?callable $oIsObjectLoadableCallback = null)
25732573
{
25742574
if (is_null($oIsObjectLoadableCallback)) {
25752575
$oIsObjectLoadableCallback = function ($sClass, $sId) {
@@ -3729,7 +3729,7 @@ protected function PostUpdateActions(array $aChanges): void
37293729
* @throws \MySQLException
37303730
* @throws \OQLException
37313731
*/
3732-
private function ActivateOnObjectUpdateTriggers(?DBObject $oObject, array $aAttributes = null): void
3732+
private function ActivateOnObjectUpdateTriggers(?DBObject $oObject, ?array $aAttributes = null): void
37333733
{
37343734
if (is_null($oObject)) {
37353735
return;

core/dbsearch.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ public static function FromOQL_AllData($sQuery, $aParams = null)
724724
*
725725
* @throws OQLException
726726
*/
727-
public static function FromOQL($sQuery, $aParams = null, ModelReflection $oMetaModel = null)
727+
public static function FromOQL($sQuery, $aParams = null, ?ModelReflection $oMetaModel = null)
728728
{
729729
if (empty($sQuery)) {
730730
return null;

core/designdocument.class.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ public function _FindChildNodes(DesignElement $oRefNode): ?DesignElement
453453
* @throws Exception
454454
* @since 3.1.2 3.2.0 N°6974
455455
*/
456-
public static function _FindNode(DOMNode $oParent, DesignElement $oRefNode, string $sSearchId = null): ?DesignElement
456+
public static function _FindNode(DOMNode $oParent, DesignElement $oRefNode, ?string $sSearchId = null): ?DesignElement
457457
{
458458
$oNodes = self::_FindNodes($oParent, $oRefNode, $sSearchId);
459459
if ($oNodes instanceof DOMNodeList) {
@@ -477,7 +477,7 @@ public static function _FindNode(DOMNode $oParent, DesignElement $oRefNode, stri
477477
* @return \DOMNodeList|false|mixed
478478
* @since 3.1.2 3.2.0 N°6974
479479
*/
480-
public static function _FindNodes(DOMNode $oParent, DesignElement $oRefNode, string $sSearchId = null)
480+
public static function _FindNodes(DOMNode $oParent, DesignElement $oRefNode, ?string $sSearchId = null)
481481
{
482482
if ($oParent instanceof DOMDocument) {
483483
$oDoc = $oParent->firstChild->ownerDocument;

0 commit comments

Comments
 (0)