Page MenuHomePhorge

PHP 8.2: fix deprecated use of "parent" in callables
ClosedPublic

Authored by valerio.bozzolan on Mar 26 2023, 15:42.
Tags
None
Referenced Files
F3361598: D25099.1744042423.diff
Sun, Apr 6, 16:13
F3361195: D25099.1744021598.diff
Sun, Apr 6, 10:26
F3360489: D25099.1743997832.diff
Sun, Apr 6, 03:50
F3359975: D25099.1743967403.diff
Sat, Apr 5, 19:23
F3358881: D25099.1743929335.diff
Sat, Apr 5, 08:48
F3358356: D25099.1743922081.diff
Sat, Apr 5, 06:48
F3346941: D25099.1743709892.diff
Wed, Apr 2, 19:51
F3341084: D25099.1743648439.diff
Wed, Apr 2, 02:47
Tokens
"Like" token, awarded by valerio.bozzolan.

Details

Summary

Closes T15200

Test Plan

Test 1:

I was able to run arc unit --everything without the error thrown from T15200

Test 2:

I also tried this and it still works:

php -a
require 'src/applications/metamta/exception/PhabricatorMetaMTAReceivedMailProcessingException.php';
$asd = new PhabricatorMetaMTAReceivedMailProcessingException("1", "TEST MESSAGE");
var_dump($asd->getMessage());

You get:

string(12) "TEST MESSAGE"

Diff Detail

Repository
rP Phorge
Branch
T15200-callable
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 190
Build 190: arc lint + arc unit

Event Timeline

src/applications/metamta/exception/PhabricatorMetaMTAReceivedMailProcessingException.php
17

The above line means that if you do this somewhere:

new PhabricatorMetaMTAReceivedMailProcessingException( 'asd', 'lol' );

The above lines do this:

parent::__construct( 'asd', 'lol' );

That for my case is:

Exception::__construct( 'asd', 'lol' );

Note that get_parent_class($this) returns the word Exception.

src/applications/metamta/exception/PhabricatorMetaMTAReceivedMailProcessingException.php
18

In short using the string 'parent' is deprecated.

It was replaced with get_parent_class($this) that at runtime gives the parent, and it's the exact replacement.

This revision is now accepted and ready to land.Mar 29 2023, 18:18