Skip to content

Commit

Permalink
replace after annotation with attribute
Browse files Browse the repository at this point in the history
PHPUnit 11 emits a deprecation warning when using annotations (@after), and they will not
work in PHPUnit 12.
Changing this means that the "after" functionality will not work in phpunit versions < 10,
but it also should not cause an error. Users directly calling "restoreEnvironmentVariables()"
would be fine, I think. See sebastianbergmann/phpunit#4502
  • Loading branch information
brettmc committed May 2, 2024
1 parent af2c1be commit d2902b7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/EnvironmentVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ trait EnvironmentVariables
private $environmentVariables = [];

/**
* @after
*
* @return void
*/
#[\PHPUnit\Framework\Attributes\After]
protected function restoreEnvironmentVariables()
{
foreach ($this->environmentVariables as $variable => $value) {
Expand Down

0 comments on commit d2902b7

Please sign in to comment.