Thanks to visit codestin.com
Credit goes to github.com

Skip to content

mark classes implementing the WarmableInterface as final #53151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions UPGRADE-7.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,31 @@ Cache

* Deprecate `CouchbaseBucketAdapter`, use `CouchbaseCollectionAdapter` instead

FrameworkBundle
---------------

* Mark classes `ConfigBuilderCacheWarmer`, `Router`, `SerializerCacheWarmer`, `TranslationsCacheWarmer`, `Translator` and `ValidatorCacheWarmer` as `final`

Messenger
---------

* Make `#[AsMessageHandler]` final

SecurityBundle
--------------

* Mark class `ExpressionCacheWarmer` as `final`

Translation
-----------

* Mark class `DataCollectorTranslator` as `final`

TwigBundle
----------

* Mark class `TemplateCacheWarmer` as `final`

Workflow
--------

Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* since this information is necessary to build the proxies in the first place.
*
* @author Benjamin Eberlei <[email protected]>
*
* @final since Symfony 7.1
*/
class ProxyCacheWarmer implements CacheWarmerInterface
{
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG
7.1
---

* Mark classes `ConfigBuilderCacheWarmer`, `Router`, `SerializerCacheWarmer`, `TranslationsCacheWarmer`, `Translator` and `ValidatorCacheWarmer` as `final`
* Move the Router `cache_dir` to `kernel.build_dir`
* Deprecate the `router.cache_dir` config option
* Add `rate_limiter` tags to rate limiter services
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
* Generate all config builders.
*
* @author Tobias Nyholm <[email protected]>
*
* @final since Symfony 7.1
*/
class ConfigBuilderCacheWarmer implements CacheWarmerInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
* Warms up XML and YAML serializer metadata.
*
* @author Titouan Galopin <[email protected]>
*
* @final since Symfony 7.1
*/
class SerializerCacheWarmer extends AbstractPhpFileCacheWarmer
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* Generates the catalogues for translations.
*
* @author Xavier Leune <[email protected]>
*
* @final since Symfony 7.1
*/
class TranslationsCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* Warms up XML and YAML validator metadata.
*
* @author Titouan Galopin <[email protected]>
*
* @final since Symfony 7.1
*/
class ValidatorCacheWarmer extends AbstractPhpFileCacheWarmer
{
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Bundle/FrameworkBundle/Routing/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
* This Router creates the Loader only when the cache is empty.
*
* @author Fabien Potencier <[email protected]>
*
* @final since Symfony 7.1
*/
class Router extends BaseRouter implements WarmableInterface, ServiceSubscriberInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,6 @@ public function testTransWithCaching()
$this->assertEquals('foobarbax (sr@latin)', $translator->trans('foobarbax'));
}

public function testTransWithCachingWithInvalidLocale()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid "invalid locale" locale.');
$loader = $this->createMock(LoaderInterface::class);
$translator = $this->getTranslator($loader, ['cache_dir' => $this->tmpDir], 'loader', TranslatorWithInvalidLocale::class);

$translator->trans('foo');
}

public function testLoadResourcesWithoutCaching()
{
$loader = new YamlFileLoader();
Expand Down Expand Up @@ -418,11 +408,3 @@ private function createTranslator($loader, $options, $translatorClass = Translat
);
}
}

class TranslatorWithInvalidLocale extends Translator
{
public function getLocale(): string
{
return 'invalid locale';
}
}
2 changes: 2 additions & 0 deletions src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

/**
* @author Fabien Potencier <[email protected]>
*
* @final since Symfony 7.1
*/
class Translator extends BaseTranslator implements WarmableInterface
{
Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Bundle/SecurityBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

7.1
---

* Mark class `ExpressionCacheWarmer` as `final`

7.0
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
use Symfony\Component\Security\Core\Authorization\ExpressionLanguage;

/**
* @final since Symfony 7.1
*/
class ExpressionCacheWarmer implements CacheWarmerInterface
{
private iterable $expressions;
Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Bundle/TwigBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

7.1
---

* Mark class `TemplateCacheWarmer` as `final`

7.0
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* Generates the Twig cache for all templates.
*
* @author Fabien Potencier <[email protected]>
*
* @final since Symfony 7.1
*/
class TemplateCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInterface
{
Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Component/Translation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

7.1
---

* Mark class `DataCollectorTranslator` as `final`

7.0
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

/**
* @author Abdellatif Ait boudad <[email protected]>
*
* @final since Symfony 7.1
*/
class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInterface, LocaleAwareInterface, WarmableInterface
{
Expand Down