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

Skip to content

Remove BC layers related to new methods and new parameters #50839

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
Jul 3, 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
95 changes: 49 additions & 46 deletions .github/expected-missing-return-types.diff

Large diffs are not rendered by default.

52 changes: 49 additions & 3 deletions UPGRADE-7.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Console
* Remove `Command::$defaultName` and `Command::$defaultDescription`, use the `AsCommand` attribute instead
* Passing null to `*Command::setApplication()`, `*FormatterStyle::setForeground/setBackground()`, `Helper::setHelpSet()`, `Input*::setDefault()` and `Question::setAutocompleterCallback/setValidator()` must be done explicitly
* Remove `StringInput::REGEX_STRING`
* Add method `__toString()` to `InputInterface`

DependencyInjection
-------------------
Expand All @@ -28,6 +29,8 @@ DependencyInjection
* Remove `PhpDumper` options `inline_factories_parameter` and `inline_class_loader_parameter`, use options `inline_factories` and `inline_class_loader` instead
* Parameter names of `ParameterBag` cannot be numerics
* Remove `ContainerAwareInterface` and `ContainerAwareTrait`, use dependency injection instead
* Add argument `$id` and `$asGhostObject` to `DumperInterface::isProxyCandidate()` and `getProxyCode()`
* Add argument `$source` to `FileLoader::registerClasses()`

DoctrineBridge
--------------
Expand All @@ -42,6 +45,16 @@ DoctrineBridge
* DoctrineBridge now requires `doctrine/event-manager:^2`
* Add parameter `$isSameDatabase` to `DoctrineTokenProvider::configureSchema()`

Filesystem
----------

* Add argument `$lock` to `Filesystem::appendToFile()`

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

* Remove command `translation:update`, use `translation:extract` instead

HttpFoundation
--------------

Expand All @@ -55,6 +68,11 @@ HttpFoundation
* Remove `Request::getContentType()`, use `Request::getContentTypeFormat()` instead
* Throw an `InvalidArgumentException` when calling `Request::create()` with a malformed URI

HttpKernel
----------

* Add argument `$reflector` to `ArgumentResolverInterface::getArguments()` and `ArgumentMetadataFactoryInterface::createArgumentMetadata()`

Lock
----

Expand All @@ -65,11 +83,27 @@ Messenger

* Add parameter `$isSameDatabase` to `DoctrineTransport::configureSchema()`

PropertyAccess
--------------

* Add method `isNullSafe()` to `PropertyPathInterface`

ProxyManagerBridge
------------------

* Remove the bridge, use VarExporter's lazy objects instead

Routing
-------

* Add argument `$routeParameters` to `UrlMatcher::handleRouteRequirements()`

Security
--------

* Add argument `$badgeFqcn` to `Passport::addBadge()`
* Add argument `$lifetime` to `LoginLinkHandlerInterface::createLoginLink()`

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

Expand All @@ -78,11 +112,23 @@ SecurityBundle
Serializer
----------

* Add method `getSupportedTypes()` to `DenormalizerInterface` and `NormalizerInterface`
* Remove denormalization support for `AbstractUid` in `UidNormalizer`, use one of `AbstractUid` child class instead
* Denormalizing to an abstract class in `UidNormalizer` now throws an `\Error`
* Remove `ContextAwareDenormalizerInterface`, use `DenormalizerInterface` instead
* Remove `ContextAwareNormalizerInterface`, use `NormalizerInterface` instead
* Remove `CacheableSupportsMethodInterface`, use `NormalizerInterface` and `DenormalizerInterface` instead
* First argument of `ClassMetadata::setSerializedName()` is now required
* Third argument `array $context = []` of the `NormalizerInterface::supportsNormalization()` is now required
* Fourth argument `array $context = []` of the `DenormalizerInterface::supportsDenormalization()` is now required
* First argument of `AttributeMetadata::setSerializedName()` is now required
* Add argument `$context` to `NormalizerInterface::supportsNormalization()` and `DenormalizerInterface::supportsDenormalization()`

Validator
---------

* Add methods `getConstraint()`, `getCause()` and `__toString()` to `ConstraintViolationInterface`
* Add method `__toString()` to `ConstraintViolationListInterface`
* Add method `disableTranslation()` to `ConstraintViolationBuilderInterface`

VarDumper
---------

* Add argument `$label` to `VarDumper::dump()`
5 changes: 5 additions & 0 deletions src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

7.0
---

* Remove command `translation:update`, use `translation:extract` instead

6.3
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$io = new SymfonyStyle($input, $output);
$errorIo = $output instanceof ConsoleOutputInterface ? new SymfonyStyle($input, $output->getErrorOutput()) : $io;

if ('translation:update' === $input->getFirstArgument()) {
$errorIo->caution('Command "translation:update" is deprecated since version 5.4 and will be removed in Symfony 6.0. Use "translation:extract" instead.');
}

$io = new SymfonyStyle($input, $output);
$errorIo = $io->getErrorStyle();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ class TranslationUpdateCommandTest extends TestCase
private $fs;
private $translationDir;

public function testDumpMessagesAndCleanWithDeprecatedCommandName()
{
$tester = $this->createCommandTester(['messages' => ['foo' => 'foo']]);
$tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true]);
$this->assertMatchesRegularExpression('/foo/', $tester->getDisplay());
$this->assertMatchesRegularExpression('/1 message was successfully extracted/', $tester->getDisplay());
}

public function testDumpMessagesAndClean()
{
$tester = $this->createCommandTester(['messages' => ['foo' => 'foo']]);
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Console/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG
7.0
---

* Add method `__toString()` to `InputInterface`
* Remove `Command::$defaultName` and `Command::$defaultDescription`, use the `AsCommand` attribute instead
* Passing null to `*Command::setApplication()`, `*FormatterStyle::setForeground/setBackground()`, `Helper::setHelpSet()`, `Input*::setDefault()` and `Question::setAutocompleterCallback/setValidator()` must be done explicitly
* Remove `StringInput::REGEX_STRING`
Expand Down
10 changes: 7 additions & 3 deletions src/Symfony/Component/Console/Input/InputInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
* InputInterface is the interface implemented by all input classes.
*
* @author Fabien Potencier <[email protected]>
*
* @method string __toString() Returns a stringified representation of the args passed to the command.
* InputArguments MUST be escaped as well as the InputOption values passed to the command.
*/
interface InputInterface
{
Expand Down Expand Up @@ -147,4 +144,11 @@ public function isInteractive(): bool;
* @return void
*/
public function setInteractive(bool $interactive);

/**
* Returns a stringified representation of the args passed to the command.
*
* InputArguments MUST be escaped as well as the InputOption values passed to the command.
*/
public function __toString(): string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,6 @@ public function testAllKindsOfInputCanBeLogged()
$listener->onConsoleTerminate($this->getConsoleTerminateEvent(new StringInput('test:run --foo=bar'), 255));
}

public function testCommandNameIsDisplayedForNonStringableInput()
{
$logger = $this->createMock(LoggerInterface::class);
$logger
->expects($this->once())
->method('debug')
->with('Command "{command}" exited with code "{code}"', ['command' => 'test:run', 'code' => 255])
;

$listener = new ErrorListener($logger);
$listener->onConsoleTerminate($this->getConsoleTerminateEvent($this->createMock(InputInterface::class), 255));
}

private function getConsoleTerminateEvent(InputInterface $input, $exitCode)
{
return new ConsoleTerminateEvent(new Command('test:run'), $input, $this->createMock(OutputInterface::class), $exitCode);
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Component/DependencyInjection/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ CHANGELOG
* Remove `PhpDumper` options `inline_factories_parameter` and `inline_class_loader_parameter`, use options `inline_factories` and `inline_class_loader` instead
* Parameter names of `ParameterBag` cannot be numerics
* Remove `ContainerAwareInterface` and `ContainerAwareTrait`, use dependency injection instead
* Add argument `$id` and `$asGhostObject` to `DumperInterface::isProxyCandidate()` and `getProxyCode()`
* Add argument `$source` to `FileLoader::registerClasses()`

6.4
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ interface DumperInterface
/**
* Inspects whether the given definitions should produce proxy instantiation logic in the dumped container.
*
* @param bool|null &$asGhostObject Set to true after the call if the proxy is a ghost object
* @param string|null $id
* @param bool|null &$asGhostObject Set to true after the call if the proxy is a ghost object
*/
public function isProxyCandidate(Definition $definition/* , bool &$asGhostObject = null, string $id = null */): bool;
public function isProxyCandidate(Definition $definition, bool &$asGhostObject = null, string $id = null): bool;

/**
* Generates the code to be used to instantiate a proxy in the dumped factory code.
Expand All @@ -35,8 +34,6 @@ public function getProxyFactoryCode(Definition $definition, string $id, string $

/**
* Generates the code for the lazy proxy.
*
* @param string|null $id
*/
public function getProxyCode(Definition $definition/* , string $id = null */): string;
public function getProxyCode(Definition $definition, string $id = null): string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function import(mixed $resource, string $type = null, bool|string $ignore
*
* @return void
*/
public function registerClasses(Definition $prototype, string $namespace, string $resource, string|array $exclude = null/* , string $source = null */)
public function registerClasses(Definition $prototype, string $namespace, string $resource, string|array $exclude = null, string $source = null)
{
if (!str_ends_with($namespace, '\\')) {
throw new InvalidArgumentException(sprintf('Namespace prefix must end with a "\\": "%s".', $namespace));
Expand All @@ -115,7 +115,6 @@ public function registerClasses(Definition $prototype, string $namespace, string
throw new InvalidArgumentException('The exclude list must not contain an empty value.');
}

$source = \func_num_args() > 4 ? func_get_arg(4) : null;
$autoconfigureAttributes = new RegisterAutoconfigureAttributesPass();
$autoconfigureAttributes = $autoconfigureAttributes->accept($prototype) ? $autoconfigureAttributes : null;
$classes = $this->findClasses($namespace, $resource, (array) $exclude, $autoconfigureAttributes, $source);
Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Component/Filesystem/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

7.0
---

* Add argument `$lock` to `Filesystem::appendToFile()`

5.4
---

Expand Down
4 changes: 1 addition & 3 deletions src/Symfony/Component/Filesystem/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ public function dumpFile(string $filename, $content)
*
* @throws IOException If the file is not writable
*/
public function appendToFile(string $filename, $content/* , bool $lock = false */)
public function appendToFile(string $filename, $content, bool $lock = false)
{
if (\is_array($content)) {
throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be string or resource, array given.', __METHOD__));
Expand All @@ -715,8 +715,6 @@ public function appendToFile(string $filename, $content/* , bool $lock = false *
$this->mkdir($dir);
}

$lock = \func_num_args() > 2 && func_get_arg(2);

if (false === self::box('file_put_contents', $filename, $content, \FILE_APPEND | ($lock ? \LOCK_EX : 0))) {
throw new IOException(sprintf('Failed to write file "%s": ', $filename).self::$lastError, 0, null, $filename);
}
Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Component/HttpKernel/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

7.0
---

* Add argument `$reflector` to `ArgumentResolverInterface::getArguments()` and `ArgumentMetadataFactoryInterface::createArgumentMetadata()`

6.4
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ interface ArgumentResolverInterface
/**
* Returns the arguments to pass to the controller.
*
* @param \ReflectionFunctionAbstract|null $reflector
*
* @throws \RuntimeException When no value could be provided for a required argument
*/
public function getArguments(Request $request, callable $controller/* , \ReflectionFunctionAbstract $reflector = null */): array;
public function getArguments(Request $request, callable $controller, \ReflectionFunctionAbstract $reflector = null): array;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@ public function __construct(ArgumentResolverInterface $resolver, Stopwatch $stop
$this->stopwatch = $stopwatch;
}

/**
* @param \ReflectionFunctionAbstract|null $reflector
*/
public function getArguments(Request $request, callable $controller/* , \ReflectionFunctionAbstract $reflector = null */): array
public function getArguments(Request $request, callable $controller, \ReflectionFunctionAbstract $reflector = null): array
{
$reflector = 2 < \func_num_args() ? func_get_arg(2) : null;
$e = $this->stopwatch->start('controller.get_arguments');

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
interface ArgumentMetadataFactoryInterface
{
/**
* @param \ReflectionFunctionAbstract|null $reflector
*
* @return ArgumentMetadata[]
*/
public function createArgumentMetadata(string|object|array $controller/* , \ReflectionFunctionAbstract $reflector = null */): array;
public function createArgumentMetadata(string|object|array $controller, \ReflectionFunctionAbstract $reflector = null): array;
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function testStopwatchEventIsStoppedWhenResolverThrows()
$stopwatch->method('start')->willReturn($stopwatchEvent);

$resolver = new class() implements ArgumentResolverInterface {
public function getArguments(Request $request, callable $controller): array
public function getArguments(Request $request, callable $controller, ?\ReflectionFunctionAbstract $reflector = null): array
{
throw new \Exception();
}
Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Component/PropertyAccess/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

7.0
---

* Add method `isNullSafe()` to `PropertyPathInterface`

6.3
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
*
* @author Bernhard Schussek <[email protected]>
*
* @method bool isNullSafe(int $index) Returns whether the element at the given index is null safe. Not implementing it is deprecated since Symfony 6.2
*
* @extends \Traversable<int, string>
*/
interface PropertyPathInterface extends \Traversable
Expand Down Expand Up @@ -85,4 +83,9 @@ public function isProperty(int $index);
* @throws Exception\OutOfBoundsException If the offset is invalid
*/
public function isIndex(int $index);

/**
* Returns whether the element at the given index is null safe.
*/
public function isNullSafe(int $index): bool;
}
5 changes: 5 additions & 0 deletions src/Symfony/Component/Routing/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

7.0
---

* Add argument `$routeParameters` to `UrlMatcher::handleRouteRequirements()`

6.4
---

Expand Down
13 changes: 1 addition & 12 deletions src/Symfony/Component/Routing/Matcher/UrlMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,19 +216,8 @@ protected function getAttributes(Route $route, string $name, array $attributes):
*
* @return array The first element represents the status, the second contains additional information
*/
protected function handleRouteRequirements(string $pathinfo, string $name, Route $route/* , array $routeParameters */): array
protected function handleRouteRequirements(string $pathinfo, string $name, Route $route, array $routeParameters): array
{
if (\func_num_args() < 4) {
trigger_deprecation('symfony/routing', '6.1', 'The "%s()" method will have a new "array $routeParameters" argument in version 7.0, not defining it is deprecated.', __METHOD__);
$routeParameters = [];
} else {
$routeParameters = func_get_arg(3);

if (!\is_array($routeParameters)) {
throw new \TypeError(sprintf('"%s": Argument $routeParameters is expected to be an array, got "%s".', __METHOD__, get_debug_type($routeParameters)));
}
}

// expression condition
if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), [
'context' => $this->context,
Expand Down
Loading