-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 4.2: [Routing] Fixed unexpected 404 NoConfigurationException [DI] Removes number of elements information in debug mode [Contracts] Simplify implementation declarations Update PR template for 4.3 [Intl] Add FallbackTrait for data generation [Console] Commands with an alias should not be recognized as ambiguous clarify the possible class/interface of the cache
- Loading branch information
Showing
21 changed files
with
189 additions
and
126 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
| Q | A | ||
| ------------- | --- | ||
| Branch? | master for features / 3.4 up to 4.2 for bug fixes <!-- see below --> | ||
| Branch? | master for features / 3.4, 4.2 or 4.3 for bug fixes <!-- see below --> | ||
| Bug fix? | yes/no | ||
| New feature? | yes/no <!-- don't forget to update src/**/CHANGELOG.md files --> | ||
| New feature? | yes/no <!-- please update src/**/CHANGELOG.md files --> | ||
| BC breaks? | no <!-- see https://symfony.com/bc --> | ||
| Deprecations? | yes/no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files --> | ||
| Deprecations? | yes/no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | ||
| Tests pass? | yes <!-- please add some, will be required by reviewers --> | ||
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any --> | ||
| License | MIT | ||
| Doc PR | symfony/symfony-docs#... <!-- required for new features --> | ||
|
||
<!-- | ||
Write a short README entry for your feature/bugfix here (replace this comment block.) | ||
This will help people understand your PR and can be used as a start of the Doc PR. | ||
Additionally: | ||
- Bug fixes must be submitted against the lowest branch where they apply | ||
Replace this notice by a short README for your feature/bugfix. This will help people | ||
understand your PR and can be used as a start for the documentation. | ||
Additionally (see https://symfony.com/roadmap): | ||
- Bug fixes must be submitted against the lowest maintained branch where they apply | ||
(lowest branches are regularly merged to upper ones so they get the fixes too). | ||
- Features and deprecations must be submitted against the master branch. | ||
--> |
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
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
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
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
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
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
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
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
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
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
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
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
67 changes: 67 additions & 0 deletions
67
src/Symfony/Component/Intl/Data/Generator/FallbackTrait.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,67 @@ | ||
<?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\Intl\Data\Generator; | ||
|
||
use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface; | ||
use Symfony\Component\Intl\Locale; | ||
|
||
/** | ||
* @author Roland Franssen <franssen.roland@gmail.com> | ||
* | ||
* @internal | ||
*/ | ||
trait FallbackTrait | ||
{ | ||
private $fallbackCache = []; | ||
private $generatingFallback = false; | ||
|
||
/** | ||
* @param string $tempDir | ||
* @param string $displayLocale | ||
* | ||
* @return array|null | ||
* | ||
* @see AbstractDataGenerator::generateDataForLocale() | ||
*/ | ||
abstract protected function generateDataForLocale(BundleEntryReaderInterface $reader, $tempDir, $displayLocale); | ||
|
||
/** | ||
* @param string $tempDir | ||
* | ||
* @return array|null | ||
* | ||
* @see AbstractDataGenerator::generateDataForRoot() | ||
*/ | ||
abstract protected function generateDataForRoot(BundleEntryReaderInterface $reader, $tempDir); | ||
|
||
private function generateFallbackData(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): array | ||
{ | ||
if (null === $fallback = Locale::getFallback($displayLocale)) { | ||
return []; | ||
} | ||
|
||
if (isset($this->fallbackCache[$fallback])) { | ||
return $this->fallbackCache[$fallback]; | ||
} | ||
|
||
$prevGeneratingFallback = $this->generatingFallback; | ||
$this->generatingFallback = true; | ||
|
||
try { | ||
$data = 'root' === $fallback ? $this->generateDataForRoot($reader, $tempDir) : $this->generateDataForLocale($reader, $tempDir, $fallback); | ||
} finally { | ||
$this->generatingFallback = $prevGeneratingFallback; | ||
} | ||
|
||
return $this->fallbackCache[$fallback] = $data ?: []; | ||
} | ||
} |
Oops, something went wrong.