Skip to content

N°8851 N°8854 - PHP 8.4: Fix explicit nullable in functions parameters + replace trigger_error() usage with E_USER_ERROR#804

Merged
Lenaick merged 2 commits intosupport/3.2from
feature/8851-explicit-nullable-params
Feb 20, 2026
Merged

N°8851 N°8854 - PHP 8.4: Fix explicit nullable in functions parameters + replace trigger_error() usage with E_USER_ERROR#804
Lenaick merged 2 commits intosupport/3.2from
feature/8851-explicit-nullable-params

Conversation

@Lenaick
Copy link
Contributor

@Lenaick Lenaick commented Feb 16, 2026

Base information

Question Answer
Related to a SourceForge thread / Another PR / Combodo ticket? 8851 and 8854
Type of change? Enhancement

Objective

To support migration to PHP8.4, we must address the new deprecation rules.
After the initial analysis, the newly deprecated features affecting iTop are :

Proposed solution

  • For "Implicitly nullable parameter" : prefix the type name with a question mark, e.g. ?CMDBObject $oObject = null
  • For "trigger_error() with E_USER_ERROR": change to use E_USER_WARNING

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have tested all changes I made on an iTop instance
  • I have added a unit test, otherwise I have explained why I couldn't
  • Is the PR clear and detailed enough so anyone can understand digging in the code?

@CombodoApplicationsAccount CombodoApplicationsAccount added the internal Work made by Combodo label Feb 16, 2026
@Lenaick Lenaick changed the title N°8851 - Explicit nullable in functions parameters N°8851 - Add compatibility with PHP 8.4 Feb 16, 2026
@Lenaick Lenaick changed the title N°8851 - Add compatibility with PHP 8.4 N°8851 - Explicit nullable in functions parameters Feb 16, 2026
@Lenaick Lenaick requested a review from Molkobain February 16, 2026 15:59
@Lenaick Lenaick added this to the 3.2.3 milestone Feb 16, 2026
@Lenaick Lenaick self-assigned this Feb 16, 2026
@Lenaick Lenaick changed the title N°8851 - Explicit nullable in functions parameters N°8851 N°8854 - Explicit nullable in functions parameters + Replace trigger_error() usage with E_USER_ERROR Feb 16, 2026
@Molkobain Molkobain changed the title N°8851 N°8854 - Explicit nullable in functions parameters + Replace trigger_error() usage with E_USER_ERROR N°8851 N°8854 - PHP 8.4: Fix explicit nullable in functions parameters + replace trigger_error() usage with E_USER_ERROR Feb 16, 2026
Copy link
Contributor

@Molkobain Molkobain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the nullable type hint on a class that can be extended is ok, even though its child classes don't. So we don't have to worry about APIs implementations 🙌

See this 3v4l.org test which tests the following snippet:

class A
{
    public function foo(?string $text = null)
    {
        var_dump($text);
    }
}

class B extends A
{
    public function foo(string $text = null)
    {
        var_dump($text);
    }
}

$a = new A();
$a->foo('Hello');

$b = new B();
$b->foo('Hello');

The other way around works as well, see this 3v4l.org test.

@Molkobain
Copy link
Contributor

Ok for merge 🙌

@Lenaick Lenaick marked this pull request as ready for review February 17, 2026 08:28
@Lenaick Lenaick force-pushed the feature/8851-explicit-nullable-params branch from 8209c95 to bd42055 Compare February 20, 2026 09:06
@Lenaick Lenaick merged commit fc22cce into support/3.2 Feb 20, 2026
@Lenaick Lenaick deleted the feature/8851-explicit-nullable-params branch February 20, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Work made by Combodo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants