Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.2: tests error out on "Use of "parent" in callables is deprecated" #1168

Closed
jrfnl opened this issue Mar 15, 2022 · 1 comment
Closed

Comments

@jrfnl
Copy link
Contributor

jrfnl commented Mar 15, 2022

Description

PHP 8.2 is slated to deprecate partially supported callables.

From the RFC:

Most of the callables deprecated here have a straightforward replacement: "self" should be replaced with self::class, and so on:

"self::method"       -> self::class . "::method"
"parent::method"     -> parent::class . "::method"
"static::method"     -> static::class . "::method"
["self", "method"]   -> [self::class, "method"]
["parent", "method"] -> [parent::class, "method"]
["static", "method"] -> [static::class, "method"]

The new form of these callables is no longer context-dependent. It will refer to the self/parent/static scope of where the callable has been created, rather than where is will be called.

During a preliminary test run for a project against PHP 8.2, I noticed that Mockery is heavily affected by this issue, with over half of the tests in the project I did the test run on erroring out on a Use of "parent" in callables is deprecated error.

How to reproduce

Or examine the results of the workflows runs for this branch: https://github.com/jrfnl/bug-report-reproduction-scenarios/actions/runs/1985112787

Error

There was 1 error:

1) Jrf\Mockery\Scenario\Tests\FooTest::testSplitString with data set "simple test case" ('test,string', array('test', 'string'))
Use of "parent" in callables is deprecated

/home/runner/work/bug-report-reproduction-scenarios/bug-report-reproduction-scenarios/tests/FooTest.php:33
@jrfnl
Copy link
Contributor Author

jrfnl commented Apr 12, 2022

Closing as fixed via PR #1169

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant