diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 6de23f226..32876142f 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -22,7 +22,7 @@ jobs:
fail-fast: false
matrix:
php-version:
- - '8.0'
+ - '8.1'
steps:
-
@@ -92,22 +92,19 @@ jobs:
php-version:
- '8.2'
symfony-version:
- - '5.4.*'
- - '5.4.x-dev'
- - '6.0.x-dev'
- - '6.1.x-dev'
- - '6.2.x-dev'
- '6.3.x-dev'
+ - '6.4.x-dev'
+ - '7.0.x-dev'
dependency-versions: ['highest']
allow-dev-deps-in-apps: ['0']
include:
- # testing lowest PHP version with LTS
- - php-version: '8.0.0'
- symfony-version: '5.4.*'
+ # testing lowest PHP+dependencies with lowest Symfony
+ - php-version: '8.1'
+ symfony-version: '6.3.*'
dependency-versions: 'lowest'
- # testing lowest php version with highest 5.x stable
- - php-version: '8.0.0'
- symfony-version: '5.4.*'
+ # testing lowest PHP+dependencies with highest Symfony
+ - php-version: '8.1'
+ symfony-version: '6.3.*'
dependency-versions: 'highest'
steps:
diff --git a/appveyor.yml b/appveyor.yml
index b5a37b99e..50fcfeaee 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -27,7 +27,7 @@ environment:
TEST_DATABASE_DSN: mysql://root:Password12!@127.0.0.1:3306/test_maker
matrix:
- dependencies: highest
- php_ver_target: 8.0.19
+ php_ver_target: 8.1.23
install:
- choco install sqlite --params "/NoTools"
diff --git a/composer.json b/composer.json
index ce58e6583..d9c34fa5f 100644
--- a/composer.json
+++ b/composer.json
@@ -13,28 +13,28 @@
],
"minimum-stability": "dev",
"require": {
- "php": ">=8.0",
+ "php": ">=8.1",
"doctrine/inflector": "^2.0",
"nikic/php-parser": "^4.11",
- "symfony/config": "^5.4.7|^6.0",
- "symfony/console": "^5.4.7|^6.0",
- "symfony/dependency-injection": "^5.4.7|^6.0",
+ "symfony/config": "^6.3|^7.0",
+ "symfony/console": "^6.3|^7.0",
+ "symfony/dependency-injection": "^6.3|^7.0",
"symfony/deprecation-contracts": "^2.2|^3",
- "symfony/filesystem": "^5.4.7|^6.0",
- "symfony/finder": "^5.4.3|^6.0",
- "symfony/framework-bundle": "^5.4.7|^6.0",
- "symfony/http-kernel": "^5.4.7|^6.0",
- "symfony/process": "^5.4.7|^6.0"
+ "symfony/filesystem": "^6.3|^7.0",
+ "symfony/finder": "^6.3|^7.0",
+ "symfony/framework-bundle": "^6.3|^7.0",
+ "symfony/http-kernel": "^6.3|^7.0",
+ "symfony/process": "^6.3|^7.0"
},
"require-dev": {
"composer/semver": "^3.0",
- "doctrine/doctrine-bundle": "^2.4",
+ "doctrine/doctrine-bundle": "^2.4.3",
"doctrine/orm": "^2.10.0",
- "symfony/http-client": "^5.4.7|^6.0",
- "symfony/phpunit-bridge": "^5.4.17|^6.0",
+ "symfony/http-client": "^6.3|^7.0",
+ "symfony/phpunit-bridge": "^6.3|^7.0",
"symfony/polyfill-php80": "^1.16.0",
- "symfony/security-core": "^5.4.7|^6.0",
- "symfony/yaml": "^5.4.3|^6.0",
+ "symfony/security-core": "^6.3|^7.0",
+ "symfony/yaml": "^6.3|^7.0",
"twig/twig": "^2.0|^3.0"
},
"config": {
@@ -43,8 +43,7 @@
},
"conflict": {
"doctrine/orm": "<2.10",
- "doctrine/doctrine-bundle": "<2.4",
- "symfony/doctrine-bridge": "<5.4"
+ "doctrine/doctrine-bundle": "<2.4"
},
"autoload": {
"psr-4": { "Symfony\\Bundle\\MakerBundle\\": "src/" }
@@ -54,7 +53,7 @@
},
"extra": {
"branch-alias": {
- "dev-main": "1.0-dev"
+ "dev-main": "1.x-dev"
}
}
}
diff --git a/src/Console/MigrationDiffFilteredOutput.php b/src/Console/MigrationDiffFilteredOutput.php
index a03a4d3a5..6f66f9273 100644
--- a/src/Console/MigrationDiffFilteredOutput.php
+++ b/src/Console/MigrationDiffFilteredOutput.php
@@ -14,38 +14,7 @@
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Output\OutputInterface;
-// look for the "string|iterable" type on OutputInterface::write()
-// @legacy - Use MigrationDiffFilteredOutput_php8 when Symfony 5.4 is no longer supported
-if (!(new \ReflectionMethod(OutputInterface::class, 'write'))->getParameters()[0]->getType()) {
- class MigrationDiffFilteredOutput implements OutputInterface
- {
- use BaseMakerMigrationDiffFilteredOuputTrait;
-
- public function write($messages, $newline = false, $options = 0)
- {
- $this->_write($messages, $newline, $options);
- }
-
- public function writeln($messages, $options = 0)
- {
- $this->_writeln($messages, $options);
- }
-
- public function setVerbosity($level)
- {
- $this->output->setVerbosity($level);
- }
-
- public function setDecorated($decorated)
- {
- $this->output->setDecorated($decorated);
- }
- }
-} else {
- require __DIR__.'/MigrationDiffFilteredOutput_php8';
-}
-
-trait BaseMakerMigrationDiffFilteredOuputTrait
+class MigrationDiffFilteredOutput implements OutputInterface
{
private string $buffer = '';
private bool $previousLineWasRemoved = false;
@@ -55,20 +24,30 @@ public function __construct(
) {
}
- public function _write($messages, bool $newline = false, $options = 0)
+ public function write($messages, bool $newline = false, $options = 0): void
{
$messages = $this->filterMessages($messages, $newline);
$this->output->write($messages, $newline, $options);
}
- public function _writeln($messages, int $options = 0)
+ public function writeln($messages, int $options = 0): void
{
$messages = $this->filterMessages($messages, true);
$this->output->writeln($messages, $options);
}
+ public function setVerbosity(int $level): void
+ {
+ $this->output->setVerbosity($level);
+ }
+
+ public function setDecorated(bool $decorated): void
+ {
+ $this->output->setDecorated($decorated);
+ }
+
public function getVerbosity(): int
{
return $this->output->getVerbosity();
@@ -99,7 +78,7 @@ public function isDecorated(): bool
return $this->output->isDecorated();
}
- public function setFormatter(OutputFormatterInterface $formatter)
+ public function setFormatter(OutputFormatterInterface $formatter): void
{
$this->output->setFormatter($formatter);
}
diff --git a/src/Console/MigrationDiffFilteredOutput_php8 b/src/Console/MigrationDiffFilteredOutput_php8
deleted file mode 100644
index d7c2a0e6a..000000000
--- a/src/Console/MigrationDiffFilteredOutput_php8
+++ /dev/null
@@ -1,39 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Bundle\MakerBundle\Console;
-
-use Symfony\Component\Console\Output\OutputInterface;
-
-class MigrationDiffFilteredOutput implements OutputInterface
-{
- use BaseMakerMigrationDiffFilteredOuputTrait;
-
- public function write($messages, bool $newline = false, $options = 0)
- {
- $this->_write($messages, $newline, $options);
- }
-
- public function writeln($messages, int $options = 0)
- {
- $this->_writeln($messages, $options);
- }
-
- public function setVerbosity(int $level)
- {
- $this->output->setVerbosity($level);
- }
-
- public function setDecorated(bool $decorated)
- {
- $this->output->setDecorated($decorated);
- }
-}
diff --git a/src/Doctrine/EntityClassGenerator.php b/src/Doctrine/EntityClassGenerator.php
index 5f5e2ae10..c7a2013b1 100644
--- a/src/Doctrine/EntityClassGenerator.php
+++ b/src/Doctrine/EntityClassGenerator.php
@@ -55,8 +55,7 @@ public function generateEntityClass(ClassNameDetails $entityClassDetails, bool $
}
if ($apiResource) {
- // @legacy Drop annotation class when annotations are no longer supported.
- $useStatements->addUseStatement(class_exists(ApiResource::class) ? ApiResource::class : \ApiPlatform\Core\Annotation\ApiResource::class);
+ $useStatements->addUseStatement(ApiResource::class);
}
$entityPath = $this->generator->generateClass(
diff --git a/src/Doctrine/EntityDetails.php b/src/Doctrine/EntityDetails.php
index d0aa63e29..d0b39e30f 100644
--- a/src/Doctrine/EntityDetails.php
+++ b/src/Doctrine/EntityDetails.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\MakerBundle\Doctrine;
-use Doctrine\Common\Persistence\Mapping\ClassMetadata as LegacyClassMetadata;
use Doctrine\Persistence\Mapping\ClassMetadata;
/**
@@ -22,7 +21,7 @@
final class EntityDetails
{
public function __construct(
- private ClassMetadata|LegacyClassMetadata $metadata,
+ private ClassMetadata $metadata,
) {
}
diff --git a/src/Doctrine/EntityRegenerator.php b/src/Doctrine/EntityRegenerator.php
index f717a2456..8dee3eabe 100644
--- a/src/Doctrine/EntityRegenerator.php
+++ b/src/Doctrine/EntityRegenerator.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\MakerBundle\Doctrine;
-use Doctrine\Common\Persistence\Mapping\MappingException as LegacyCommonMappingException;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\MappingException;
use Doctrine\Persistence\Mapping\MappingException as PersistenceMappingException;
@@ -38,7 +37,7 @@ public function regenerateEntities(string $classOrNamespace): void
{
try {
$metadata = $this->doctrineHelper->getMetadata($classOrNamespace);
- } catch (MappingException|LegacyCommonMappingException|PersistenceMappingException) {
+ } catch (MappingException|PersistenceMappingException) {
$metadata = $this->doctrineHelper->getMetadata($classOrNamespace, true);
}
diff --git a/src/EventRegistry.php b/src/EventRegistry.php
index 81df2a90f..b92255dc7 100644
--- a/src/EventRegistry.php
+++ b/src/EventRegistry.php
@@ -14,7 +14,6 @@
use Symfony\Component\Console\Event\ConsoleCommandEvent;
use Symfony\Component\Console\Event\ConsoleErrorEvent;
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
-use Symfony\Component\EventDispatcher\Event as LegacyEvent;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpKernel\Event\ControllerArgumentsEvent;
use Symfony\Component\HttpKernel\Event\ControllerEvent;
@@ -35,7 +34,6 @@
use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent;
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
use Symfony\Component\Security\Http\Event\SwitchUserEvent;
-use Symfony\Contracts\EventDispatcher\Event;
/**
* @internal
@@ -148,11 +146,7 @@ public function getEventClassName(string $event): ?string
}
if (null !== $type = $args[0]->getType()) {
- $type = $type instanceof \ReflectionNamedType ? $type->getName() : $type->__toString();
-
- if (LegacyEvent::class === $type && class_exists(Event::class)) {
- return Event::class;
- }
+ $type = $type instanceof \ReflectionNamedType ? $type->getName() : null;
// ignore an "object" type-hint
if ('object' === $type) {
diff --git a/src/FileManager.php b/src/FileManager.php
index d70c7b24d..8a824dce9 100644
--- a/src/FileManager.php
+++ b/src/FileManager.php
@@ -194,6 +194,7 @@ private function realPath(string $absolutePath): string
}
$finalPath = implode('/', $finalParts);
+
// Normalize: // => /
// Normalize: /./ => /
return str_replace(['//', '/./'], '/', $finalPath);
diff --git a/src/Maker/MakeAuthenticator.php b/src/Maker/MakeAuthenticator.php
index 6ece8be19..680d719d3 100644
--- a/src/Maker/MakeAuthenticator.php
+++ b/src/Maker/MakeAuthenticator.php
@@ -28,7 +28,6 @@
use Symfony\Bundle\MakerBundle\Util\YamlManipulationFailedException;
use Symfony\Bundle\MakerBundle\Util\YamlSourceManipulator;
use Symfony\Bundle\MakerBundle\Validator;
-use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Bundle\SecurityBundle\SecurityBundle;
use Symfony\Bundle\TwigBundle\TwigBundle;
use Symfony\Component\Console\Command\Command;
@@ -43,8 +42,6 @@
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
-use Symfony\Component\Security\Core\Security as LegacySecurity;
-use Symfony\Component\Security\Guard\AuthenticatorInterface as GuardAuthenticatorInterface;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
use Symfony\Component\Security\Http\Authenticator\AbstractAuthenticator;
use Symfony\Component\Security\Http\Authenticator\AbstractLoginFormAuthenticator;
@@ -53,6 +50,7 @@
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials;
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
+use Symfony\Component\Security\Http\SecurityRequestAttributes;
use Symfony\Component\Security\Http\Util\TargetPathTrait;
use Symfony\Component\Yaml\Yaml;
@@ -103,11 +101,6 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
$manipulator = new YamlSourceManipulator($this->fileManager->getFileContents($path));
$securityData = $manipulator->getData();
- // @legacy - Can be removed when Symfony 5.4 support is dropped
- if (interface_exists(GuardAuthenticatorInterface::class) && !($securityData['security']['enable_authenticator_manager'] ?? false)) {
- throw new RuntimeCommandException('MakerBundle only supports the new authenticator based security system. See https://symfony.com/doc/current/security.html');
- }
-
// authenticator type
$authenticatorTypeValues = [
'Empty authenticator' => self::AUTH_TYPE_EMPTY_AUTHENTICATOR,
@@ -320,15 +313,9 @@ private function generateAuthenticatorClass(array $securityData, string $authent
UserBadge::class,
PasswordCredentials::class,
TargetPathTrait::class,
+ SecurityRequestAttributes::class,
]);
- // @legacy - Can be removed when Symfony 5.4 support is dropped
- if (class_exists(Security::class)) {
- $useStatements->addUseStatement(Security::class);
- } else {
- $useStatements->addUseStatement(LegacySecurity::class);
- }
-
if ($supportRememberMe) {
$useStatements->addUseStatement(RememberMeBadge::class);
}
diff --git a/src/Maker/MakeCrud.php b/src/Maker/MakeCrud.php
index 5e4ab7f62..0a1719615 100644
--- a/src/Maker/MakeCrud.php
+++ b/src/Maker/MakeCrud.php
@@ -16,8 +16,6 @@
use Doctrine\Inflector\InflectorFactory;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
-use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
-use Symfony\Bridge\Doctrine\ArgumentResolver\EntityValueResolver;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -38,7 +36,6 @@
use Symfony\Component\Form\AbstractType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
-use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Csrf\CsrfTokenManager;
use Symfony\Component\Validator\Validation;
@@ -184,8 +181,6 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
'entity_var_singular' => $entityVarSingular,
'entity_twig_var_singular' => $entityTwigVarSingular,
'entity_identifier' => $entityDoctrineDetails->getIdentifier(),
- // @legacy - Remove when support for Symfony <6 is dropped
- 'use_render_form' => Kernel::VERSION_ID < 60200,
],
$repositoryVars
)
@@ -327,12 +322,5 @@ public function configureDependencies(DependencyBuilder $dependencies): void
CsrfTokenManager::class,
'security-csrf'
);
-
- // @legacy - Remove dependency when support for Symfony <6.2 is dropped
- $dependencies->addClassDependency(
- ParamConverter::class,
- 'annotations',
- !class_exists(EntityValueResolver::class) // sensio/framework-extra-bundle dependency is not required when using symfony 6.2+
- );
}
}
diff --git a/src/Maker/MakeEntity.php b/src/Maker/MakeEntity.php
index 88cc107e1..83fefd0a7 100644
--- a/src/Maker/MakeEntity.php
+++ b/src/Maker/MakeEntity.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\MakerBundle\Maker;
-use ApiPlatform\Core\Annotation\ApiResource as LegacyApiResource;
use ApiPlatform\Metadata\ApiResource;
use Doctrine\DBAL\Types\Type;
use Symfony\Bundle\MakerBundle\ConsoleStyle;
@@ -21,7 +20,6 @@
use Symfony\Bundle\MakerBundle\Doctrine\EntityRegenerator;
use Symfony\Bundle\MakerBundle\Doctrine\EntityRelation;
use Symfony\Bundle\MakerBundle\Doctrine\ORMDependencyBuilder;
-use Symfony\Bundle\MakerBundle\Exception\RuntimeCommandException;
use Symfony\Bundle\MakerBundle\FileManager;
use Symfony\Bundle\MakerBundle\Generator;
use Symfony\Bundle\MakerBundle\InputAwareMakerInterface;
@@ -135,7 +133,7 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
if (
!$input->getOption('api-resource')
- && (class_exists(ApiResource::class) || class_exists(LegacyApiResource::class))
+ && class_exists(ApiResource::class)
&& !class_exists($this->generator->createClassNameDetails($entityClassName, 'Entity\\')->getFullName())
) {
$description = $command->getDefinition()->getOption('api-resource')->getDescription();
@@ -201,10 +199,6 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
$generator->writeChanges();
}
- if (!$this->doesEntityUseAttributeMapping($entityClassDetails->getFullName())) {
- throw new RuntimeCommandException(sprintf('Only attribute mapping is supported by make:entity, but the %s class uses a different format. If you would like this command to generate the properties & getter/setter methods, add your mapping configuration, and then re-run this command with the --regenerate flag.', $entityClassDetails->getFullName()));
- }
-
if ($classExists) {
$entityPath = $this->getPathOfClass($entityClassDetails->getFullName());
$io->text([
@@ -319,17 +313,10 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
public function configureDependencies(DependencyBuilder $dependencies, InputInterface $input = null): void
{
if (null !== $input && $input->getOption('api-resource')) {
- if (class_exists(ApiResource::class)) {
- $dependencies->addClassDependency(
- ApiResource::class,
- 'api'
- );
- } else {
- $dependencies->addClassDependency(
- LegacyApiResource::class,
- 'api'
- );
- }
+ $dependencies->addClassDependency(
+ ApiResource::class,
+ 'api'
+ );
}
if (null !== $input && $input->getOption('broadcast')) {
@@ -846,23 +833,6 @@ private function getPropertyNames(string $class): array
return array_map(static fn (\ReflectionProperty $prop) => $prop->getName(), $reflClass->getProperties());
}
- /** @legacy Drop when Annotations are no longer supported */
- private function doesEntityUseAttributeMapping(string $className): bool
- {
- if (!class_exists($className)) {
- $otherClassMetadatas = $this->doctrineHelper->getMetadata(Str::getNamespace($className).'\\', true);
-
- // if we have no metadata, we should assume this is the first class being mapped
- if (empty($otherClassMetadatas)) {
- return false;
- }
-
- $className = reset($otherClassMetadatas)->getName();
- }
-
- return $this->doctrineHelper->doesClassUsesAttributes($className);
- }
-
private function getEntityNamespace(): string
{
return $this->doctrineHelper->getEntityNamespace();
@@ -870,13 +840,6 @@ private function getEntityNamespace(): string
private function getTypesMap(): array
{
- $types = Type::getTypesMap();
-
- // remove deprecated json_array if it exists
- if (\defined(sprintf('%s::JSON_ARRAY', Type::class))) {
- unset($types[Type::JSON_ARRAY]);
- }
-
- return $types;
+ return Type::getTypesMap();
}
}
diff --git a/src/Maker/MakeFixtures.php b/src/Maker/MakeFixtures.php
index f276e2c77..d7be1fb85 100644
--- a/src/Maker/MakeFixtures.php
+++ b/src/Maker/MakeFixtures.php
@@ -12,13 +12,13 @@
namespace Symfony\Bundle\MakerBundle\Maker;
use Doctrine\Bundle\FixturesBundle\Fixture;
-use Doctrine\Common\Persistence\ObjectManager as LegacyObjectManager;
use Doctrine\ORM\Mapping\Column;
use Doctrine\Persistence\ObjectManager;
use Symfony\Bundle\MakerBundle\ConsoleStyle;
use Symfony\Bundle\MakerBundle\DependencyBuilder;
use Symfony\Bundle\MakerBundle\Generator;
use Symfony\Bundle\MakerBundle\InputConfiguration;
+use Symfony\Bundle\MakerBundle\Util\UseStatementGenerator;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@@ -54,11 +54,16 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
'DataFixtures\\'
);
+ $useStatements = new UseStatementGenerator([
+ Fixture::class => null,
+ ObjectManager::class => null,
+ ]);
+
$generator->generateClass(
$fixturesClassNameDetails->getFullName(),
'doctrine/Fixtures.tpl.php',
[
- 'object_manager_class' => interface_exists(ObjectManager::class) ? ObjectManager::class : LegacyObjectManager::class,
+ 'use_statements' => $useStatements,
]
);
diff --git a/src/Maker/MakeMessage.php b/src/Maker/MakeMessage.php
index 1a2442014..32a5fd3f6 100644
--- a/src/Maker/MakeMessage.php
+++ b/src/Maker/MakeMessage.php
@@ -21,7 +21,7 @@
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
-use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
+use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\MessageBusInterface;
/**
@@ -103,7 +103,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
);
$useStatements = new UseStatementGenerator([
- MessageHandlerInterface::class,
+ AsMessageHandler::class,
$messageClassNameDetails->getFullName(),
]);
diff --git a/src/Maker/MakeRegistrationForm.php b/src/Maker/MakeRegistrationForm.php
index f084a6fc2..b0862364f 100644
--- a/src/Maker/MakeRegistrationForm.php
+++ b/src/Maker/MakeRegistrationForm.php
@@ -49,7 +49,6 @@
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\User\UserInterface;
-use Symfony\Component\Security\Guard\AuthenticatorInterface as GuardAuthenticatorInterface;
use Symfony\Component\Security\Http\Authentication\UserAuthenticatorInterface;
use Symfony\Component\Translation\Translator;
use Symfony\Component\Validator\Validation;
@@ -80,7 +79,6 @@ final class MakeRegistrationForm extends AbstractMaker
private $firewallName;
private $redirectRouteName;
private $addUniqueEntityConstraint;
- private $useNewAuthenticatorSystem = false;
public function __construct(
private FileManager $fileManager,
@@ -123,12 +121,6 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
$securityData = $manipulator->getData();
$providersData = $securityData['security']['providers'] ?? [];
- // Determine if we should use new security features introduced in Symfony 5.2
- // @legacy - Can be removed when Symfony 5.4 support is dropped
- if (!interface_exists(GuardAuthenticatorInterface::class) || ($securityData['security']['enable_authenticator_manager'] ?? false)) {
- $this->useNewAuthenticatorSystem = true;
- }
-
$this->userClass = $interactiveSecurityHelper->guessUserClass(
$io,
$providersData,
@@ -349,12 +341,9 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
'email_getter' => $this->emailGetter,
'authenticator_class_name' => $this->autoLoginAuthenticator ? Str::getShortClassName($this->autoLoginAuthenticator) : null,
'authenticator_full_class_name' => $this->autoLoginAuthenticator,
- 'use_new_authenticator_system' => $this->useNewAuthenticatorSystem,
'firewall_name' => $this->firewallName,
'redirect_route_name' => $this->redirectRouteName,
- 'password_hasher_class_details' => ($passwordClassDetails = $generator->createClassNameDetails(UserPasswordHasherInterface::class, '\\')),
- 'password_hasher_variable_name' => str_replace('Interface', '', sprintf('$%s', lcfirst($passwordClassDetails->getShortName()))), // @legacy see passwordHasher conditional above
- 'use_password_hasher' => true,
+ 'password_hasher_class_details' => $generator->createClassNameDetails(UserPasswordHasherInterface::class, '\\'),
'translator_available' => $isTranslatorAvailable,
],
$userRepoVars
diff --git a/src/Maker/MakeTest.php b/src/Maker/MakeTest.php
index 78701d6e8..0c7ae8661 100644
--- a/src/Maker/MakeTest.php
+++ b/src/Maker/MakeTest.php
@@ -11,9 +11,7 @@
namespace Symfony\Bundle\MakerBundle\Maker;
-use ApiPlatform\Core\Bridge\Symfony\Bundle\Test\ApiTestCase as LegacyApiTestCase;
use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
-use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Bundle\FrameworkBundle\Test\WebTestAssertionsTrait;
use Symfony\Bundle\MakerBundle\ConsoleStyle;
use Symfony\Bundle\MakerBundle\DependencyBuilder;
@@ -104,7 +102,7 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
);
}
- if ('ApiTestCase' === $input->getArgument('type') && !class_exists(ApiTestCase::class) && !class_exists(LegacyApiTestCase::class)) {
+ if ('ApiTestCase' === $input->getArgument('type') && !class_exists(ApiTestCase::class)) {
$io->warning([
'API Platform is required for this test type. Install it with',
'composer require api',
@@ -148,7 +146,6 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
"test/$type.tpl.php",
[
'web_assertions_are_available' => trait_exists(WebTestAssertionsTrait::class),
- 'use_legacy_container_property' => $this->useLegacyContainerProperty(),
'api_test_case_fqcn' => !class_exists(ApiTestCase::class) ? LegacyApiTestCase::class : ApiTestCase::class,
]
);
@@ -226,10 +223,4 @@ private function handleDeprecatedMakerCommands(InputInterface $input, ConsoleSty
break;
}
}
-
- private function useLegacyContainerProperty(): bool
- {
- // for 5.2 and lower
- return !method_exists(KernelTestCase::class, 'getContainer');
- }
}
diff --git a/src/Resources/skeleton/authenticator/LoginFormAuthenticator.tpl.php b/src/Resources/skeleton/authenticator/LoginFormAuthenticator.tpl.php
index eb0f17219..8c5ac0830 100644
--- a/src/Resources/skeleton/authenticator/LoginFormAuthenticator.tpl.php
+++ b/src/Resources/skeleton/authenticator/LoginFormAuthenticator.tpl.php
@@ -18,7 +18,7 @@ public function authenticate(Request $request): Passport
{
$= $username_field_var ?> = $request->request->get('= $username_field ?>', '');
- $request->getSession()->set(Security::LAST_USERNAME, $= $username_field_var ?>);
+ $request->getSession()->set(SecurityRequestAttributes::LAST_USERNAME, $= $username_field_var ?>);
return new Passport(
new UserBadge($= $username_field_var ?>),
diff --git a/src/Resources/skeleton/crud/controller/Controller.tpl.php b/src/Resources/skeleton/crud/controller/Controller.tpl.php
index 3500f9f19..1248998a8 100644
--- a/src/Resources/skeleton/crud/controller/Controller.tpl.php
+++ b/src/Resources/skeleton/crud/controller/Controller.tpl.php
@@ -42,17 +42,10 @@ public function new(Request $request, EntityManagerInterface $entityManager): Re
return $this->redirectToRoute('= $route_name ?>_index', [], Response::HTTP_SEE_OTHER);
}
-
- return $this->renderForm('= $templates_path ?>/new.html.twig', [
- '= $entity_twig_var_singular ?>' => $= $entity_var_singular ?>,
- 'form' => $form,
- ]);
-
return $this->render('= $templates_path ?>/new.html.twig', [
'= $entity_twig_var_singular ?>' => $= $entity_var_singular ?>,
'form' => $form,
]);
-
}
= $generator->generateRouteForControllerMethod(sprintf('/{%s}', $entity_identifier), sprintf('%s_show', $route_name), ['GET']) ?>
@@ -75,17 +68,10 @@ public function edit(Request $request, = $entity_class_name ?> $= $entity_va
return $this->redirectToRoute('= $route_name ?>_index', [], Response::HTTP_SEE_OTHER);
}
-
- return $this->renderForm('= $templates_path ?>/edit.html.twig', [
- '= $entity_twig_var_singular ?>' => $= $entity_var_singular ?>,
- 'form' => $form,
- ]);
-
return $this->render('= $templates_path ?>/edit.html.twig', [
'= $entity_twig_var_singular ?>' => $= $entity_var_singular ?>,
'form' => $form,
]);
-
}
= $generator->generateRouteForControllerMethod(sprintf('/{%s}', $entity_identifier), sprintf('%s_delete', $route_name), ['POST']) ?>
diff --git a/src/Resources/skeleton/doctrine/Fixtures.tpl.php b/src/Resources/skeleton/doctrine/Fixtures.tpl.php
index a77ecff77..35eaa0704 100644
--- a/src/Resources/skeleton/doctrine/Fixtures.tpl.php
+++ b/src/Resources/skeleton/doctrine/Fixtures.tpl.php
@@ -2,8 +2,7 @@
namespace = $namespace; ?>;
-use Doctrine\Bundle\FixturesBundle\Fixture;
-use = $object_manager_class; ?>;
+= $use_statements; ?>;
class = $class_name ?> extends Fixture
{
diff --git a/src/Resources/skeleton/message/MessageHandler.tpl.php b/src/Resources/skeleton/message/MessageHandler.tpl.php
index e9da0d26b..1164c960c 100644
--- a/src/Resources/skeleton/message/MessageHandler.tpl.php
+++ b/src/Resources/skeleton/message/MessageHandler.tpl.php
@@ -4,7 +4,8 @@
= $use_statements; ?>
-final class = $class_name ?> implements MessageHandlerInterface
+#[AsMessageHandler]
+final class = $class_name ?>
{
public function __invoke(= $message_class_name ?> $message)
{
diff --git a/src/Resources/skeleton/registration/RegistrationController.tpl.php b/src/Resources/skeleton/registration/RegistrationController.tpl.php
index 904ba6a90..3d45a8cb6 100644
--- a/src/Resources/skeleton/registration/RegistrationController.tpl.php
+++ b/src/Resources/skeleton/registration/RegistrationController.tpl.php
@@ -16,7 +16,7 @@ public function __construct(= $email_verifier_class_details->getShortName() ?>
= $generator->generateRouteForControllerMethod($route_path, $route_name) ?>
- public function register(Request $request, = $password_hasher_class_details->getShortName() ?> = $password_hasher_variable_name ?>= $authenticator_full_class_name ? sprintf(', %s %s, %s $authenticator', ($use_new_authenticator_system ? 'UserAuthenticatorInterface' : 'GuardAuthenticatorHandler'), ($use_new_authenticator_system ? '$userAuthenticator' : '$guardHandler'), $authenticator_class_name) : '' ?>, EntityManagerInterface $entityManager): Response
+ public function register(Request $request, = $password_hasher_class_details->getShortName() ?> $userPasswordHasher= $authenticator_full_class_name ? sprintf(', UserAuthenticatorInterface $userAuthenticator, %s $authenticator', $authenticator_class_name) : '' ?>, EntityManagerInterface $entityManager): Response
{
$user = new = $user_class_name ?>();
$form = $this->createForm(= $form_class_name ?>::class, $user);
@@ -25,7 +25,7 @@ public function register(Request $request, = $password_hasher_class_details->g
if ($form->isSubmitted() && $form->isValid()) {
// encode the plain password
$user->set= ucfirst($password_field) ?>(
- = $password_hasher_variable_name ?>->= $use_password_hasher ? 'hashPassword' : 'encodePassword' ?>(
+ $userPasswordHasher->hashPassword(
$user,
$form->get('plainPassword')->getData()
)
@@ -47,20 +47,11 @@ public function register(Request $request, = $password_hasher_class_details->g
// do anything else you need here, like send an email
-
return $userAuthenticator->authenticateUser(
$user,
$authenticator,
$request
);
-
- return $guardHandler->authenticateUserAndHandleSuccess(
- $user,
- $request,
- $authenticator,
- '= $firewall_name; ?>' // firewall name in security.yaml
- );
-
return $this->redirectToRoute('= $redirect_route_name ?>');
diff --git a/src/Resources/skeleton/test/KernelTestCase.tpl.php b/src/Resources/skeleton/test/KernelTestCase.tpl.php
index e207ab441..808f6a0c0 100644
--- a/src/Resources/skeleton/test/KernelTestCase.tpl.php
+++ b/src/Resources/skeleton/test/KernelTestCase.tpl.php
@@ -11,7 +11,7 @@ public function testSomething(): void
$kernel = self::bootKernel();
$this->assertSame('test', $kernel->getEnvironment());
- // $routerService = = $use_legacy_container_property ? 'self::$container' : 'static::getContainer()'; ?>->get('router');
- // $myCustomService = = $use_legacy_container_property ? 'self::$container' : 'static::getContainer()'; ?>->get(CustomService::class);
+ // $routerService = static::getContainer()->get('router');
+ // $myCustomService = static::getContainer()->get(CustomService::class);
}
}
diff --git a/src/Security/UserClassBuilder.php b/src/Security/UserClassBuilder.php
index 4f6e4b265..376879f11 100644
--- a/src/Security/UserClassBuilder.php
+++ b/src/Security/UserClassBuilder.php
@@ -13,7 +13,6 @@
use PhpParser\Node;
use Symfony\Bundle\MakerBundle\Util\ClassSourceManipulator;
-use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
@@ -39,13 +38,6 @@ public function addUserInterfaceImplementation(ClassSourceManipulator $manipulat
private function addPasswordImplementation(ClassSourceManipulator $manipulator, UserClassConfiguration $userClassConfig): void
{
- // @legacy Drop conditional when Symfony 5.4 is no longer supported
- if (60000 > Kernel::VERSION_ID) {
- // Add methods required to fulfill the UserInterface contract
- $this->addGetPassword($manipulator, $userClassConfig);
- $this->addGetSalt($manipulator, $userClassConfig);
- }
-
if (!$userClassConfig->hasPassword()) {
return;
}
@@ -100,19 +92,6 @@ private function addGetUsername(ClassSourceManipulator $manipulator, UserClassCo
],
true
);
-
- // @legacy Drop when Symfony 5.4 is no longer supported.
- if (method_exists(UserInterface::class, 'getSalt')) {
- // also add the deprecated getUsername method
- $manipulator->addAccessorMethod(
- $userClassConfig->getIdentityPropertyName(),
- 'getUsername',
- 'string',
- false,
- ['@deprecated since Symfony 5.3, use getUserIdentifier instead'],
- true
- );
- }
}
private function addGetRoles(ClassSourceManipulator $manipulator, UserClassConfiguration $userClassConfig): void
@@ -261,44 +240,6 @@ private function addGetPassword(ClassSourceManipulator $manipulator, UserClassCo
);
}
- private function addGetSalt(ClassSourceManipulator $manipulator, UserClassConfiguration $userClassConfig): void
- {
- if ($userClassConfig->hasPassword()) {
- $methodDescription = [
- 'Returning a salt is only needed, if you are not using a modern',
- 'hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.',
- ];
- } else {
- $methodDescription = [
- 'This method can be removed in Symfony 6.0 - is not needed for apps that do not check user passwords.',
- ];
- }
-
- // add getSalt(): ?string - always returning null
- $builder = $manipulator->createMethodBuilder(
- 'getSalt',
- 'string',
- true,
- array_merge(
- $methodDescription,
- [
- '',
- '@see UserInterface',
- ]
- )
- );
-
- $builder->addStmt(
- new Node\Stmt\Return_(
- new Node\Expr\ConstFetch(
- new Node\Name('null')
- )
- )
- );
-
- $manipulator->addMethodBuilder($builder);
- }
-
private function addEraseCredentials(ClassSourceManipulator $manipulator): void
{
// add eraseCredentials: always empty
diff --git a/src/Test/MakerTestCase.php b/src/Test/MakerTestCase.php
index f2f4175f3..3584250d1 100644
--- a/src/Test/MakerTestCase.php
+++ b/src/Test/MakerTestCase.php
@@ -54,12 +54,12 @@ protected function executeMakerCommand(MakerTestDetails $testDetails)
$this->markTestSkipped();
}
- if ($testDetails->skipOnWindows() && '\\' === \DIRECTORY_SEPARATOR) {
- $this->markTestSkipped('This test is not supported on Windows');
- }
-
$testEnv = MakerTestEnvironment::create($testDetails);
+ if ('7.0.x-dev' === $testEnv->getTargetSkeletonVersion() && $testDetails->getSkipOnSymfony7()) {
+ $this->markTestSkipped('This test is skipped on Symfony 7');
+ }
+
// prepare environment to test
$testEnv->prepareDirectory();
diff --git a/src/Test/MakerTestDetails.php b/src/Test/MakerTestDetails.php
index 3b3a51b78..16bdadec2 100644
--- a/src/Test/MakerTestDetails.php
+++ b/src/Test/MakerTestDetails.php
@@ -24,7 +24,7 @@ final class MakerTestDetails
private array $requiredPackageVersions = [];
private int $blockedPhpVersionUpper = 0;
private int $blockedPhpVersionLower = 0;
- private bool $skipOnWindows = false;
+ private bool $skipOnSymfony7 = false;
public function __construct(
private MakerInterface $maker,
@@ -177,10 +177,15 @@ public function getPreRunCallbacks(): array
return $this->preRunCallbacks;
}
- public function skipOnWindows(): self
+ public function skipOnSymfony7(): self
{
- $this->skipOnWindows = true;
+ $this->skipOnSymfony7 = true;
return $this;
}
+
+ public function getSkipOnSymfony7(): bool
+ {
+ return $this->skipOnSymfony7;
+ }
}
diff --git a/src/Test/MakerTestEnvironment.php b/src/Test/MakerTestEnvironment.php
index ed8ed58f8..1cbb762a1 100644
--- a/src/Test/MakerTestEnvironment.php
+++ b/src/Test/MakerTestEnvironment.php
@@ -157,8 +157,18 @@ public function prepareDirectory(): void
// install any missing dependencies
$dependencies = $this->determineMissingDependencies();
if ($dependencies) {
- MakerTestProcess::create(sprintf('composer require %s', implode(' ', $dependencies)), $this->path)
- ->run();
+ // -v actually silences the "very" verbose output in case of an error
+ $composerProcess = MakerTestProcess::create(sprintf('composer require %s -v', implode(' ', $dependencies)), $this->path);
+
+ // @legacy Temporary code until doctrine/dbal 3.7 is out (which supports symfony/console 7.0
+ $composerProcess->run(true);
+ if (!$composerProcess->isSuccessful()) {
+ if (str_contains($composerProcess->getErrorOutput(), 'Declaration of Doctrine\DBAL\Tools\Console\Command\RunSqlCommand::execute')) {
+ $this->patchDoctrineDbalForSymfony7();
+ } else {
+ throw new \Exception(sprintf('Error running command: composer require %s -v. Output: "%s". Error: "%s"', implode(' ', $dependencies), $composerProcess->getOutput(), $composerProcess->getErrorOutput()));
+ }
+ }
}
$this->changeRootNamespaceIfNeeded();
@@ -175,6 +185,7 @@ public function prepareDirectory(): void
}
} else {
MakerTestProcess::create('git reset --hard && git clean -fd', $this->path)->run();
+ $this->fs->remove($this->path.'/var/cache');
}
}
@@ -395,7 +406,7 @@ private function determineMissingDependencies(): array
return array_merge($data, $this->testDetails->getExtraDependencies());
}
- private function getTargetSkeletonVersion(): ?string
+ public function getTargetSkeletonVersion(): ?string
{
return $_SERVER['SYMFONY_VERSION'] ?? '';
}
@@ -438,4 +449,22 @@ private function addMakerBundleRepoToComposer(string $composerJsonPath): void
file_put_contents($composerJsonPath, json_encode($composerJson, \JSON_THROW_ON_ERROR | \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES));
}
+
+ private function patchDoctrineDbalForSymfony7(): void
+ {
+ $commandPath = $this->path.'/vendor/doctrine/dbal/src/Tools/Console/Command/RunSqlCommand.php';
+ $contents = file_get_contents($commandPath);
+
+ $needle = 'protected function execute(InputInterface $input, OutputInterface $output)';
+ if (str_contains($contents, $needle.': int')) {
+ return;
+ }
+
+ $contents = str_replace(
+ $needle,
+ $needle.': int',
+ $contents
+ );
+ file_put_contents($commandPath, $contents);
+ }
}
diff --git a/src/Test/MakerTestKernel.php b/src/Test/MakerTestKernel.php
index 84ab7f15d..1938dfecd 100644
--- a/src/Test/MakerTestKernel.php
+++ b/src/Test/MakerTestKernel.php
@@ -58,6 +58,10 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load
'utf8' => true,
],
'http_method_override' => false,
+ 'handle_all_throwables' => true,
+ 'php_errors' => [
+ 'log' => true,
+ ],
]);
}
diff --git a/src/Test/MakerTestRunner.php b/src/Test/MakerTestRunner.php
index b95562bfc..3749f0345 100644
--- a/src/Test/MakerTestRunner.php
+++ b/src/Test/MakerTestRunner.php
@@ -171,14 +171,6 @@ public function configureDatabase(bool $createSchema = true): void
return $config;
});
- // @legacy DoctrineBundle 2.4 recipe uses when@test instead of a test/doctrine.yaml config
- if ($this->filesystem->exists('config/packages/test/doctrine.yaml')) {
- $this->removeFromFile(
- 'config/packages/test/doctrine.yaml',
- "dbname_suffix: '_test%env(default::TEST_TOKEN)%'"
- );
- }
-
// this looks silly, but it's the only way to drop the database *for sure*,
// as doctrine:database:drop will error if there is no database
// also, skip for SQLITE, as it does not support --if-not-exists
diff --git a/src/Validator.php b/src/Validator.php
index 06b5890f4..95c2a5445 100644
--- a/src/Validator.php
+++ b/src/Validator.php
@@ -11,7 +11,6 @@
namespace Symfony\Bundle\MakerBundle;
-use Doctrine\Common\Persistence\ManagerRegistry as LegacyManagerRegistry;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\MakerBundle\Exception\RuntimeCommandException;
use Symfony\Component\Security\Core\User\UserInterface;
@@ -156,7 +155,7 @@ public static function validatePropertyName(string $name): string
return $name;
}
- public static function validateDoctrineFieldName(string $name, ManagerRegistry|LegacyManagerRegistry $registry): string
+ public static function validateDoctrineFieldName(string $name, ManagerRegistry $registry): string
{
// check reserved words
if ($registry->getConnection()->getDatabasePlatform()->getReservedKeywordsList()->isKeyword($name)) {
diff --git a/tests/Command/MakerCommandTest.php b/tests/Command/MakerCommandTest.php
index 17a17aff6..06aa9823d 100644
--- a/tests/Command/MakerCommandTest.php
+++ b/tests/Command/MakerCommandTest.php
@@ -59,11 +59,6 @@ public function testExceptionOnUnknownRootNamespace(): void
$tester = new CommandTester($command);
$tester->execute([]);
- if (method_exists(self::class, 'assertStringContainsString')) {
- self::assertStringContainsString('using a namespace other than "Unknown"', $tester->getDisplay());
- } else {
- // legacy for older phpunit versions (e.g. older php version on CI)
- self::assertContains('using a namespace other than "Unknown"', $tester->getDisplay());
- }
+ self::assertStringContainsString('using a namespace other than "Unknown"', $tester->getDisplay());
}
}
diff --git a/tests/Docker/DatabaseServicesTest.php b/tests/Docker/DatabaseServicesTest.php
index 38e35f9cf..1888cef9e 100644
--- a/tests/Docker/DatabaseServicesTest.php
+++ b/tests/Docker/DatabaseServicesTest.php
@@ -43,7 +43,7 @@ public function testSkeletonReturnArrayForDesiredDatabase(string $databaseName):
$result = DockerDatabaseServices::getDatabaseSkeleton($databaseName, 'latest');
self::assertArrayHasKey('image', $result);
- $this->assertStringContainsIgnoringCase($databaseName, $result['image']);
+ self::assertStringContainsStringIgnoringCase($databaseName, $result['image']);
}
/**
@@ -65,14 +65,4 @@ public function testSuggestedVersion(string $databaseName): void
('postgres' === strtolower($databaseName)) ? self::assertSame('alpine', $result) : self::assertSame('latest', $result);
}
-
- private function assertStringContainsIgnoringCase(string $needle, string $haystack): void
- {
- if (method_exists(self::class, 'assertStringContainsString')) {
- self::assertStringContainsStringIgnoringCase($needle, $haystack);
- } else {
- // legacy for older phpunit versions (e.g. older php version on CI)
- self::assertContains(strtolower($needle), strtolower($haystack));
- }
- }
}
diff --git a/tests/Maker/MakeAuthenticatorTest.php b/tests/Maker/MakeAuthenticatorTest.php
index 2e9fc0f79..c501bc7fc 100644
--- a/tests/Maker/MakeAuthenticatorTest.php
+++ b/tests/Maker/MakeAuthenticatorTest.php
@@ -350,15 +350,9 @@ private function runLoginTest(MakerTestRunner $runner, string $userIdentifier, b
'isEntity' => $isEntity,
'userClass' => $userClass,
'testLogin' => $testLogin,
- 'useLegacyContainerProperty' => $runner->getSymfonyVersion() <= 50200,
]
);
- // @legacy - In 5.4 tests, we need to tell Symfony to look for route attributes in `src/Controller`
- if ('60000' > $runner->getSymfonyVersion()) {
- $runner->copy('router-annotations.yaml', 'config/routes/annotations.yaml');
- }
-
// plaintext password: needed for entities, simplifies overall
$runner->modifyYamlFile('config/packages/security.yaml', function (array $config) {
if (isset($config['when@test']['security']['password_hashers'])) {
diff --git a/tests/Maker/MakeControllerTest.php b/tests/Maker/MakeControllerTest.php
index 42da9050d..12e46343e 100644
--- a/tests/Maker/MakeControllerTest.php
+++ b/tests/Maker/MakeControllerTest.php
@@ -152,11 +152,6 @@ private function runControllerTest(MakerTestRunner $runner, string $filename): v
'tests/GeneratedControllerTest.php'
);
- // @legacy - In 5.4 tests, we need to tell Symfony to look for route attributes in `src/Controller`
- if ('60000' > $runner->getSymfonyVersion()) {
- $runner->copy('router-annotations.yaml', 'config/routes/annotations.yaml');
- }
-
$runner->runTests();
}
}
diff --git a/tests/Maker/MakeCrudTest.php b/tests/Maker/MakeCrudTest.php
index da60ae241..ea8dbf9bf 100644
--- a/tests/Maker/MakeCrudTest.php
+++ b/tests/Maker/MakeCrudTest.php
@@ -122,19 +122,16 @@ public function getTestDetails(): \Generator
Yaml::dump(['maker' => ['root_namespace' => 'Custom']])
);
- // @legacy Conditional can be removed when Symfony 5.4 support is dropped
- if (60000 <= $runner->getSymfonyVersion()) {
- // Symfony 6.2 sets the path and namespace for router resources
- $runner->modifyYamlFile('config/routes.yaml', function (array $config) {
- if (!isset($config['controllers']['resource']['namespace'])) {
- return $config;
- }
+ // Symfony 6.2 sets the path and namespace for router resources
+ $runner->modifyYamlFile('config/routes.yaml', function (array $config) {
+ if (!isset($config['controllers']['resource']['namespace'])) {
+ return $config;
+ }
- $config['controllers']['resource']['namespace'] = 'Custom\Controller';
+ $config['controllers']['resource']['namespace'] = 'Custom\Controller';
- return $config;
- });
- }
+ return $config;
+ });
$runner->copy(
'make-crud/SweetFood-custom-namespace.php',
@@ -176,7 +173,7 @@ public function getTestDetails(): \Generator
$this->runCrudTest($runner, 'it_generates_basic_crud.php');
self::assertFileEquals(
- sprintf('%s/fixtures/make-crud/expected/WithCustomRepository%s.php', \dirname(__DIR__), $runner->getSymfonyVersion() < 60200 ? 'Legacy' : ''),
+ sprintf('%s/fixtures/make-crud/expected/WithCustomRepository.php', \dirname(__DIR__)),
$runner->getPath('src/Controller/SweetFoodController.php')
);
}),
diff --git a/tests/Maker/MakeEntityTest.php b/tests/Maker/MakeEntityTest.php
index 2803fd9c2..6e8d36f82 100644
--- a/tests/Maker/MakeEntityTest.php
+++ b/tests/Maker/MakeEntityTest.php
@@ -38,8 +38,9 @@ private function createMakeEntityTest(bool $withDatabase = true): MakerTestDetai
private function createMakeEntityTestForMercure(): MakerTestDetails
{
return $this->createMakeEntityTest()
+ ->skipOnSymfony7() // legacy remove when ux-turbo-mercure supports Symfony 7
->preRun(function (MakerTestRunner $runner) {
- // installed manually later so that the compatibility check can run fist
+ // installed manually later so that the compatibility check can run first
$runner->runProcess('composer require symfony/ux-turbo-mercure');
});
}
@@ -60,6 +61,7 @@ public function getTestDetails(): \Generator
];
yield 'it_creates_a_new_class_and_api_resource' => [$this->createMakeEntityTest()
+ ->skipOnSymfony7() // legacy: remove when API Platform supports Symfony 7
->addExtraDependencies('api')
->run(function (MakerTestRunner $runner) {
$runner->runMaker([
@@ -473,46 +475,6 @@ public function getTestDetails(): \Generator
}),
];
- yield 'it_display_an_error_using_with_xml' => [$this->createMakeEntityTest(false)
- ->run(function (MakerTestRunner $runner) {
- $this->copyEntity($runner, 'User-basic.php');
-
- $runner->copy(
- 'make-entity/xml-mapping',
- ''
- );
-
- $this->changeToXmlMapping($runner);
-
- $output = $runner->runMaker([
- 'User',
- '',
- ], '', true /* allow failure */);
-
- $this->assertStringContainsString('Only attribute mapping is supported', $output);
- }),
- ];
-
- yield 'it_display_an_error_using_with_xml_with_new_class' => [$this->createMakeEntityTest(false)
- ->run(function (MakerTestRunner $runner) {
- $this->copyEntity($runner, 'User-basic.php');
-
- $runner->copy(
- 'make-entity/xml-mapping',
- ''
- );
-
- $this->changeToXmlMapping($runner);
-
- $output = $runner->runMaker([
- 'UserAvatarPhoto',
- '',
- ], '', true /* allow failure */);
-
- $this->assertStringContainsString('Only attribute mapping is supported', $output);
- }),
- ];
-
yield 'it_can_overwrite_while_adding_fields' => [$this->createMakeEntityTest()
->run(function (MakerTestRunner $runner) {
$this->copyEntity($runner, 'User-invalid-method-no-property.php');
@@ -583,6 +545,7 @@ public function getTestDetails(): \Generator
yield 'it_makes_new_entity_no_to_all_extras' => [$this->createMakeEntityTestForMercure()
->addExtraDependencies('api')
+ ->skipOnSymfony7() // legacy: remove when API Platform supports Symfony 7
// special setup done in createMakeEntityTestForMercure()
->run(function (MakerTestRunner $runner) {
$runner->runMaker([
diff --git a/tests/Maker/MakeFixturesTest.php b/tests/Maker/MakeFixturesTest.php
index f26f4be23..0f43de13f 100644
--- a/tests/Maker/MakeFixturesTest.php
+++ b/tests/Maker/MakeFixturesTest.php
@@ -25,6 +25,8 @@ protected function getMakerClass(): string
public function getTestDetails()
{
yield 'it_generates_fixtures' => [$this->createMakerTest()
+ // legacy: remove when DoctrineFixturesBundle 4.0 is installed
+ ->skipOnSymfony7()
->run(function (MakerTestRunner $runner) {
$output = $runner->runMaker([
'FooFixtures',
diff --git a/tests/Maker/MakeFunctionalTestTest.php b/tests/Maker/MakeFunctionalTestTest.php
index 31d562c74..0deece27e 100644
--- a/tests/Maker/MakeFunctionalTestTest.php
+++ b/tests/Maker/MakeFunctionalTestTest.php
@@ -29,6 +29,7 @@ public function getTestDetails()
{
yield 'it_generates_test_with_panther' => [$this->createMakerTest()
/* @legacy Allows Panther >= 1.x to be installed. (PHP <8.0 support) */
+ ->skipOnSymfony7() // legacy remove when panther supports Symfony 7
->addExtraDependencies('panther:*')
->run(function (MakerTestRunner $runner) {
$runner->copy(
diff --git a/tests/Maker/MakeMigrationTest.php b/tests/Maker/MakeMigrationTest.php
index 4e5711151..b50b7c8af 100644
--- a/tests/Maker/MakeMigrationTest.php
+++ b/tests/Maker/MakeMigrationTest.php
@@ -31,7 +31,7 @@ private function createMakeMigrationTest(): MakerTestDetails
// doctrine-migrations-bundle only requires doctrine-bundle, which
// only requires doctrine/dbal. But we're testing with the ORM,
// so let's install it
- ->addExtraDependencies('doctrine/orm:@stable')
+ ->addExtraDependencies('doctrine/orm')
->preRun(function (MakerTestRunner $runner) {
$runner->copy(
'make-migration/SpicyFood.php',
diff --git a/tests/Maker/MakeRegistrationFormTest.php b/tests/Maker/MakeRegistrationFormTest.php
index 01afd6ca4..4c180a64b 100644
--- a/tests/Maker/MakeRegistrationFormTest.php
+++ b/tests/Maker/MakeRegistrationFormTest.php
@@ -32,11 +32,6 @@ private function createRegistrationFormTest(): MakerTestDetails
'make-registration-form/standard_setup',
''
);
-
- if (60000 > $runner->getSymfonyVersion()) {
- // @legacy - In 5.4 tests, we need to tell Symfony to look for the route attributes in `src/Controller`
- $runner->copy('router-annotations.yaml', 'config/routes/annotations.yaml');
- }
})
;
}
@@ -103,6 +98,7 @@ public function getTestDetails(): \Generator
yield 'it_generates_registration_form_with_verification' => [$this->createRegistrationFormTest()
->addExtraDependencies('symfonycasts/verify-email-bundle')
+ ->skipOnSymfony7() // legacy: remove VerifyEmailBundle supports Symfony 7
// needed for internal functional test
->addExtraDependencies('symfony/web-profiler-bundle', 'mailer')
->run(function (MakerTestRunner $runner) {
@@ -142,6 +138,7 @@ public function getTestDetails(): \Generator
yield 'it_generates_registration_form_with_verification_and_translator' => [$this->createRegistrationFormTest()
->addExtraDependencies('symfonycasts/verify-email-bundle')
+ ->skipOnSymfony7() // legacy: remove VerifyEmailBundle supports Symfony 7
// needed for internal functional test
->addExtraDependencies('symfony/web-profiler-bundle', 'mailer', 'symfony/translation')
->run(function (MakerTestRunner $runner) {
diff --git a/tests/Maker/MakeResetPasswordTest.php b/tests/Maker/MakeResetPasswordTest.php
index 83ef21c54..abd565c06 100644
--- a/tests/Maker/MakeResetPasswordTest.php
+++ b/tests/Maker/MakeResetPasswordTest.php
@@ -28,6 +28,7 @@ public function getTestDetails(): \Generator
{
yield 'it_generates_with_normal_setup' => [$this->createMakerTest()
->setSkippedPhpVersions(80100, 80109)
+ ->skipOnSymfony7() // legacy: remove ResetPasswordBundle supports Symfony 7
->run(function (MakerTestRunner $runner) {
$this->makeUser($runner);
@@ -77,17 +78,13 @@ public function getTestDetails(): \Generator
'tests/ResetPasswordFunctionalTest.php'
);
- if (60000 > $runner->getSymfonyVersion()) {
- // @legacy - In 5.4 tests, we need to tell Symfony to look for the route attributes in `src/Controller`
- $runner->copy('router-annotations.yaml', 'config/routes/annotations.yaml');
- }
-
$runner->runTests();
}),
];
yield 'it_generates_with_translator_installed' => [$this->createMakerTest()
->setSkippedPhpVersions(80100, 80109)
+ ->skipOnSymfony7() // legacy: remove ResetPasswordBundle supports Symfony 7
->addExtraDependencies('symfony/translation')
->run(function (MakerTestRunner $runner) {
$this->makeUser($runner);
@@ -105,6 +102,7 @@ public function getTestDetails(): \Generator
yield 'it_generates_with_custom_config' => [$this->createMakerTest()
->setSkippedPhpVersions(80100, 80109)
+ ->skipOnSymfony7() // legacy: remove ResetPasswordBundle supports Symfony 7
->run(function (MakerTestRunner $runner) {
$runner->deleteFile('config/packages/reset_password.yaml');
$runner->writeFile(
@@ -125,12 +123,7 @@ public function getTestDetails(): \Generator
$this->assertStringContainsString('Success', $output);
- // @legacy - conditional can be removed when PHPUnit 9.x is no longer supported.
- if (method_exists($this, 'assertFileDoesNotExist')) {
- $this->assertFileDoesNotExist($runner->getPath('config/packages/reset_password.yaml'));
- } else {
- $this->assertFileNotExists($runner->getPath('config/packages/reset_password.yaml'));
- }
+ $this->assertFileDoesNotExist($runner->getPath('config/packages/reset_password.yaml'));
$this->assertStringContainsString(
'Just remember to set the request_password_repository in your configuration.',
$output
@@ -140,6 +133,7 @@ public function getTestDetails(): \Generator
yield 'it_amends_configuration' => [$this->createMakerTest()
->setSkippedPhpVersions(80100, 80109)
+ ->skipOnSymfony7() // legacy: remove ResetPasswordBundle supports Symfony 7
->run(function (MakerTestRunner $runner) {
$runner->modifyYamlFile('config/packages/reset_password.yaml', function (array $config) {
$config['symfonycasts_reset_password']['lifetime'] = 9999;
@@ -167,6 +161,7 @@ public function getTestDetails(): \Generator
yield 'it_generates_with_custom_user' => [$this->createMakerTest()
->setSkippedPhpVersions(80100, 80109)
+ ->skipOnSymfony7() // legacy: remove ResetPasswordBundle supports Symfony 7
->run(function (MakerTestRunner $runner) {
$this->makeUser($runner, 'emailAddress', 'UserCustom', false);
diff --git a/tests/Maker/MakeStimulusControllerTest.php b/tests/Maker/MakeStimulusControllerTest.php
index 69183d695..08890cd21 100644
--- a/tests/Maker/MakeStimulusControllerTest.php
+++ b/tests/Maker/MakeStimulusControllerTest.php
@@ -25,6 +25,7 @@ protected function getMakerClass(): string
public function getTestDetails(): \Generator
{
yield 'it_generates_stimulus_controller_with_targets' => [$this->createMakerTest()
+ ->skipOnSymfony7() // legacy: remove StimulusBundle supports Symfony 7
->run(function (MakerTestRunner $runner) {
$runner->runMaker(
[
@@ -52,6 +53,7 @@ public function getTestDetails(): \Generator
];
yield 'it_generates_stimulus_controller_without_targets' => [$this->createMakerTest()
+ ->skipOnSymfony7() // legacy: remove StimulusBundle supports Symfony 7
->run(function (MakerTestRunner $runner) {
$runner->runMaker(
[
@@ -75,6 +77,7 @@ public function getTestDetails(): \Generator
];
yield 'it_generates_typescript_stimulus_controller' => [$this->createMakerTest()
+ ->skipOnSymfony7() // legacy: remove StimulusBundle supports Symfony 7
->run(function (MakerTestRunner $runner) {
$runner->runMaker(
[
diff --git a/tests/Maker/MakeTestTest.php b/tests/Maker/MakeTestTest.php
index 128c7c8bb..5eecb11e0 100644
--- a/tests/Maker/MakeTestTest.php
+++ b/tests/Maker/MakeTestTest.php
@@ -80,6 +80,7 @@ public function getTestDetails(): \Generator
];
yield 'it_makes_PantherTestCase_type' => [$this->createMakerTest()
+ ->skipOnSymfony7() // legacy remove when panther supports Symfony 7
/* @legacy Allows Panther >= 1.x to be installed. (PHP <8.0 support) */
->addExtraDependencies('panther:*')
->run(function (MakerTestRunner $runner) {
diff --git a/tests/Maker/MakeTwigComponentTest.php b/tests/Maker/MakeTwigComponentTest.php
index fa110bc35..e1207bd94 100644
--- a/tests/Maker/MakeTwigComponentTest.php
+++ b/tests/Maker/MakeTwigComponentTest.php
@@ -21,6 +21,7 @@ public function getTestDetails(): \Generator
{
yield 'it_generates_twig_component' => [$this->createMakerTest()
->addExtraDependencies('symfony/ux-twig-component', 'symfony/twig-bundle')
+ ->skipOnSymfony7() // legacy: remove when ux-twig-component supports Symfony 7
->run(function (MakerTestRunner $runner) {
$output = $runner->runMaker(['Alert']);
@@ -39,6 +40,7 @@ public function getTestDetails(): \Generator
yield 'it_generates_pascal_case_twig_component' => [$this->createMakerTest()
->addExtraDependencies('symfony/ux-twig-component', 'symfony/twig-bundle')
+ ->skipOnSymfony7() // legacy: remove when ux-twig-component supports Symfony 7
->run(function (MakerTestRunner $runner) {
$output = $runner->runMaker(['FormInput']);
@@ -57,6 +59,7 @@ public function getTestDetails(): \Generator
yield 'it_generates_live_component' => [$this->createMakerTest()
->addExtraDependencies('symfony/ux-live-component', 'symfony/twig-bundle')
+ ->skipOnSymfony7() // legacy: remove when ux-twig-component supports Symfony 7
->run(function (MakerTestRunner $runner) {
$output = $runner->runMaker(['Alert']);
@@ -75,6 +78,7 @@ public function getTestDetails(): \Generator
yield 'it_generates_pascal_case_live_component' => [$this->createMakerTest()
->addExtraDependencies('symfony/ux-live-component', 'symfony/twig-bundle')
+ ->skipOnSymfony7() // legacy: remove when ux-twig-component supports Symfony 7
->run(function (MakerTestRunner $runner) {
$output = $runner->runMaker(['FormInput']);
diff --git a/tests/Maker/Security/MakeFormLoginTest.php b/tests/Maker/Security/MakeFormLoginTest.php
index a3c3bf4a7..4e1c90c21 100644
--- a/tests/Maker/Security/MakeFormLoginTest.php
+++ b/tests/Maker/Security/MakeFormLoginTest.php
@@ -103,11 +103,6 @@ public function getTestDetails(): \Generator
private function runLoginTest(MakerTestRunner $runner): void
{
- if (60000 > $runner->getSymfonyVersion()) {
- // @legacy - In 5.4 tests, we need to tell Symfony to look for the route attributes in `src/Controller`
- $runner->copy('router-annotations.yaml', 'config/routes/annotations.yaml');
- }
-
$fixturePath = 'security/make-form-login/';
$runner->renderTemplateFile($fixturePath.'/LoginTest.php', 'tests/LoginTest.php', []);
diff --git a/tests/Maker/TemplateLinterTest.php b/tests/Maker/TemplateLinterTest.php
index e5cf24940..cf14850ab 100644
--- a/tests/Maker/TemplateLinterTest.php
+++ b/tests/Maker/TemplateLinterTest.php
@@ -33,9 +33,7 @@ protected function getMakerClass(): string
public function getTestDetails(): \Generator
{
yield 'lints_templates_with_custom_php_cs_fixer_and_config' => [$this->createMakerTest()
- ->addExtraDependencies('friendsofphp/php-cs-fixer')
- // these tests are troublesome on Windows
- ->skipOnWindows()
+ ->addExtraDependencies('php-cs-fixer/shim')
->run(function (MakerTestRunner $runner) {
$runner->copy('template-linter/php-cs-fixer.test.php', 'php-cs-fixer.test.php');
@@ -61,9 +59,7 @@ public function getTestDetails(): \Generator
];
yield 'lints_templates_with_flex_generated_config_file' => [$this->createMakerTest()
- ->addExtraDependencies('friendsofphp/php-cs-fixer')
- // these tests are troublesome on Windows
- ->skipOnWindows()
+ ->addExtraDependencies('php-cs-fixer/shim')
->run(function (MakerTestRunner $runner) {
$runner->replaceInFile(
'.php-cs-fixer.dist.php',
diff --git a/tests/Security/UserClassBuilderTest.php b/tests/Security/UserClassBuilderTest.php
index fd4f56166..3f53a70d4 100644
--- a/tests/Security/UserClassBuilderTest.php
+++ b/tests/Security/UserClassBuilderTest.php
@@ -15,7 +15,6 @@
use Symfony\Bundle\MakerBundle\Security\UserClassBuilder;
use Symfony\Bundle\MakerBundle\Security\UserClassConfiguration;
use Symfony\Bundle\MakerBundle\Util\ClassSourceManipulator;
-use Symfony\Component\Security\Core\User\UserInterface;
class UserClassBuilderTest extends TestCase
{
@@ -29,8 +28,7 @@ public function testAddUserInterfaceImplementation(UserClassConfiguration $userC
$classBuilder = new UserClassBuilder();
$classBuilder->addUserInterfaceImplementation($manipulator, $userClassConfig);
- $isSymfony5 = method_exists(UserInterface::class, 'getSalt');
- $expectedPath = $this->getExpectedPath($expectedFilename, $isSymfony5 ? 'legacy_5_user_class' : null);
+ $expectedPath = $this->getExpectedPath($expectedFilename, null);
$expectedSource = file_get_contents($expectedPath);
self::assertSame($expectedSource, $manipulator->getSourceCode());
@@ -84,11 +82,11 @@ private function getClassSourceManipulator(UserClassConfiguration $userClassConf
);
}
- private function getExpectedPath(string $expectedFilename, string $subDirectory = null): string
+ private function getExpectedPath(string $expectedFilename): string
{
$basePath = __DIR__.'/fixtures/expected';
- $expectedPath = null === $subDirectory ? sprintf('%s/%s', $basePath, $expectedFilename) : sprintf('%s/%s/%s', $basePath, $subDirectory, $expectedFilename);
+ $expectedPath = sprintf('%s/%s', $basePath, $expectedFilename);
if (!file_exists($expectedPath)) {
throw new \Exception(sprintf('Expected file missing: "%s"', $expectedPath));
diff --git a/tests/Security/fixtures/expected/legacy_5_user_class/UserEntityWithEmailAsIdentifier.php b/tests/Security/fixtures/expected/legacy_5_user_class/UserEntityWithEmailAsIdentifier.php
deleted file mode 100644
index 5713de2e9..000000000
--- a/tests/Security/fixtures/expected/legacy_5_user_class/UserEntityWithEmailAsIdentifier.php
+++ /dev/null
@@ -1,117 +0,0 @@
-id;
- }
-
- public function getEmail(): ?string
- {
- return $this->email;
- }
-
- public function setEmail(string $email): static
- {
- $this->email = $email;
-
- return $this;
- }
-
- /**
- * A visual identifier that represents this user.
- *
- * @see UserInterface
- */
- public function getUserIdentifier(): string
- {
- return (string) $this->email;
- }
-
- /**
- * @deprecated since Symfony 5.3, use getUserIdentifier instead
- */
- public function getUsername(): string
- {
- return (string) $this->email;
- }
-
- /**
- * @see UserInterface
- */
- public function getRoles(): array
- {
- $roles = $this->roles;
- // guarantee every user at least has ROLE_USER
- $roles[] = 'ROLE_USER';
-
- return array_unique($roles);
- }
-
- public function setRoles(array $roles): static
- {
- $this->roles = $roles;
-
- return $this;
- }
-
- /**
- * @see PasswordAuthenticatedUserInterface
- */
- public function getPassword(): string
- {
- return $this->password;
- }
-
- public function setPassword(string $password): static
- {
- $this->password = $password;
-
- return $this;
- }
-
- /**
- * Returning a salt is only needed, if you are not using a modern
- * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
- *
- * @see UserInterface
- */
- public function getSalt(): ?string
- {
- return null;
- }
-
- /**
- * @see UserInterface
- */
- public function eraseCredentials(): void
- {
- // If you store any temporary, sensitive data on the user, clear it here
- // $this->plainPassword = null;
- }
-}
diff --git a/tests/Security/fixtures/expected/legacy_5_user_class/UserEntityWithPassword.php b/tests/Security/fixtures/expected/legacy_5_user_class/UserEntityWithPassword.php
deleted file mode 100644
index 3dd0b9954..000000000
--- a/tests/Security/fixtures/expected/legacy_5_user_class/UserEntityWithPassword.php
+++ /dev/null
@@ -1,112 +0,0 @@
-id;
- }
-
- /**
- * A visual identifier that represents this user.
- *
- * @see UserInterface
- */
- public function getUserIdentifier(): string
- {
- return (string) $this->userIdentifier;
- }
-
- public function setUserIdentifier(string $userIdentifier): static
- {
- $this->userIdentifier = $userIdentifier;
-
- return $this;
- }
-
- /**
- * @deprecated since Symfony 5.3, use getUserIdentifier instead
- */
- public function getUsername(): string
- {
- return (string) $this->userIdentifier;
- }
-
- /**
- * @see UserInterface
- */
- public function getRoles(): array
- {
- $roles = $this->roles;
- // guarantee every user at least has ROLE_USER
- $roles[] = 'ROLE_USER';
-
- return array_unique($roles);
- }
-
- public function setRoles(array $roles): static
- {
- $this->roles = $roles;
-
- return $this;
- }
-
- /**
- * @see PasswordAuthenticatedUserInterface
- */
- public function getPassword(): string
- {
- return $this->password;
- }
-
- public function setPassword(string $password): static
- {
- $this->password = $password;
-
- return $this;
- }
-
- /**
- * Returning a salt is only needed, if you are not using a modern
- * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
- *
- * @see UserInterface
- */
- public function getSalt(): ?string
- {
- return null;
- }
-
- /**
- * @see UserInterface
- */
- public function eraseCredentials(): void
- {
- // If you store any temporary, sensitive data on the user, clear it here
- // $this->plainPassword = null;
- }
-}
diff --git a/tests/Security/fixtures/expected/legacy_5_user_class/UserEntityWithUser_IdentifierAsIdentifier.php b/tests/Security/fixtures/expected/legacy_5_user_class/UserEntityWithUser_IdentifierAsIdentifier.php
deleted file mode 100644
index efc3c7bf1..000000000
--- a/tests/Security/fixtures/expected/legacy_5_user_class/UserEntityWithUser_IdentifierAsIdentifier.php
+++ /dev/null
@@ -1,112 +0,0 @@
-id;
- }
-
- /**
- * A visual identifier that represents this user.
- *
- * @see UserInterface
- */
- public function getUserIdentifier(): string
- {
- return (string) $this->user_identifier;
- }
-
- public function setUserIdentifier(string $user_identifier): static
- {
- $this->user_identifier = $user_identifier;
-
- return $this;
- }
-
- /**
- * @deprecated since Symfony 5.3, use getUserIdentifier instead
- */
- public function getUsername(): string
- {
- return (string) $this->user_identifier;
- }
-
- /**
- * @see UserInterface
- */
- public function getRoles(): array
- {
- $roles = $this->roles;
- // guarantee every user at least has ROLE_USER
- $roles[] = 'ROLE_USER';
-
- return array_unique($roles);
- }
-
- public function setRoles(array $roles): static
- {
- $this->roles = $roles;
-
- return $this;
- }
-
- /**
- * @see PasswordAuthenticatedUserInterface
- */
- public function getPassword(): string
- {
- return $this->password;
- }
-
- public function setPassword(string $password): static
- {
- $this->password = $password;
-
- return $this;
- }
-
- /**
- * Returning a salt is only needed, if you are not using a modern
- * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
- *
- * @see UserInterface
- */
- public function getSalt(): ?string
- {
- return null;
- }
-
- /**
- * @see UserInterface
- */
- public function eraseCredentials(): void
- {
- // If you store any temporary, sensitive data on the user, clear it here
- // $this->plainPassword = null;
- }
-}
diff --git a/tests/Security/fixtures/expected/legacy_5_user_class/UserEntityWithoutPassword.php b/tests/Security/fixtures/expected/legacy_5_user_class/UserEntityWithoutPassword.php
deleted file mode 100644
index fc9cea19e..000000000
--- a/tests/Security/fixtures/expected/legacy_5_user_class/UserEntityWithoutPassword.php
+++ /dev/null
@@ -1,99 +0,0 @@
-id;
- }
-
- /**
- * A visual identifier that represents this user.
- *
- * @see UserInterface
- */
- public function getUserIdentifier(): string
- {
- return (string) $this->userIdentifier;
- }
-
- public function setUserIdentifier(string $userIdentifier): static
- {
- $this->userIdentifier = $userIdentifier;
-
- return $this;
- }
-
- /**
- * @deprecated since Symfony 5.3, use getUserIdentifier instead
- */
- public function getUsername(): string
- {
- return (string) $this->userIdentifier;
- }
-
- /**
- * @see UserInterface
- */
- public function getRoles(): array
- {
- $roles = $this->roles;
- // guarantee every user at least has ROLE_USER
- $roles[] = 'ROLE_USER';
-
- return array_unique($roles);
- }
-
- public function setRoles(array $roles): static
- {
- $this->roles = $roles;
-
- return $this;
- }
-
- /**
- * This method can be removed in Symfony 6.0 - is not needed for apps that do not check user passwords.
- *
- * @see PasswordAuthenticatedUserInterface
- */
- public function getPassword(): ?string
- {
- return null;
- }
-
- /**
- * This method can be removed in Symfony 6.0 - is not needed for apps that do not check user passwords.
- *
- * @see UserInterface
- */
- public function getSalt(): ?string
- {
- return null;
- }
-
- /**
- * @see UserInterface
- */
- public function eraseCredentials(): void
- {
- // If you store any temporary, sensitive data on the user, clear it here
- // $this->plainPassword = null;
- }
-}
diff --git a/tests/Security/fixtures/expected/legacy_5_user_class/UserModelWithEmailAsIdentifier.php b/tests/Security/fixtures/expected/legacy_5_user_class/UserModelWithEmailAsIdentifier.php
deleted file mode 100644
index f90252a53..000000000
--- a/tests/Security/fixtures/expected/legacy_5_user_class/UserModelWithEmailAsIdentifier.php
+++ /dev/null
@@ -1,102 +0,0 @@
-email;
- }
-
- public function setEmail(string $email): static
- {
- $this->email = $email;
-
- return $this;
- }
-
- /**
- * A visual identifier that represents this user.
- *
- * @see UserInterface
- */
- public function getUserIdentifier(): string
- {
- return (string) $this->email;
- }
-
- /**
- * @deprecated since Symfony 5.3, use getUserIdentifier instead
- */
- public function getUsername(): string
- {
- return (string) $this->email;
- }
-
- /**
- * @see UserInterface
- */
- public function getRoles(): array
- {
- $roles = $this->roles;
- // guarantee every user at least has ROLE_USER
- $roles[] = 'ROLE_USER';
-
- return array_unique($roles);
- }
-
- public function setRoles(array $roles): static
- {
- $this->roles = $roles;
-
- return $this;
- }
-
- /**
- * @see PasswordAuthenticatedUserInterface
- */
- public function getPassword(): string
- {
- return $this->password;
- }
-
- public function setPassword(string $password): static
- {
- $this->password = $password;
-
- return $this;
- }
-
- /**
- * Returning a salt is only needed, if you are not using a modern
- * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
- *
- * @see UserInterface
- */
- public function getSalt(): ?string
- {
- return null;
- }
-
- /**
- * @see UserInterface
- */
- public function eraseCredentials(): void
- {
- // If you store any temporary, sensitive data on the user, clear it here
- // $this->plainPassword = null;
- }
-}
diff --git a/tests/Security/fixtures/expected/legacy_5_user_class/UserModelWithPassword.php b/tests/Security/fixtures/expected/legacy_5_user_class/UserModelWithPassword.php
deleted file mode 100644
index 340b3a38e..000000000
--- a/tests/Security/fixtures/expected/legacy_5_user_class/UserModelWithPassword.php
+++ /dev/null
@@ -1,97 +0,0 @@
-userIdentifier;
- }
-
- public function setUserIdentifier(string $userIdentifier): static
- {
- $this->userIdentifier = $userIdentifier;
-
- return $this;
- }
-
- /**
- * @deprecated since Symfony 5.3, use getUserIdentifier instead
- */
- public function getUsername(): string
- {
- return (string) $this->userIdentifier;
- }
-
- /**
- * @see UserInterface
- */
- public function getRoles(): array
- {
- $roles = $this->roles;
- // guarantee every user at least has ROLE_USER
- $roles[] = 'ROLE_USER';
-
- return array_unique($roles);
- }
-
- public function setRoles(array $roles): static
- {
- $this->roles = $roles;
-
- return $this;
- }
-
- /**
- * @see PasswordAuthenticatedUserInterface
- */
- public function getPassword(): string
- {
- return $this->password;
- }
-
- public function setPassword(string $password): static
- {
- $this->password = $password;
-
- return $this;
- }
-
- /**
- * Returning a salt is only needed, if you are not using a modern
- * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
- *
- * @see UserInterface
- */
- public function getSalt(): ?string
- {
- return null;
- }
-
- /**
- * @see UserInterface
- */
- public function eraseCredentials(): void
- {
- // If you store any temporary, sensitive data on the user, clear it here
- // $this->plainPassword = null;
- }
-}
diff --git a/tests/Security/fixtures/expected/legacy_5_user_class/UserModelWithoutPassword.php b/tests/Security/fixtures/expected/legacy_5_user_class/UserModelWithoutPassword.php
deleted file mode 100644
index e8221fbcd..000000000
--- a/tests/Security/fixtures/expected/legacy_5_user_class/UserModelWithoutPassword.php
+++ /dev/null
@@ -1,85 +0,0 @@
-userIdentifier;
- }
-
- public function setUserIdentifier(string $userIdentifier): static
- {
- $this->userIdentifier = $userIdentifier;
-
- return $this;
- }
-
- /**
- * @deprecated since Symfony 5.3, use getUserIdentifier instead
- */
- public function getUsername(): string
- {
- return (string) $this->userIdentifier;
- }
-
- /**
- * @see UserInterface
- */
- public function getRoles(): array
- {
- $roles = $this->roles;
- // guarantee every user at least has ROLE_USER
- $roles[] = 'ROLE_USER';
-
- return array_unique($roles);
- }
-
- public function setRoles(array $roles): static
- {
- $this->roles = $roles;
-
- return $this;
- }
-
- /**
- * This method can be removed in Symfony 6.0 - is not needed for apps that do not check user passwords.
- *
- * @see PasswordAuthenticatedUserInterface
- */
- public function getPassword(): ?string
- {
- return null;
- }
-
- /**
- * This method can be removed in Symfony 6.0 - is not needed for apps that do not check user passwords.
- *
- * @see UserInterface
- */
- public function getSalt(): ?string
- {
- return null;
- }
-
- /**
- * @see UserInterface
- */
- public function eraseCredentials(): void
- {
- // If you store any temporary, sensitive data on the user, clear it here
- // $this->plainPassword = null;
- }
-}
diff --git a/tests/fixtures/make-auth/UserProvider-no-entity.php b/tests/fixtures/make-auth/UserProvider-no-entity.php
index 80f4bab66..bb20f1ac2 100644
--- a/tests/fixtures/make-auth/UserProvider-no-entity.php
+++ b/tests/fixtures/make-auth/UserProvider-no-entity.php
@@ -34,7 +34,7 @@ public function refreshUser(UserInterface $user): UserInterface
{
}
- public function supportsClass(string $class): UserInterface
+ public function supportsClass(string $class): bool
{
}
}
diff --git a/tests/fixtures/make-crud/expected/WithCustomRepositoryLegacy.php b/tests/fixtures/make-crud/expected/WithCustomRepositoryLegacy.php
deleted file mode 100644
index c358ffd67..000000000
--- a/tests/fixtures/make-crud/expected/WithCustomRepositoryLegacy.php
+++ /dev/null
@@ -1,81 +0,0 @@
-render('sweet_food/index.html.twig', [
- 'sweet_foods' => $sweetFoodRepository->findAll(),
- ]);
- }
-
- #[Route('/new', name: 'app_sweet_food_new', methods: ['GET', 'POST'])]
- public function new(Request $request, EntityManagerInterface $entityManager): Response
- {
- $sweetFood = new SweetFood();
- $form = $this->createForm(SweetFoodType::class, $sweetFood);
- $form->handleRequest($request);
-
- if ($form->isSubmitted() && $form->isValid()) {
- $entityManager->persist($sweetFood);
- $entityManager->flush();
-
- return $this->redirectToRoute('app_sweet_food_index', [], Response::HTTP_SEE_OTHER);
- }
-
- return $this->renderForm('sweet_food/new.html.twig', [
- 'sweet_food' => $sweetFood,
- 'form' => $form,
- ]);
- }
-
- #[Route('/{id}', name: 'app_sweet_food_show', methods: ['GET'])]
- public function show(SweetFood $sweetFood): Response
- {
- return $this->render('sweet_food/show.html.twig', [
- 'sweet_food' => $sweetFood,
- ]);
- }
-
- #[Route('/{id}/edit', name: 'app_sweet_food_edit', methods: ['GET', 'POST'])]
- public function edit(Request $request, SweetFood $sweetFood, EntityManagerInterface $entityManager): Response
- {
- $form = $this->createForm(SweetFoodType::class, $sweetFood);
- $form->handleRequest($request);
-
- if ($form->isSubmitted() && $form->isValid()) {
- $entityManager->flush();
-
- return $this->redirectToRoute('app_sweet_food_index', [], Response::HTTP_SEE_OTHER);
- }
-
- return $this->renderForm('sweet_food/edit.html.twig', [
- 'sweet_food' => $sweetFood,
- 'form' => $form,
- ]);
- }
-
- #[Route('/{id}', name: 'app_sweet_food_delete', methods: ['POST'])]
- public function delete(Request $request, SweetFood $sweetFood, EntityManagerInterface $entityManager): Response
- {
- if ($this->isCsrfTokenValid('delete'.$sweetFood->getId(), $request->request->get('_token'))) {
- $entityManager->remove($sweetFood);
- $entityManager->flush();
- }
-
- return $this->redirectToRoute('app_sweet_food_index', [], Response::HTTP_SEE_OTHER);
- }
-}
diff --git a/tests/fixtures/router-annotations.yaml b/tests/fixtures/router-annotations.yaml
deleted file mode 100644
index 2670924ec..000000000
--- a/tests/fixtures/router-annotations.yaml
+++ /dev/null
@@ -1,10 +0,0 @@
-# @legacy - Can be removed when Symfony 5.4 is no longer supported
-# This is needed for controller attributes as we do not install / require
-# doctrine/annotations...
-controllers:
- resource: ../../src/Controller/
- type: annotation
-
-kernel:
- resource: ../../src/Kernel.php
- type: annotation