Skip to content

Commit

Permalink
Mark classes internal to this bundle as final (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpdude authored Jan 4, 2024
1 parent 545792e commit bec3c4f
Show file tree
Hide file tree
Showing 12 changed files with 11 additions and 34 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ To get the diff for a specific change, go to https://github.com/webfactory/polyg
## Version 3.0.0 [unreleased]

* Dropped support for PHP versions below 8.1, and for Symfony versions before 5.4.
* Classes internal to this bundle are now marked as `final`. Static analysis tools should be able to pick up `@final` announcements used as of v2.5.0.

## Version 2.0.0

Expand Down
4 changes: 1 addition & 3 deletions src/Annotation/Locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@
/**
* @Annotation
* @Target({"CLASS","PROPERTY"})
*
* @final
*/
class Locale extends Annotation
final class Locale extends Annotation
{
/**
* @var string
Expand Down
4 changes: 1 addition & 3 deletions src/Annotation/Translatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@

/**
* @Annotation
*
* @final
*/
class Translatable extends Annotation
final class Translatable extends Annotation
{
/**
* @var string
Expand Down
4 changes: 1 addition & 3 deletions src/Annotation/TranslationCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

/**
* @Annotation
*
* @final
*/
class TranslationCollection
final class TranslationCollection
{
}
2 changes: 1 addition & 1 deletion src/DependencyInjection/WebfactoryPolyglotExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

class WebfactoryPolyglotExtension extends Extension
final class WebfactoryPolyglotExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container): void
{
Expand Down
7 changes: 1 addition & 6 deletions src/Doctrine/PersistentTranslatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@
/**
* Eine TranslationProxy-Implementierung für eine Entität, die
* bereits unter Verwaltung des EntityManagers steht.
*
* @final
*/
class PersistentTranslatable implements TranslatableInterface
final class PersistentTranslatable implements TranslatableInterface
{
/**
* Cache für die Übersetzungen, indiziert nach Entity-OID und Locale. Ist static, damit ihn sich verschiedene Proxies (für die gleiche Entität, aber unterschiedliche Felder) teilen können.
Expand Down Expand Up @@ -134,9 +132,6 @@ public function __construct(
$this->logger = (null == $logger) ? new NullLogger() : $logger;
}

/**
* @param mixed $value
*/
public function setPrimaryValue($value)
{
$this->primaryValue = $value;
Expand Down
5 changes: 1 addition & 4 deletions src/Doctrine/PolyglotListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
use SplObjectStorage;
use Webfactory\Bundle\PolyglotBundle\Locale\DefaultLocaleProvider;

/**
* @final
*/
class PolyglotListener
final class PolyglotListener
{
public const CACHE_SALT = '$WebfactoryPolyglot';

Expand Down
4 changes: 1 addition & 3 deletions src/Doctrine/TranslatableClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@
* like which fields in the class are @Translatable_s, which field holds the collection
* of translations etc. There need only be one instance of this class for every
* entity class with translations.
*
* @final
*/
class TranslatableClassMetadata
final class TranslatableClassMetadata
{
/**
* Ein Mapping von Feldnamen in der Hauptklasse auf die Felder in der
Expand Down
4 changes: 1 addition & 3 deletions src/EventListener/LocaleListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
* Taken from Christophe COEVOET's Doctrine Extensions Bundle.
*
* @author Christophe COEVOET
*
* @final
*/
class LocaleListener implements EventSubscriberInterface
final class LocaleListener implements EventSubscriberInterface
{
private $defaultLocaleProvider;

Expand Down
5 changes: 1 addition & 4 deletions src/Locale/DefaultLocaleProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@

namespace Webfactory\Bundle\PolyglotBundle\Locale;

/**
* @final
*/
class DefaultLocaleProvider
final class DefaultLocaleProvider
{
private $defaultLocale;

Expand Down
4 changes: 1 addition & 3 deletions src/Translatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@
* protected $aField;
* public function __construct() {...
* $aField = new Translatable();
*
* @final
*/
class Translatable implements TranslatableInterface
final class Translatable implements TranslatableInterface
{
/**
* @var string
Expand Down
1 change: 0 additions & 1 deletion src/TranslatableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public function translate(string $locale = null);
/**
* Overwrites the translation for the given locale.
*
* @param mixed $value
* @param string|null $locale The target locale or null for the current locale.
*/
public function setTranslation($value, string $locale = null);
Expand Down

0 comments on commit bec3c4f

Please sign in to comment.