From 8e1d3285ed1a6e65f3323d04e3d2b3c151254dec Mon Sep 17 00:00:00 2001 From: Nyholm Date: Mon, 22 Feb 2021 22:11:34 +0100 Subject: [PATCH 1/6] Adding templates for Belarusian --- .../Resources/translations/validators.be.xlf | 120 ++++++++++++++++++ .../Resources/translations/security.be.xlf | 8 ++ .../Resources/translations/validators.be.xlf | 24 ++++ 3 files changed, 152 insertions(+) diff --git a/src/Symfony/Component/Form/Resources/translations/validators.be.xlf b/src/Symfony/Component/Form/Resources/translations/validators.be.xlf index 004ba594b3..042722eba8 100644 --- a/src/Symfony/Component/Form/Resources/translations/validators.be.xlf +++ b/src/Symfony/Component/Form/Resources/translations/validators.be.xlf @@ -14,6 +14,126 @@ The CSRF token is invalid. Please try to resubmit the form. CSRF-токен не сапраўдны. Калі ласка, паспрабуйце яшчэ раз адправіць форму. + + This value is not a valid HTML5 color. + This value is not a valid HTML5 color. + + + Please enter a valid birthdate. + Please enter a valid birthdate. + + + The selected choice is invalid. + The selected choice is invalid. + + + The collection is invalid. + The collection is invalid. + + + Please select a valid color. + Please select a valid color. + + + Please select a valid country. + Please select a valid country. + + + Please select a valid currency. + Please select a valid currency. + + + Please choose a valid date interval. + Please choose a valid date interval. + + + Please enter a valid date and time. + Please enter a valid date and time. + + + Please enter a valid date. + Please enter a valid date. + + + Please select a valid file. + Please select a valid file. + + + The hidden field is invalid. + The hidden field is invalid. + + + Please enter an integer. + Please enter an integer. + + + Please select a valid language. + Please select a valid language. + + + Please select a valid locale. + Please select a valid locale. + + + Please enter a valid money amount. + Please enter a valid money amount. + + + Please enter a number. + Please enter a number. + + + The password is invalid. + The password is invalid. + + + Please enter a percentage value. + Please enter a percentage value. + + + The values do not match. + The values do not match. + + + Please enter a valid time. + Please enter a valid time. + + + Please select a valid timezone. + Please select a valid timezone. + + + Please enter a valid URL. + Please enter a valid URL. + + + Please enter a valid search term. + Please enter a valid search term. + + + Please provide a valid phone number. + Please provide a valid phone number. + + + The checkbox has an invalid value. + The checkbox has an invalid value. + + + Please enter a valid email address. + Please enter a valid email address. + + + Please select a valid option. + Please select a valid option. + + + Please select a valid range. + Please select a valid range. + + + Please enter a valid week. + Please enter a valid week. + diff --git a/src/Symfony/Component/Security/Core/Resources/translations/security.be.xlf b/src/Symfony/Component/Security/Core/Resources/translations/security.be.xlf index c3cd7911e5..216df88ed2 100644 --- a/src/Symfony/Component/Security/Core/Resources/translations/security.be.xlf +++ b/src/Symfony/Component/Security/Core/Resources/translations/security.be.xlf @@ -62,6 +62,14 @@ Account is locked. Акаўнт заблакіраван. + + Too many failed login attempts, please try again later. + Too many failed login attempts, please try again later. + + + Invalid or expired login link. + Invalid or expired login link. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.be.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.be.xlf index ab3845ee20..e12c53c36e 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.be.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.be.xlf @@ -362,6 +362,30 @@ This password has been leaked in a data breach, it must not be used. Please use another password. Гэты пароль быў выкрадзены ў выніку ўзлому дадзеных, таму яго нельга выкарыстоўваць. Калі ласка, выкарыстоўвайце іншы пароль. + + This value should be between {{ min }} and {{ max }}. + This value should be between {{ min }} and {{ max }}. + + + This value is not a valid hostname. + This value is not a valid hostname. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + The number of elements in this collection should be a multiple of {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + This value should satisfy at least one of the following constraints: + + + Each element of this collection should satisfy its own set of constraints. + Each element of this collection should satisfy its own set of constraints. + + + This value is not a valid International Securities Identification Number (ISIN). + This value is not a valid International Securities Identification Number (ISIN). + From 4721097cab1681cf9bc49f2961e9d1cb9d4ad9d2 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 26 Feb 2021 14:50:45 +0100 Subject: [PATCH 2/6] deal with indented heredoc/nowdoc tokens --- .../Translation/Extractor/PhpExtractor.php | 13 ++++++++++++ .../Tests/Extractor/PhpExtractorTest.php | 21 +++++++++++++++++++ .../extractor-7.3/translation.html.php | 13 ++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 src/Symfony/Component/Translation/Tests/fixtures/extractor-7.3/translation.html.php diff --git a/src/Symfony/Component/Translation/Extractor/PhpExtractor.php b/src/Symfony/Component/Translation/Extractor/PhpExtractor.php index 88811418ca..32389c677c 100644 --- a/src/Symfony/Component/Translation/Extractor/PhpExtractor.php +++ b/src/Symfony/Component/Translation/Extractor/PhpExtractor.php @@ -178,6 +178,19 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface } break; case \T_END_HEREDOC: + if ($indentation = strspn($t[1], ' ')) { + $docPartWithLineBreaks = $docPart; + $docPart = ''; + + foreach (preg_split('~(\r\n|\n|\r)~', $docPartWithLineBreaks, -1, \PREG_SPLIT_DELIM_CAPTURE) as $str) { + if (\in_array($str, ["\r\n", "\n", "\r"], true)) { + $docPart .= $str; + } else { + $docPart .= substr($str, $indentation); + } + } + } + $message .= PhpStringTokenParser::parseDocString($docToken, $docPart); $docToken = ''; $docPart = ''; diff --git a/src/Symfony/Component/Translation/Tests/Extractor/PhpExtractorTest.php b/src/Symfony/Component/Translation/Tests/Extractor/PhpExtractorTest.php index a6d7c5001c..5a693977da 100644 --- a/src/Symfony/Component/Translation/Tests/Extractor/PhpExtractorTest.php +++ b/src/Symfony/Component/Translation/Tests/Extractor/PhpExtractorTest.php @@ -75,6 +75,27 @@ EOF; $this->assertEquals(['sources' => [$filename.':43']], $catalogue->getMetadata('other-domain-test-no-params-short-array', 'not_messages')); } + /** + * @requires PHP 7.3 + */ + public function testExtractionFromIndentedHeredocNowdoc() + { + $catalogue = new MessageCatalogue('en'); + + $extractor = new PhpExtractor(); + $extractor->setPrefix('prefix'); + $extractor->extract(__DIR__.'/../fixtures/extractor-7.3/translation.html.php', $catalogue); + + $expectedCatalogue = [ + 'messages' => [ + "heredoc\nindented\n further" => "prefixheredoc\nindented\n further", + "nowdoc\nindented\n further" => "prefixnowdoc\nindented\n further", + ], + ]; + + $this->assertEquals($expectedCatalogue, $catalogue->all()); + } + public function resourcesProvider() { $directory = __DIR__.'/../fixtures/extractor/'; diff --git a/src/Symfony/Component/Translation/Tests/fixtures/extractor-7.3/translation.html.php b/src/Symfony/Component/Translation/Tests/fixtures/extractor-7.3/translation.html.php new file mode 100644 index 0000000000..35ffe8812e --- /dev/null +++ b/src/Symfony/Component/Translation/Tests/fixtures/extractor-7.3/translation.html.php @@ -0,0 +1,13 @@ +This template is used for translation message extraction tests +trans(<< +trans(<<<'EOF' + nowdoc + indented + further + EOF +); ?> From 4b70db1e8533c4f4de65f560475d8a1836c05a33 Mon Sep 17 00:00:00 2001 From: Junaid Farooq Date: Tue, 2 Mar 2021 10:49:57 +0530 Subject: [PATCH 3/6] [Security] Remove unnecessary inherited doc annotation --- .../Component/Security/Core/User/User.php | 36 ++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Security/Core/User/User.php b/src/Symfony/Component/Security/Core/User/User.php index 5429baa0cd..fa5cfb524e 100644 --- a/src/Symfony/Component/Security/Core/User/User.php +++ b/src/Symfony/Component/Security/Core/User/User.php @@ -83,7 +83,14 @@ final class User implements UserInterface, EquatableInterface } /** - * {@inheritdoc} + * Checks whether the user's account has expired. + * + * Internally, if this method returns false, the authentication system + * will throw an AccountExpiredException and prevent login. + * + * @return bool true if the user's account is non expired, false otherwise + * + * @see AccountExpiredException */ public function isAccountNonExpired(): bool { @@ -91,7 +98,14 @@ final class User implements UserInterface, EquatableInterface } /** - * {@inheritdoc} + * Checks whether the user is locked. + * + * Internally, if this method returns false, the authentication system + * will throw a LockedException and prevent login. + * + * @return bool true if the user is not locked, false otherwise + * + * @see LockedException */ public function isAccountNonLocked(): bool { @@ -99,7 +113,14 @@ final class User implements UserInterface, EquatableInterface } /** - * {@inheritdoc} + * Checks whether the user's credentials (password) has expired. + * + * Internally, if this method returns false, the authentication system + * will throw a CredentialsExpiredException and prevent login. + * + * @return bool true if the user's credentials are non expired, false otherwise + * + * @see CredentialsExpiredException */ public function isCredentialsNonExpired(): bool { @@ -107,7 +128,14 @@ final class User implements UserInterface, EquatableInterface } /** - * {@inheritdoc} + * Checks whether the user is enabled. + * + * Internally, if this method returns false, the authentication system + * will throw a DisabledException and prevent login. + * + * @return bool true if the user is enabled, false otherwise + * + * @see DisabledException */ public function isEnabled(): bool { From a9de390676996fbebdce6be1e9754b7f2d4e62ab Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 3 Mar 2021 13:08:43 +0100 Subject: [PATCH 4/6] fix parsing calls of methods named "method" --- .../Component/DependencyInjection/Loader/YamlFileLoader.php | 2 +- .../DependencyInjection/Tests/Fixtures/yaml/alt_call.yaml | 2 ++ .../DependencyInjection/Tests/Loader/YamlFileLoaderTest.php | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index 1133254c6c..e9b09cc2eb 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -471,7 +471,7 @@ class YamlFileLoader extends FileLoader throw new InvalidArgumentException(sprintf('Invalid method call for service "%s", did you forgot a leading dash before "%s: ..." in "%s"?', $id, $k, $file)); } - if (isset($call['method'])) { + if (isset($call['method']) && \is_string($call['method'])) { $method = $call['method']; $args = $call['arguments'] ?? []; $returnsClone = $call['returns_clone'] ?? false; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/alt_call.yaml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/alt_call.yaml index 26cf9e628c..fb7f3440de 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/alt_call.yaml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/alt_call.yaml @@ -3,3 +3,5 @@ services: calls: - foo: [1, 2, 3] - bar: !returns_clone [1, 2, 3] + - method: + - url diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php index 2e15f615fb..b20302cf97 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php @@ -968,6 +968,7 @@ class YamlFileLoaderTest extends TestCase $expected = [ ['foo', [1, 2, 3]], ['bar', [1, 2, 3], true], + ['method', ['url']], ]; $this->assertSame($expected, $container->getDefinition('foo')->getMethodCalls()); From 1b84d5d23b1b88804f8eb189031eec28585d202f Mon Sep 17 00:00:00 2001 From: OxanaKozlova Date: Wed, 24 Feb 2021 15:36:10 +0300 Subject: [PATCH 5/6] Add translation for Belarusian --- .../Resources/translations/validators.be.xlf | 60 +++++++++---------- .../Resources/translations/security.be.xlf | 4 +- .../Resources/translations/validators.be.xlf | 12 ++-- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/Symfony/Component/Form/Resources/translations/validators.be.xlf b/src/Symfony/Component/Form/Resources/translations/validators.be.xlf index 042722eba8..0513ca1dc9 100644 --- a/src/Symfony/Component/Form/Resources/translations/validators.be.xlf +++ b/src/Symfony/Component/Form/Resources/translations/validators.be.xlf @@ -16,123 +16,123 @@ This value is not a valid HTML5 color. - This value is not a valid HTML5 color. + Значэнне не з'яўляецца карэктным HTML5 колерам. Please enter a valid birthdate. - Please enter a valid birthdate. + Калі ласка, увядзіце карэктную дату нараджэння. The selected choice is invalid. - The selected choice is invalid. + Выбраны варыянт некарэктны. The collection is invalid. - The collection is invalid. + Калекцыя некарэктна. Please select a valid color. - Please select a valid color. + Калі ласка, выберыце карэктны колер. Please select a valid country. - Please select a valid country. + Калі ласка, выберыце карэктную краіну. Please select a valid currency. - Please select a valid currency. + Калі ласка, выберыце карэктную валюту. Please choose a valid date interval. - Please choose a valid date interval. + Калі ласка, выберыце карэктны інтэрвал дат. Please enter a valid date and time. - Please enter a valid date and time. + Калі ласка, увядзіце карэктныя дату і час. Please enter a valid date. - Please enter a valid date. + Калі ласка, увядзіце карэктную дату. Please select a valid file. - Please select a valid file. + Калі ласка, выберыце карэктны файл. The hidden field is invalid. - The hidden field is invalid. + Значэнне схаванага поля некарэктна. Please enter an integer. - Please enter an integer. + Калі ласка, увядзіце цэлы лік. Please select a valid language. - Please select a valid language. + Калі ласка, выберыце карэктную мову. Please select a valid locale. - Please select a valid locale. + Калі ласка, выберыце карэктную лакаль. Please enter a valid money amount. - Please enter a valid money amount. + Калі ласка, увядзіце карэктную колькасць грошай. Please enter a number. - Please enter a number. + Калі ласка, увядзіце нумар. The password is invalid. - The password is invalid. + Няправільны пароль. Please enter a percentage value. - Please enter a percentage value. + Калі ласка, увядзіце працэнтнае значэнне. The values do not match. - The values do not match. + Значэнні не супадаюць. Please enter a valid time. - Please enter a valid time. + Калі ласка, увядзіце карэктны час. Please select a valid timezone. - Please select a valid timezone. + Калі ласка, выберыце карэктны гадзінны пояс. Please enter a valid URL. - Please enter a valid URL. + Калі ласка, увядзіце карэктны URL. Please enter a valid search term. - Please enter a valid search term. + Калі ласка, увядзіце карэктны пошукавы запыт. Please provide a valid phone number. - Please provide a valid phone number. + Калі ласка, увядзіце карэктны нумар тэлефона. The checkbox has an invalid value. - The checkbox has an invalid value. + Флажок мае некарэктнае значэнне. Please enter a valid email address. - Please enter a valid email address. + Калі ласка, увядзіце карэктны адрас электроннай пошты. Please select a valid option. - Please select a valid option. + Калі ласка, выберыце карэктны варыянт. Please select a valid range. - Please select a valid range. + Калі ласка, выберыце карэктны дыяпазон. Please enter a valid week. - Please enter a valid week. + Калі ласка, увядзіце карэктны тыдзень. diff --git a/src/Symfony/Component/Security/Core/Resources/translations/security.be.xlf b/src/Symfony/Component/Security/Core/Resources/translations/security.be.xlf index 216df88ed2..b24a5c421a 100644 --- a/src/Symfony/Component/Security/Core/Resources/translations/security.be.xlf +++ b/src/Symfony/Component/Security/Core/Resources/translations/security.be.xlf @@ -64,11 +64,11 @@ Too many failed login attempts, please try again later. - Too many failed login attempts, please try again later. + Зашмат няўдалых спроб уваходу, калі ласка, паспрабуйце пазней. Invalid or expired login link. - Invalid or expired login link. + Спасылка для ўваходу несапраўдная або пратэрмінаваная. diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.be.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.be.xlf index e12c53c36e..5f9988ef3c 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.be.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.be.xlf @@ -364,27 +364,27 @@ This value should be between {{ min }} and {{ max }}. - This value should be between {{ min }} and {{ max }}. + Значэнне павінна быць паміж {{min}} і {{max}}. This value is not a valid hostname. - This value is not a valid hostname. + Значэнне не з'яўляецца карэктным імем хаста. The number of elements in this collection should be a multiple of {{ compared_value }}. - The number of elements in this collection should be a multiple of {{ compared_value }}. + Колькасць элементаў у гэтай калекцыі павінна быць кратным {{compared_value}}. This value should satisfy at least one of the following constraints: - This value should satisfy at least one of the following constraints: + Значэнне павінна задавальняць як мінімум аднаму з наступных абмежаванняў: Each element of this collection should satisfy its own set of constraints. - Each element of this collection should satisfy its own set of constraints. + Кожны элемент гэтай калекцыі павінен задавальняць свайму ўласнаму набору абмежаванняў. This value is not a valid International Securities Identification Number (ISIN). - This value is not a valid International Securities Identification Number (ISIN). + Значэнне не з'яўляецца карэктным міжнародным ідэнтыфікацыйным нумарам каштоўных папер (ISIN). From e67ef5bbfff768733f299f24f908ac9486a56fb3 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Wed, 3 Mar 2021 23:49:57 +0100 Subject: [PATCH 6/6] [Validator] Fix return types --- src/Symfony/Component/Validator/Constraint.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Validator/Constraint.php b/src/Symfony/Component/Validator/Constraint.php index 7cd3a68b86..2683c68360 100644 --- a/src/Symfony/Component/Validator/Constraint.php +++ b/src/Symfony/Component/Validator/Constraint.php @@ -25,7 +25,7 @@ use Symfony\Component\Validator\Exception\MissingOptionsException; * * Constraint instances are immutable and serializable. * - * @property array $groups The groups that the constraint belongs to + * @property string[] $groups The groups that the constraint belongs to * * @author Bernhard Schussek */ @@ -246,7 +246,7 @@ abstract class Constraint * * Override this method if you want to define required options. * - * @return array + * @return string[] * * @see __construct() */ @@ -276,7 +276,7 @@ abstract class Constraint * This method should return one or more of the constants * Constraint::CLASS_CONSTRAINT and Constraint::PROPERTY_CONSTRAINT. * - * @return string|array One or more constant values + * @return string|string[] One or more constant values */ public function getTargets() {