PHP 8.6 - Returning a value from a destructor is deprecated
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 67/100
Research direction
Start by tracing ClassCodeGenerator, focusing on how it emits a doubled class's __destruct method. Verify the generated destructor no longer returns a value and that the resulting double does not trigger the PHP 8.6 deprecation.
Written by the indexing model from the issue text.
Description
When a doubled class specifies a __destruct method, ClassCodeGenerator currently builds
<?php
namespace Double\xxxx {
class P1 extends \xxxx implements \Prophecy\Doubler\DoubleInterface, \Prophecy\Prophecy\ProphecySubjectInterface, \Prophecy\Doubler\Generator\ReflectionInterface {
...
public function __destruct() {
return $this->getProphecy()->makeProphecyMethodCall(__FUNCTION__, func_get_args());
}
...
}
and this will throw a deprecation in PHP 8.6.
It's due to PHP RFC: Deprecate returning values from __construct() and __destruct(), that was committed in https://github.com/php/php-src/pull/21982.
- Dominant language
- PHP
- Stars
- 8.5k
- Forks
- 247
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from phpspec/prophecy
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 50/100
All issues in phpspec/prophecy
Similar issues
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nextcloud/fulltextsearch#1011 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
phpstan/phpstan-doctrine#794 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Automattic/static-site-importer#1767 ·