Merge branch '3.4' into 4.2
* 3.4: cs fix cs fix [PHPUnit-Bridge] override some environment variables [TwigBridge] Remove use spaceless tag [translation] Update defaut format from yml to yaml Change default log level for output streams update docblock to match the actual behavior compatibility with phpunit8 [Debug][DebugClassLoader] Detect annotations before blank docblock lines on final and internal methods Added translations for chineese language.
This commit is contained in:
commit
a5951cef91
@ -56,10 +56,7 @@ if (PHP_VERSION_ID >= 70200) {
|
|||||||
$PHPUNIT_VERSION = '4.8';
|
$PHPUNIT_VERSION = '4.8';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('composer.json' !== $COMPOSER_JSON = getenv('COMPOSER') ?: 'composer.json') {
|
$COMPOSER_JSON = getenv('COMPOSER') ?: 'composer.json';
|
||||||
putenv('COMPOSER=composer.json');
|
|
||||||
$_SERVER['COMPOSER'] = $_ENV['COMPOSER'] = 'composer.json';
|
|
||||||
}
|
|
||||||
|
|
||||||
$root = __DIR__;
|
$root = __DIR__;
|
||||||
while (!file_exists($root.'/'.$COMPOSER_JSON) || file_exists($root.'/DeprecationErrorHandler.php')) {
|
while (!file_exists($root.'/'.$COMPOSER_JSON) || file_exists($root.'/DeprecationErrorHandler.php')) {
|
||||||
@ -77,6 +74,19 @@ if ('phpdbg' === PHP_SAPI) {
|
|||||||
$PHP .= ' -qrr';
|
$PHP .= ' -qrr';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$defaultEnvs = [
|
||||||
|
'COMPOSER' => 'composer.json',
|
||||||
|
'COMPOSER_VENDOR_DIR' => 'vendor',
|
||||||
|
'COMPOSER_BIN_DIR' => 'bin',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($defaultEnvs as $envName => $envValue) {
|
||||||
|
if ($envValue !== getenv($envName)) {
|
||||||
|
putenv("$envName=$envValue");
|
||||||
|
$_SERVER[$envName] = $_ENV[$envName] = $envValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar') || ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar`) : `which composer.phar 2> /dev/null`))
|
$COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar') || ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar`) : `which composer.phar 2> /dev/null`))
|
||||||
? $PHP.' '.escapeshellarg($COMPOSER)
|
? $PHP.' '.escapeshellarg($COMPOSER)
|
||||||
: 'composer';
|
: 'composer';
|
||||||
|
@ -1,25 +1,19 @@
|
|||||||
{% block _text_id_widget %}
|
{% block _text_id_widget -%}
|
||||||
{% spaceless %}
|
|
||||||
<div id="container">
|
<div id="container">
|
||||||
{{ form_widget(form) }}
|
{{- form_widget(form) -}}
|
||||||
</div>
|
</div>
|
||||||
{% endspaceless %}
|
{%- endblock _text_id_widget %}
|
||||||
{% endblock _text_id_widget %}
|
|
||||||
|
|
||||||
{% block _names_entry_label %}
|
{% block _names_entry_label -%}
|
||||||
{% spaceless %}
|
|
||||||
{% if label is empty %}
|
{% if label is empty %}
|
||||||
{% set label = name|humanize %}
|
{%- set label = name|humanize -%}
|
||||||
{% endif %}
|
{% endif -%}
|
||||||
<label>Custom label: {{ label|trans({}, translation_domain) }}</label>
|
<label>Custom label: {{ label|trans({}, translation_domain) }}</label>
|
||||||
{% endspaceless %}
|
{%- endblock _names_entry_label %}
|
||||||
{% endblock _names_entry_label %}
|
|
||||||
|
|
||||||
{% block _name_c_entry_label %}
|
{% block _name_c_entry_label -%}
|
||||||
{% spaceless %}
|
|
||||||
{% if label is empty %}
|
{% if label is empty %}
|
||||||
{% set label = name|humanize %}
|
{%- set label = name|humanize -%}
|
||||||
{% endif %}
|
{% endif -%}
|
||||||
<label>Custom name label: {{ label|trans({}, translation_domain) }}</label>
|
<label>Custom name label: {{ label|trans({}, translation_domain) }}</label>
|
||||||
{% endspaceless %}
|
{%- endblock _name_c_entry_label %}
|
||||||
{% endblock _name_c_entry_label %}
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
{% block form_widget_simple %}
|
{% block form_widget_simple %}
|
||||||
{% spaceless %}
|
{%- set type = type|default('text') -%}
|
||||||
{% set type = type|default('text') %}
|
|
||||||
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme" />
|
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme" />
|
||||||
{% endspaceless %}
|
{%- endblock form_widget_simple %}
|
||||||
{% endblock form_widget_simple %}
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
{% extends 'form_div_layout.html.twig' %}
|
{% extends 'form_div_layout.html.twig' %}
|
||||||
|
|
||||||
{% block form_widget_simple %}
|
{% block form_widget_simple %}
|
||||||
{% spaceless %}
|
{%- set type = type|default('text') -%}
|
||||||
{% set type = type|default('text') %}
|
|
||||||
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme" />
|
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme" />
|
||||||
{% endspaceless %}
|
{%- endblock form_widget_simple %}
|
||||||
{% endblock form_widget_simple %}
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
{% use 'form_div_layout.html.twig' %}
|
{% use 'form_div_layout.html.twig' %}
|
||||||
|
|
||||||
{% block form_widget_simple %}
|
{% block form_widget_simple %}
|
||||||
{% spaceless %}
|
{%- set type = type|default('text') -%}
|
||||||
{% set type = type|default('text') %}
|
|
||||||
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme" />
|
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme" />
|
||||||
{% endspaceless %}
|
{%- endblock form_widget_simple %}
|
||||||
{% endblock form_widget_simple %}
|
|
||||||
|
@ -159,7 +159,7 @@ class TranslationUpdateCommandTest extends TestCase
|
|||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('getFormats')
|
->method('getFormats')
|
||||||
->will(
|
->will(
|
||||||
$this->returnValue(['xlf', 'yml'])
|
$this->returnValue(['xlf', 'yml', 'yaml'])
|
||||||
);
|
);
|
||||||
|
|
||||||
if (null === $kernel) {
|
if (null === $kernel) {
|
||||||
|
@ -324,7 +324,7 @@ class DebugClassLoader
|
|||||||
$finalOrInternal = false;
|
$finalOrInternal = false;
|
||||||
|
|
||||||
foreach (['final', 'internal'] as $annotation) {
|
foreach (['final', 'internal'] as $annotation) {
|
||||||
if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$)#s', $doc, $notice)) {
|
if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s', $doc, $notice)) {
|
||||||
$message = isset($notice[1]) ? preg_replace('#\.?\r?\n( \*)? *(?= |\r?\n|$)#', '', $notice[1]) : '';
|
$message = isset($notice[1]) ? preg_replace('#\.?\r?\n( \*)? *(?= |\r?\n|$)#', '', $notice[1]) : '';
|
||||||
self::${$annotation.'Methods'}[$class][$method->name] = [$class, $message];
|
self::${$annotation.'Methods'}[$class][$method->name] = [$class, $message];
|
||||||
$finalOrInternal = true;
|
$finalOrInternal = true;
|
||||||
|
@ -13,6 +13,8 @@ class FinalMethod
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @final
|
* @final
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function finalMethod2()
|
public function finalMethod2()
|
||||||
{
|
{
|
||||||
|
@ -138,7 +138,7 @@ class Container implements ResettableContainerInterface
|
|||||||
/**
|
/**
|
||||||
* Sets a service.
|
* Sets a service.
|
||||||
*
|
*
|
||||||
* Setting a service to null resets the service: has() returns false and get()
|
* Setting a synthetic service to null resets it: has() returns false and get()
|
||||||
* behaves in the same way as if the service was never created.
|
* behaves in the same way as if the service was never created.
|
||||||
*
|
*
|
||||||
* @param string $id The service identifier
|
* @param string $id The service identifier
|
||||||
|
@ -20,12 +20,14 @@ use Symfony\Component\Form\Forms;
|
|||||||
*/
|
*/
|
||||||
abstract class FormIntegrationTestCase extends TestCase
|
abstract class FormIntegrationTestCase extends TestCase
|
||||||
{
|
{
|
||||||
|
use TestCaseSetUpTearDownTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var FormFactoryInterface
|
* @var FormFactoryInterface
|
||||||
*/
|
*/
|
||||||
protected $factory;
|
protected $factory;
|
||||||
|
|
||||||
protected function setUp()
|
private function doSetUp()
|
||||||
{
|
{
|
||||||
$this->factory = Forms::createFormFactoryBuilder()
|
$this->factory = Forms::createFormFactoryBuilder()
|
||||||
->addExtensions($this->getExtensions())
|
->addExtensions($this->getExtensions())
|
||||||
|
@ -0,0 +1,82 @@
|
|||||||
|
<?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\Component\Form\Test;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
// Auto-adapt to PHPUnit 8 that added a `void` return-type to the setUp/tearDown methods
|
||||||
|
|
||||||
|
if (method_exists(\ReflectionMethod::class, 'hasReturnType') && (new \ReflectionMethod(TestCase::class, 'tearDown'))->hasReturnType()) {
|
||||||
|
eval('
|
||||||
|
namespace Symfony\Component\Form\Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
trait TestCaseSetUpTearDownTrait
|
||||||
|
{
|
||||||
|
private function doSetUp(): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private function doTearDown(): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
$this->doSetUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown(): void
|
||||||
|
{
|
||||||
|
$this->doTearDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
');
|
||||||
|
} else {
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
trait TestCaseSetUpTearDownTrait
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function doSetUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function doTearDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
$this->doSetUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function tearDown()
|
||||||
|
{
|
||||||
|
$this->doTearDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -17,6 +17,8 @@ use Symfony\Component\Form\Test\Traits\ValidatorExtensionTrait;
|
|||||||
|
|
||||||
abstract class TypeTestCase extends FormIntegrationTestCase
|
abstract class TypeTestCase extends FormIntegrationTestCase
|
||||||
{
|
{
|
||||||
|
use TestCaseSetUpTearDownTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var FormBuilder
|
* @var FormBuilder
|
||||||
*/
|
*/
|
||||||
@ -27,7 +29,7 @@ abstract class TypeTestCase extends FormIntegrationTestCase
|
|||||||
*/
|
*/
|
||||||
protected $dispatcher;
|
protected $dispatcher;
|
||||||
|
|
||||||
protected function setUp()
|
private function doSetUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -35,7 +37,7 @@ abstract class TypeTestCase extends FormIntegrationTestCase
|
|||||||
$this->builder = new FormBuilder('', null, $this->dispatcher, $this->factory);
|
$this->builder = new FormBuilder('', null, $this->dispatcher, $this->factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown()
|
private function doTearDown()
|
||||||
{
|
{
|
||||||
if (\in_array(ValidatorExtensionTrait::class, class_uses($this))) {
|
if (\in_array(ValidatorExtensionTrait::class, class_uses($this))) {
|
||||||
$this->validator = null;
|
$this->validator = null;
|
||||||
|
@ -40,7 +40,7 @@ class Logger extends AbstractLogger
|
|||||||
public function __construct(string $minLevel = null, $output = 'php://stderr', callable $formatter = null)
|
public function __construct(string $minLevel = null, $output = 'php://stderr', callable $formatter = null)
|
||||||
{
|
{
|
||||||
if (null === $minLevel) {
|
if (null === $minLevel) {
|
||||||
$minLevel = LogLevel::WARNING;
|
$minLevel = 'php://stdout' === $output || 'php://stderr' === $output ? LogLevel::CRITICAL : LogLevel::WARNING;
|
||||||
|
|
||||||
if (isset($_ENV['SHELL_VERBOSITY']) || isset($_SERVER['SHELL_VERBOSITY'])) {
|
if (isset($_ENV['SHELL_VERBOSITY']) || isset($_SERVER['SHELL_VERBOSITY'])) {
|
||||||
switch ((int) (isset($_ENV['SHELL_VERBOSITY']) ? $_ENV['SHELL_VERBOSITY'] : $_SERVER['SHELL_VERBOSITY'])) {
|
switch ((int) (isset($_ENV['SHELL_VERBOSITY']) ? $_ENV['SHELL_VERBOSITY'] : $_SERVER['SHELL_VERBOSITY'])) {
|
||||||
|
@ -310,10 +310,30 @@
|
|||||||
<source>This value does not match the expected {{ charset }} charset.</source>
|
<source>This value does not match the expected {{ charset }} charset.</source>
|
||||||
<target>该值不符合 {{ charset }} 编码。</target>
|
<target>该值不符合 {{ charset }} 编码。</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="81">
|
||||||
|
<source>This is not a valid Business Identifier Code (BIC).</source>
|
||||||
|
<target>这不是有效的业务标识符代码(BIC)。</target>
|
||||||
|
</trans-unit>
|
||||||
<trans-unit id="82">
|
<trans-unit id="82">
|
||||||
<source>Error</source>
|
<source>Error</source>
|
||||||
<target>错误</target>
|
<target>错误</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="83">
|
||||||
|
<source>This is not a valid UUID.</source>
|
||||||
|
<target>这不是有效的UUID。</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="84">
|
||||||
|
<source>This value should be a multiple of {{ compared_value }}.</source>
|
||||||
|
<target>此值应为 {{ compared_value }} 的倍数。</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="85">
|
||||||
|
<source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source>
|
||||||
|
<target>此业务标识符代码(BIC)与IBAN {{ iban }} 无关。</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="86">
|
||||||
|
<source>This value should be valid JSON.</source>
|
||||||
|
<target>该值应该是有效的JSON。</target>
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
@ -30,6 +30,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
*/
|
*/
|
||||||
abstract class ConstraintValidatorTestCase extends TestCase
|
abstract class ConstraintValidatorTestCase extends TestCase
|
||||||
{
|
{
|
||||||
|
use TestCaseSetUpTearDownTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ExecutionContextInterface
|
* @var ExecutionContextInterface
|
||||||
*/
|
*/
|
||||||
@ -49,7 +51,7 @@ abstract class ConstraintValidatorTestCase extends TestCase
|
|||||||
protected $constraint;
|
protected $constraint;
|
||||||
protected $defaultTimezone;
|
protected $defaultTimezone;
|
||||||
|
|
||||||
protected function setUp()
|
private function doSetUp()
|
||||||
{
|
{
|
||||||
$this->group = 'MyGroup';
|
$this->group = 'MyGroup';
|
||||||
$this->metadata = null;
|
$this->metadata = null;
|
||||||
@ -71,7 +73,7 @@ abstract class ConstraintValidatorTestCase extends TestCase
|
|||||||
$this->setDefaultTimezone('UTC');
|
$this->setDefaultTimezone('UTC');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown()
|
private function doTearDown()
|
||||||
{
|
{
|
||||||
$this->restoreDefaultTimezone();
|
$this->restoreDefaultTimezone();
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,82 @@
|
|||||||
|
<?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\Component\Validator\Test;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
// Auto-adapt to PHPUnit 8 that added a `void` return-type to the setUp/tearDown methods
|
||||||
|
|
||||||
|
if (method_exists(\ReflectionMethod::class, 'hasReturnType') && (new \ReflectionMethod(TestCase::class, 'tearDown'))->hasReturnType()) {
|
||||||
|
eval('
|
||||||
|
namespace Symfony\Component\Validator\Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
trait TestCaseSetUpTearDownTrait
|
||||||
|
{
|
||||||
|
private function doSetUp(): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private function doTearDown(): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
$this->doSetUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown(): void
|
||||||
|
{
|
||||||
|
$this->doTearDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
');
|
||||||
|
} else {
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
trait TestCaseSetUpTearDownTrait
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function doSetUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function doTearDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
$this->doSetUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function tearDown()
|
||||||
|
{
|
||||||
|
$this->doTearDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user