Skip to content
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
21 changes: 9 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
fail-fast: false
matrix:
php-version:
- '8.0'
- '8.1'

steps:
-
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
33 changes: 16 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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/" }
Expand All @@ -54,7 +53,7 @@
},
"extra": {
"branch-alias": {
"dev-main": "1.0-dev"
"dev-main": "1.x-dev"
}
}
}
49 changes: 14 additions & 35 deletions src/Console/MigrationDiffFilteredOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down Expand Up @@ -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);
}
Expand Down
39 changes: 0 additions & 39 deletions src/Console/MigrationDiffFilteredOutput_php8

This file was deleted.

3 changes: 1 addition & 2 deletions src/Doctrine/EntityClassGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 1 addition & 2 deletions src/Doctrine/EntityDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Bundle\MakerBundle\Doctrine;

use Doctrine\Common\Persistence\Mapping\ClassMetadata as LegacyClassMetadata;
use Doctrine\Persistence\Mapping\ClassMetadata;

/**
Expand All @@ -22,7 +21,7 @@
final class EntityDetails
{
public function __construct(
private ClassMetadata|LegacyClassMetadata $metadata,
private ClassMetadata $metadata,
) {
}

Expand Down
3 changes: 1 addition & 2 deletions src/Doctrine/EntityRegenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down
8 changes: 1 addition & 7 deletions src/EventRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions src/FileManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ private function realPath(string $absolutePath): string
}

$finalPath = implode('/', $finalParts);

// Normalize: // => /
// Normalize: /./ => /
return str_replace(['//', '/./'], '/', $finalPath);
Expand Down
17 changes: 2 additions & 15 deletions src/Maker/MakeAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}
Expand Down
Loading