Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PhpUnitBridge] Fix ExpectDeprecationTrait::expectDeprecation() conflict
- Loading branch information
Showing
4 changed files
with
145 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/Symfony/Bridge/PhpUnit/Legacy/ExpectDeprecationTrait.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Bridge\PhpUnit\Legacy; | ||
|
||
/** | ||
* @internal use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait instead. | ||
*/ | ||
trait ExpectDeprecationTrait | ||
{ | ||
/** | ||
* @param string $message | ||
*/ | ||
public function expectDeprecation(): void | ||
{ | ||
if (1 > func_num_args() || !\is_string($message = func_get_arg(0))) { | ||
throw new \InvalidArgumentException(sprintf('The "%s()" method requires the string $message argument.', __FUNCTION__)); | ||
} | ||
|
||
\Closure::bind(function (string $message): void { | ||
$this->expectDeprecation($message); | ||
}, $o = new class() { | ||
use ExpectDeprecationTraitBeforeV8_4 { | ||
expectDeprecation as public; | ||
} | ||
})($message); | ||
} | ||
|
||
/** | ||
* @internal use expectDeprecation() instead. | ||
*/ | ||
public function expectDeprecationMessage(string $message): void | ||
{ | ||
throw new \BadMethodCallException(sprintf("The "%s()" method is not supported by Symfony's PHPUnit Bridge ExpectDeprecationTrait.", __FUNCTION__)); | ||
} | ||
|
||
/** | ||
* @internal use expectDeprecation() instead. | ||
*/ | ||
public function expectDeprecationMessageMatches(string $regularExpression): void | ||
{ | ||
throw new \BadMethodCallException(sprintf("The "%s()" method is not supported by Symfony's PHPUnit Bridge ExpectDeprecationTrait.", __FUNCTION__)); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
src/Symfony/Bridge/PhpUnit/Legacy/ExpectDeprecationTrait.php.orig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Bridge\PhpUnit\Legacy; | ||
|
||
/** | ||
* @internal use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait instead. | ||
*/ | ||
trait ExpectDeprecationTrait | ||
{ | ||
/** | ||
* @param string $message | ||
*/ | ||
public function expectDeprecation(): void | ||
{ | ||
if (1 > func_num_args() || !\is_string($message = func_get_arg(0))) { | ||
throw new \InvalidArgumentException(sprintf('The %s() method requires the string $message argument.', __FUNCTION__)); | ||
} | ||
|
||
\Closure::bind(function (string $message): void { | ||
$this->expectDeprecation($message); | ||
}, $o = new class() { | ||
use ExpectDeprecationTraitBeforeV8_4 { | ||
expectDeprecation as public; | ||
} | ||
})($message); | ||
} | ||
|
||
/** | ||
* @internal use expectDeprecation() instead. | ||
*/ | ||
public function expectDeprecationMessage(string $message): void | ||
{ | ||
throw new \BadMethodCallException(sprintf("The %s() method is not supported by Symfony's PHPUnit Bridge ExpectDeprecationTrait.", __FUNCTION__)); | ||
} | ||
|
||
/** | ||
* @internal use expectDeprecation() instead. | ||
*/ | ||
public function expectDeprecationMessageMatches(string $regularExpression): void | ||
{ | ||
throw new \BadMethodCallException(sprintf("The %s() method is not supported by Symfony's PHPUnit Bridge ExpectDeprecationTrait.", __FUNCTION__)); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/Symfony/Bridge/PhpUnit/Legacy/ExpectDeprecationTraitBeforeV8_4.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Bridge\PhpUnit\Legacy; | ||
|
||
/** | ||
* @internal, use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait instead. | ||
*/ | ||
trait ExpectDeprecationTraitBeforeV8_4 | ||
{ | ||
/** | ||
* @param string $message | ||
* | ||
* @return void | ||
*/ | ||
protected function expectDeprecation($message) | ||
{ | ||
if (!SymfonyTestsListenerTrait::$previousErrorHandler) { | ||
SymfonyTestsListenerTrait::$previousErrorHandler = set_error_handler([SymfonyTestsListenerTrait::class, 'handleError']); | ||
} | ||
|
||
SymfonyTestsListenerTrait::$expectedDeprecations[] = $message; | ||
} | ||
} |