8000 Make some classes final by lyrixx · Pull Request #50660 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Make some classes final #50660

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

Closed
wants to merge 1 commit into from
Closed
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
Make some classes final
  • Loading branch information
lyrixx committed Jun 30, 2023
commit f39ede439110c13688d51967b100db1ed2a63410
4 changes: 1 addition & 3 deletions src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@
*
* @author Tobias Schultze <http://tobion.de>
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*
* @final since Symfony 6.1
*/
class ConsoleFormatter implements FormatterInterface
final class ConsoleFormatter implements FormatterInterface
{
use CompatibilityFormatter;

Expand Down
4 changes: 1 addition & 3 deletions src/Symfony/Bridge/Monolog/Formatter/VarDumperFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@

/**
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*
* @final since Symfony 6.1
*/
class VarDumperFormatter implements FormatterInterface
final class VarDumperFormatter implements FormatterInterface
{
use CompatibilityFormatter;

Expand Down
4 changes: 1 addition & 3 deletions src/Symfony/Bridge/Monolog/Handler/ConsoleHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,8 @@ public function isHandling(array $record): bool
* This mapping can be customized with the $verbosityLevelMap constructor parameter.
*
* @author Tobias Schultze <http://tobion.de>
*
* @final since Symfony 6.1
*/
class ConsoleHandler extends AbstractProcessingHandler implements EventSubscriberInterface
final class ConsoleHandler extends AbstractProcessingHandler implements EventSubscriberInterface
{
use CompatibilityHandler;
use CompatibilityIsHandlingHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@
* stack is recommended.
*
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*
* @final since Symfony 6.1
*/
class ElasticsearchLogstashHandler extends AbstractHandler
final class ElasticsearchLogstashHandler extends AbstractHandler
{
use CompatibilityHandler;

Expand Down
4 changes: 1 addition & 3 deletions src/Symfony/Bridge/Monolog/Handler/MailerHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@

/**
* @author Alexander Borisov <boshurik@gmail.com>
*
* @final since Symfony 6.1
*/
class MailerHandler extends AbstractProcessingHandler
final class MailerHandler extends AbstractProcessingHandler
{
use CompatibilityProcessingHandler;

Expand Down
5 changes: 1 addition & 4 deletions src/Symfony/Bridge/Monolog/Handler/NotifierHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,14 @@
use Monolog\Logger;
use Monolog\LogRecord;
use Symfony\Component\Notifier\Notification\Notification;
use Symfony\Component\Notifier\Notifier;
use Symfony\Component\Notifier\NotifierInterface;

/**
* Uses Notifier as a log handler.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @final since Symfony 6.1
*/
class NotifierHandler extends AbstractHandler
final class NotifierHandler extends AbstractHandler
{
use CompatibilityHandler;

Expand Down
10 changes: 2 additions & 8 deletions src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
use Symfony\Bridge\Monolog\Formatter\VarDumperFormatter;

if (trait_exists(FormattableHandlerTrait::class)) {
/**
* @final since Symfony 6.1
*/
class ServerLogHandler extends AbstractProcessingHandler
final class ServerLogHandler extends AbstractProcessingHandler
{
use CompatibilityHandler;
use CompatibilityProcessingHandler;
Expand All @@ -35,10 +32,7 @@ protected function getDefaultFormatter(): FormatterInterface
}
}
} else {
/**
* @final since Symfony 6.1
*/
class ServerLogHandler extends AbstractProcessingHandler
final class ServerLogHandler extends AbstractProcessingHandler
{
use CompatibilityHandler;
use CompatibilityProcessingHandler;
Expand Down
< F438 tr class="js-expandable-line js-skip-tagsearch" data-position="0">
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
* Adds the current console command information to the log entry.
*
* @author Piotr Stankowski <git@trakos.pl>
*
* @final since Symfony 6.1
*/
class ConsoleCommandProcessor implements EventSubscriberInterface, ResetInterface
final class ConsoleCommandProcessor implements EventSubscriberInterface, ResetInterface
{
use CompatibilityProcessor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@
* Adds the original security token to the log entry.
*
* @author Igor Timoshenko <igor.timoshenko@i.ua>
*
* @final since Symfony 6.1
*/
class SwitchUserTokenProcessor extends AbstractTokenProcessor
final class SwitchUserTokenProcessor extends AbstractTokenProcessor
{
protected function getKey(): string
{
Expand Down
4 changes: 1 addition & 3 deletions src/Symfony/Bridge/Monolog/Processor/TokenProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@
*
* @author Dany Maillard <danymaillard93b@gmail.com>
* @author Igor Timoshenko <igor.timoshenko@i.ua>
*
* @final since Symfony 6.1
*/
class TokenProcessor extends AbstractTokenProcessor
final class TokenProcessor extends AbstractTokenProcessor
{
protected function getKey(): string
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@
* leading to a 404 Not Found if the attribute value isn't a valid backing value for the enum type.
*
* @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
*
* @final since Symfony 6.2
*/
class BackedEnumValueResolver implements ArgumentValueResolverInterface, ValueResolverInterface
final class BackedEnumValueResolver implements ArgumentValueResolverInterface, ValueResolverInterface
{
/**
* @deprecated since Symfony 6.2, use resolve() instead
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,7 @@ protected function doSend(SentMessage $message): void
}
}

/**
* @internal since version 6.1, to be made private in 7.0
*
* @final since version 6.1, to be made private in 7.0
*/
protected function doHeloCommand(): void
private function doHeloCommand(): void
{
$this->executeCommand(sprintf("HELO %s\r\n", $this->domain), [250]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
*
* @author Grégoire Pineau <lyrixx@lyrixx.info>
* @author Kévin Dunglas <dunglas@gmail.com>
*
* @final since Symfony 6.3
*/
class ConstraintViolationListNormalizer implements NormalizerInterface
final class ConstraintViolationListNormalizer implements NormalizerInterface
{
public const INSTANCE = 'instance';
public const STATUS = 'status';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@

/**
* @author Jordi Boggiano <j.boggiano@seld.be>
*
* @final since Symfony 6.3
*/
class CustomNormalizer implements NormalizerInterface, DenormalizerInterface, SerializerAwareInterface
final class CustomNormalizer implements NormalizerInterface, DenormalizerInterface, SerializerAwareInterface
{
use ObjectToPopulateTrait;
use SerializerAwareTrait;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@
* Denormalizes a data URI to a {@see \SplFileObject} object.
*
* @author Kévin Dunglas <dunglas@gmail.com>
*
* @final since Symfony 6.3
*/
class DataUriNormalizer implements NormalizerInterface, DenormalizerInterface
final class DataUriNormalizer implements NormalizerInterface, DenormalizerInterface
{
private const SUPPORTED_TYPES = [
\SplFileInfo::class => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
* Denormalizes an interval string to an instance of {@see \DateInterval}.
*
* @author Jérôme Parmentier <jerome@prmntr.me>
*
* @final since Symfony 6.3
*/
class DateIntervalNormalizer implements NormalizerInterface, DenormalizerInterface
final class DateIntervalNormalizer implements NormalizerInterface, DenormalizerInterface
{
public const FORMAT_KEY = 'dateinterval_format';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
* Denormalizes a date string to an instance of {@see \DateTime} or {@see \DateTimeImmutable}.
*
* @author Kévin Dunglas <dunglas@gmail.com>
*
* @final since Symfony 6.3
*/
class DateTimeNormalizer implements NormalizerInterface, DenormalizerInterface
final class DateTimeNormalizer implements NormalizerInterface, DenormalizerInterface
{
public const FORMAT_KEY = 'datetime_format';
public const TIMEZONE_KEY = 'datetime_timezone';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
* Normalizes a {@see \DateTimeZone} object to a timezone string.
*
* @author Jérôme Desjardins <jewome62@gmail.com>
*
* @final since Symfony 6.3
*/
class DateTimeZoneNormalizer implements NormalizerInterface, DenormalizerInterface
final class DateTimeZoneNormalizer implements NormalizerInterface, DenormalizerInterface
{
public function getSupportedTypes(?string $format): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@
* A normalizer that uses an objects own JsonSerializable implementation.
*
* @author Fred Cox <mcfedr@gmail.com>
*
* @final since Symfony 6.3
*/
class JsonSerializableNormalizer extends AbstractNormalizer
final class JsonSerializableNormalizer extends AbstractNormalizer
{
public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@
* Converts between objects and arrays using the PropertyAccess component.
*
* @author Kévin Dunglas <dunglas@gmail.com>
*
* @final since Symfony 6.3
*/
class ObjectNormalizer extends AbstractObjectNormalizer
final class ObjectNormalizer extends AbstractObjectNormalizer
{
protected $propertyAccessor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ private function createXmlEncoderWithDateTimeNormalizer(): XmlEncoder

private function createMockDateTimeNormalizer(): MockObject&NormalizerInterface
{
$mock = $this->createMock(CustomNormalizer::class);
$mock = $this->createMock(NormalizerInterface::class);

$mock
->expects($this->once())
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Serializer/Tests/SerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function testItThrowsExceptionOnInvalidEncoder()
public function testNormalizeNoMatch()
{
$this->expectException(UnexpectedValueException::class);
$serializer = new Serializer([$this->createMock(CustomNormalizer::class)]);
$serializer = new Serializer([$this->createMock(NormalizerInterface::class)]);
$serializer->normalize(new \stdClass(), 'xml');
}

Expand Down Expand Up @@ -117,7 +117,7 @@ public function testNormalizeOnDenormalizer()
public function testDenormalizeNoMatch()
{
$this->expectException(UnexpectedValueException::class);
$serializer = new Serializer([$this->createMock(CustomNormalizer::class)]);
$serializer = new Serializer([$this->createMock(NormalizerInterface::class)]);
$serializer->denormalize('foo', 'stdClass');
}

Expand Down
0