Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: symfony/phpunit-bridge
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.3.3
Choose a base ref
...
head repository: symfony/phpunit-bridge
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.3.4
Choose a head ref
  • 12 commits
  • 3 files changed
  • 4 contributors

Commits on Jun 30, 2021

  1. CS fix

    nicolas-grekas committed Jun 30, 2021
    Copy the full SHA
    27f1863 View commit details
  2. Merge branch '5.2' into 5.3

    * 5.2:
      CS fix
      CS fix
      CS fixes
      Bump Symfony version to 5.2.12
      Update VERSION for 5.2.11
      Update CHANGELOG for 5.2.11
      Bump Symfony version to 4.4.27
      Update VERSION for 4.4.26
      Update CONTRIBUTORS for 4.4.26
      Update CHANGELOG for 4.4.26
    nicolas-grekas committed Jun 30, 2021
    Copy the full SHA
    79dbbd9 View commit details

Commits on Jul 1, 2021

  1. Unverified

    This user has not yet uploaded their public signing key.
    Copy the full SHA
    6974ebb View commit details

Commits on Jul 2, 2021

  1. Merge branch '4.4' into 5.2

    * 4.4:
      [PhpUnitBridge] Fix deprecation handler with PHPUnit 10
      Revert CI workaround for masterminds/html5
    derrabus committed Jul 2, 2021

    Unverified

    This user has not yet uploaded their public signing key.
    Copy the full SHA
    7a8e561 View commit details
  2. Merge branch '5.2' into 5.3

    * 5.2:
      [PhpUnitBridge] Fix deprecation handler with PHPUnit 10
      Revert CI workaround for masterminds/html5
    derrabus committed Jul 2, 2021
    Copy the full SHA
    41b3e08 View commit details
  3. Avoid triggering the autoloader in Deprecation::isLegacy()

    Signed-off-by: Alexander M. Turek <me@derrabus.de>
    derrabus committed Jul 2, 2021
    Copy the full SHA
    d843587 View commit details
  4. Fix CS

    Signed-off-by: Alexander M. Turek <me@derrabus.de>
    derrabus committed Jul 2, 2021
    Copy the full SHA
    95a1dca View commit details
  5. Merge branch '4.4' into 5.2

    * 4.4:
      Fix CS
      Avoid triggering the autoloader in Deprecation::isLegacy()
    nicolas-grekas committed Jul 2, 2021
    Copy the full SHA
    c00a3d9 View commit details
  6. Merge branch '5.2' into 5.3

    * 5.2:
      Backport type fixes
      Fix CS
      Avoid triggering the autoloader in Deprecation::isLegacy()
      fix markdown markup
      Backport type fixes
      uzb translation
      [DependencyInjection] Fix doc blocks
      [DependencyInjection] Turn $defaultDeprecationTemplate into a constant
      [Form] better form doc types to support static analysis
    nicolas-grekas committed Jul 2, 2021
    Copy the full SHA
    2721b2d View commit details

Commits on Jul 15, 2021

  1. Fix composer resolution on windows

    Prepend the php executable to the resolved composer path
    when `COMPOSER_BINARY` is set.
    Rainrider authored and nicolas-grekas committed Jul 15, 2021
    Copy the full SHA
    e1434f9 View commit details
  2. Merge branch '4.4' into 5.2

    * 4.4:
      [Validator] Backport type fixes
      [HttpFoundation] fix FileBag under PHP 8.1
      Fix composer resolution on windows
    derrabus committed Jul 15, 2021
    Copy the full SHA
    06e1bda View commit details
  3. Merge branch '5.2' into 5.3

    * 5.2:
      [Validator] Backport type fixes
      [HttpFoundation] fix FileBag under PHP 8.1
      Fix composer resolution on windows
    derrabus committed Jul 15, 2021
    Copy the full SHA
    bc368b7 View commit details
Showing with 27 additions and 16 deletions.
  1. +15 −7 DeprecationErrorHandler.php
  2. +5 −1 DeprecationErrorHandler/Deprecation.php
  3. +7 −8 bin/simple-phpunit.php
22 changes: 15 additions & 7 deletions DeprecationErrorHandler.php
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@
namespace Symfony\Bridge\PhpUnit;

use PHPUnit\Framework\TestResult;
use PHPUnit\Util\Error\Handler;
use PHPUnit\Util\ErrorHandler;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Configuration;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Deprecation;
@@ -38,7 +39,7 @@ class DeprecationErrorHandler
private $deprecationGroups = [];

private static $isRegistered = false;
private static $isAtLeastPhpUnit83;
private static $errorHandler;

public function __construct()
{
@@ -162,7 +163,7 @@ public function handleError($type, $msg, $file, $line, $context = [])

if ('legacy' === $group) {
$this->deprecationGroups[$group]->addNotice();
} else if ($deprecation->originatesFromAnObject()) {
} elseif ($deprecation->originatesFromAnObject()) {
$class = $deprecation->originatingClass();
$method = $deprecation->originatingMethod();
$this->deprecationGroups[$group]->addNoticeFromObject($msg, $class, $method);
@@ -347,16 +348,23 @@ private function displayDeprecations($groups, $configuration, $isFailing)

private static function getPhpUnitErrorHandler()
{
if (!isset(self::$isAtLeastPhpUnit83)) {
self::$isAtLeastPhpUnit83 = class_exists(ErrorHandler::class) && method_exists(ErrorHandler::class, '__invoke');
if (!$eh = self::$errorHandler) {
if (class_exists(Handler::class)) {
$eh = self::$errorHandler = Handler::class;
} elseif (method_exists(ErrorHandler::class, '__invoke')) {
$eh = self::$errorHandler = ErrorHandler::class;
} else {
return self::$errorHandler = 'PHPUnit\Util\ErrorHandler::handleError';
}
}
if (!self::$isAtLeastPhpUnit83) {
return 'PHPUnit\Util\ErrorHandler::handleError';

if ('PHPUnit\Util\ErrorHandler::handleError' === $eh) {
return $eh;
}

foreach (debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) {
if (isset($frame['object']) && $frame['object'] instanceof TestResult) {
return new ErrorHandler(
return new $eh(
$frame['object']->getConvertDeprecationsToExceptions(),
$frame['object']->getConvertErrorsToExceptions(),
$frame['object']->getConvertNoticesToExceptions(),
6 changes: 5 additions & 1 deletion DeprecationErrorHandler/Deprecation.php
Original file line number Diff line number Diff line change
@@ -13,11 +13,14 @@

use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\TestSuite;
use PHPUnit\Metadata\Api\Groups;
use PHPUnit\Util\Test;
use Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerFor;
use Symfony\Component\Debug\DebugClassLoader as LegacyDebugClassLoader;
use Symfony\Component\ErrorHandler\DebugClassLoader;

class_exists(Groups::class);

/**
* @internal
*/
@@ -201,12 +204,13 @@ public function isLegacy()
}

$method = $this->originatingMethod();
$groups = class_exists(Groups::class, false) ? [new Groups(), 'groups'] : [Test::class, 'getGroups'];

return 0 === strpos($method, 'testLegacy')
|| 0 === strpos($method, 'provideLegacy')
|| 0 === strpos($method, 'getLegacy')
|| strpos($this->originClass, '\Legacy')
|| \in_array('legacy', Test::getGroups($this->originClass, $method), true);
|| \in_array('legacy', $groups($this->originClass, $method), true);
}

/**
15 changes: 7 additions & 8 deletions bin/simple-phpunit.php
Original file line number Diff line number Diff line change
@@ -147,14 +147,13 @@
putenv('SYMFONY_DEPRECATIONS_HELPER=disabled');
}

if (false === $COMPOSER = getenv('COMPOSER_BINARY')) {
$COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar')
|| ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar 2> NUL`) : `which composer.phar 2> /dev/null`)))
|| ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer 2> NUL`) : `which composer 2> /dev/null`)))
|| file_exists($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? `git rev-parse --show-toplevel 2> NUL` : `git rev-parse --show-toplevel 2> /dev/null`)).\DIRECTORY_SEPARATOR.'composer.phar')
? ('#!/usr/bin/env php' === file_get_contents($COMPOSER, false, null, 0, 18) ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
: 'composer';
}
$COMPOSER = ($COMPOSER = getenv('COMPOSER_BINARY'))
|| file_exists($COMPOSER = $oldPwd.'/composer.phar')
|| ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar 2> NUL`) : `which composer.phar 2> /dev/null`)))
|| ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer 2> NUL`) : `which composer 2> /dev/null`)))
|| file_exists($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? `git rev-parse --show-toplevel 2> NUL` : `git rev-parse --show-toplevel 2> /dev/null`)).\DIRECTORY_SEPARATOR.'composer.phar')
? ('#!/usr/bin/env php' === file_get_contents($COMPOSER, false, null, 0, 18) ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
: 'composer';

$prevCacheDir = getenv('COMPOSER_CACHE_DIR');
if ($prevCacheDir) {