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

Add missing deprecation warnings #4102

Closed

Conversation

pl-github
Copy link

When switching the tests to PHPUnit 9, a few errors occurred because some methods were removed in PHPUni 9 that did not yet give a deprecation warning in PHPUnit 8.

What I have changed:

  • Assert::contains()
    • added deprecation warning
    • removed testAssertThatContains() (seems to be the normal behavior for deprecated code)
  • TestCase:: expectExceptionMessageRegExp()
    • added deprecation warning
    • replaced calls in tests with expectExceptionMessageMatches() to supress warnigs in test runs
  • TestCase::setUseErrorHandler()
    • added deprecation warning

@sebastianbergmann
Copy link
Owner

Thank you for your contribution. I appreciate the time you invested in preparing this pull request. However, I have decided not to merge it.

assertContains() is not deprecated, and neither is contains(). expectExceptionMessageRegExp() and setUseErrorHandler() have @deprecated annotations ("soft deprecation") which has to be enough as I do not think that we should add "hard deprecations" in a bugfix release.

@pl-github
Copy link
Author

You are right, it is only a small benefit and I didn`t know about the soft / hard deprecation strategy.

Many thanks for your continuous work on PHPUnit.

Its true assertContains() isnt deprecated, but for me contains() looks deprecated, too.

    /**
     * @deprecated Use containsEqual() or containsIdentical() instead
     */
    public static function contains($value, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): TraversableContains

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

Successfully merging this pull request may close these issues.

None yet

2 participants