Skip to content

Commit

Permalink
[ci] php-cs-fixer it up
Browse files Browse the repository at this point in the history
  • Loading branch information
jrushlow committed Feb 7, 2024
1 parent a8523cf commit cb48812
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
'arrays',
'parameters'
],
]
],
))
->setRiskyAllowed(true)
->setFinder($finder)
Expand Down
2 changes: 1 addition & 1 deletion src/Command/MakerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return 0;
}

public function setApplication(Application $application = null): void
public function setApplication(?Application $application = null): void
{
parent::setApplication($application);

Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/DoctrineHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function getEntitiesForAutocomplete(): array
return $entities;
}

public function getMetadata(string $classOrNamespace = null, bool $disconnected = false): array|ClassMetadata
public function getMetadata(?string $classOrNamespace = null, bool $disconnected = false): array|ClassMetadata
{
// Invalidating the cached AttributeDriver::$classNames to find new Entity classes
foreach ($this->mappingDriversByPrefix ?? [] as $managerName => $prefixes) {
Expand Down
4 changes: 2 additions & 2 deletions src/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class Generator
public function __construct(
private FileManager $fileManager,
private string $namespacePrefix,
PhpCompatUtil $phpCompatUtil = null,
TemplateComponentGenerator $templateComponentGenerator = null,
?PhpCompatUtil $phpCompatUtil = null,
?TemplateComponentGenerator $templateComponentGenerator = null,
) {
$this->twigHelper = new GeneratorTwigHelper($fileManager);
$this->namespacePrefix = trim($namespacePrefix, '\\');
Expand Down
2 changes: 1 addition & 1 deletion src/InputAwareMakerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
*/
interface InputAwareMakerInterface extends MakerInterface
{
public function configureDependencies(DependencyBuilder $dependencies, InputInterface $input = null);
public function configureDependencies(DependencyBuilder $dependencies, ?InputInterface $input = null);
}
2 changes: 1 addition & 1 deletion src/Maker/AbstractMaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected function writeSuccessMessage(ConsoleStyle $io)
$io->newLine();
}

protected function addDependencies(array $dependencies, string $message = null): string
protected function addDependencies(array $dependencies, ?string $message = null): string
{
$dependencyBuilder = new DependencyBuilder();

Expand Down
2 changes: 1 addition & 1 deletion src/Maker/MakeAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ private function userClassHasEncoder(array $securityData, string $userClass): bo
return $userNeedsEncoder;
}

public function configureDependencies(DependencyBuilder $dependencies, InputInterface $input = null): void
public function configureDependencies(DependencyBuilder $dependencies, ?InputInterface $input = null): void
{
$dependencies->addClassDependency(
SecurityBundle::class,
Expand Down
12 changes: 6 additions & 6 deletions src/Maker/MakeEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
use Symfony\Bundle\MakerBundle\InputConfiguration;
use Symfony\Bundle\MakerBundle\Str;
use Symfony\Bundle\MakerBundle\Util\ClassDetails;
use Symfony\Bundle\MakerBundle\Util\ClassSource\Model\ClassProperty;
use Symfony\Bundle\MakerBundle\Util\ClassSourceManipulator;
use Symfony\Bundle\MakerBundle\Util\CliOutputHelper;
use Symfony\Bundle\MakerBundle\Util\ClassSource\Model\ClassProperty;
use Symfony\Bundle\MakerBundle\Util\PhpCompatUtil;
use Symfony\Bundle\MakerBundle\Validator;
use Symfony\Component\Console\Command\Command;
Expand All @@ -53,10 +53,10 @@ final class MakeEntity extends AbstractMaker implements InputAwareMakerInterface
public function __construct(
private FileManager $fileManager,
private DoctrineHelper $doctrineHelper,
string $projectDirectory = null,
Generator $generator = null,
EntityClassGenerator $entityClassGenerator = null,
PhpCompatUtil $phpCompatUtil = null,
?string $projectDirectory = null,
?Generator $generator = null,
?EntityClassGenerator $entityClassGenerator = null,
?PhpCompatUtil $phpCompatUtil = null,
) {
if (null !== $projectDirectory) {
@trigger_error('The $projectDirectory constructor argument is no longer used since 1.41.0', \E_USER_DEPRECATED);
Expand Down Expand Up @@ -309,7 +309,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
]);
}

public function configureDependencies(DependencyBuilder $dependencies, InputInterface $input = null): void
public function configureDependencies(DependencyBuilder $dependencies, ?InputInterface $input = null): void
{
if (null !== $input && $input->getOption('api-resource')) {
$dependencies->addClassDependency(
Expand Down
2 changes: 1 addition & 1 deletion src/Maker/MakeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
]);
}

public function configureDependencies(DependencyBuilder $dependencies, InputInterface $input = null): void
public function configureDependencies(DependencyBuilder $dependencies, ?InputInterface $input = null): void
{
if (null === $input) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/Maker/MakeUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
$io->text($nextSteps);
}

public function configureDependencies(DependencyBuilder $dependencies, InputInterface $input = null): void
public function configureDependencies(DependencyBuilder $dependencies, ?InputInterface $input = null): void
{
// checking for SecurityBundle guarantees security.yaml is present
$dependencies->addClassDependency(
Expand Down
2 changes: 1 addition & 1 deletion src/Renderer/FormTypeRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct(
) {
}

public function render(ClassNameDetails $formClassDetails, array $formFields, ClassNameDetails $boundClassDetails = null, array $constraintClasses = [], array $extraUseClasses = []): void
public function render(ClassNameDetails $formClassDetails, array $formFields, ?ClassNameDetails $boundClassDetails = null, array $constraintClasses = [], array $extraUseClasses = []): void
{
$fieldTypeUseStatements = [];
$fields = [];
Expand Down
4 changes: 2 additions & 2 deletions src/Security/InteractiveSecurityHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
final class InteractiveSecurityHelper
{
public function guessFirewallName(SymfonyStyle $io, array $securityData, string $questionText = null): string
public function guessFirewallName(SymfonyStyle $io, array $securityData, ?string $questionText = null): string
{
$realFirewalls = array_filter(
$securityData['security']['firewalls'] ?? [],
Expand All @@ -45,7 +45,7 @@ static function ($item) {
);
}

public function guessUserClass(SymfonyStyle $io, array $providers, string $questionText = null): string
public function guessUserClass(SymfonyStyle $io, array $providers, ?string $questionText = null): string
{
if (1 === \count($providers) && isset(current($providers)['entity'])) {
$entityProvider = current($providers);
Expand Down
2 changes: 1 addition & 1 deletion src/Security/UserClassBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
namespace Symfony\Bundle\MakerBundle\Security;

use PhpParser\Node;
use Symfony\Bundle\MakerBundle\Util\ClassSourceManipulator;
use Symfony\Bundle\MakerBundle\Util\ClassSource\Model\ClassProperty;
use Symfony\Bundle\MakerBundle\Util\ClassSourceManipulator;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;

Expand Down
6 changes: 3 additions & 3 deletions src/Util/YamlSourceManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ private function decrementDepth()
--$this->depth;
}

private function getCurrentIndentation(int $override = null): string
private function getCurrentIndentation(?int $override = null): string
{
$indent = $override ?? $this->indentationForDepths[$this->depth];

Expand Down Expand Up @@ -1174,7 +1174,7 @@ private function manuallyIncrementIndentation()
$this->indentationForDepths[$this->depth] += $this->getPreferredIndentationSize();
}

private function isEOF(int $position = null)
private function isEOF(?int $position = null)
{
$position = null === $position ? $this->currentPosition : $position;

Expand Down Expand Up @@ -1296,7 +1296,7 @@ private function isCharLineBreak(string $char): bool
* Usually an empty line needs to be prepended to this result before
* adding to the content.
*/
private function indentMultilineYamlArray(string $yaml, int $indentOverride = null): string
private function indentMultilineYamlArray(string $yaml, ?int $indentOverride = null): string
{
$indent = $this->getCurrentIndentation($indentOverride);

Expand Down
6 changes: 3 additions & 3 deletions src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static function validateClassName(string $className, string $errorMessage
return $className;
}

public static function notBlank(string $value = null): string
public static function notBlank(?string $value = null): string
{
if (null === $value || '' === $value) {
throw new RuntimeCommandException('This value cannot be blank.');
Expand Down Expand Up @@ -176,7 +176,7 @@ public static function validateEmailAddress(?string $email): string
return $email;
}

public static function existsOrNull(string $className = null, array $entities = []): ?string
public static function existsOrNull(?string $className = null, array $entities = []): ?string
{
if (null !== $className) {
self::validateClassName($className);
Expand Down Expand Up @@ -204,7 +204,7 @@ public static function classExists(string $className, string $errorMessage = '')
return $className;
}

public static function entityExists(string $className = null, array $entities = []): string
public static function entityExists(?string $className = null, array $entities = []): string
{
self::notBlank($className);

Expand Down
2 changes: 1 addition & 1 deletion tests/Util/AutoloaderUtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function testIsNamespaceConfiguredToAutoload()
}
}

private function createComposerAutoloaderFinder(array $composerJsonParams = null): ComposerAutoloaderFinder
private function createComposerAutoloaderFinder(?array $composerJsonParams = null): ComposerAutoloaderFinder
{
$composerJsonParams = $composerJsonParams ?: [
'autoload' => [
Expand Down
10 changes: 5 additions & 5 deletions tests/Util/ClassSourceManipulatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
use Symfony\Bundle\MakerBundle\Doctrine\RelationManyToOne;
use Symfony\Bundle\MakerBundle\Doctrine\RelationOneToMany;
use Symfony\Bundle\MakerBundle\Doctrine\RelationOneToOne;
use Symfony\Bundle\MakerBundle\Util\ClassSourceManipulator;
use Symfony\Bundle\MakerBundle\Util\ClassSource\Model\ClassProperty;
use Symfony\Bundle\MakerBundle\Util\ClassSourceManipulator;
use Symfony\Component\Security\Core\User\UserInterface;

class ClassSourceManipulatorTest extends TestCase
Expand Down Expand Up @@ -185,7 +185,7 @@ public function getAddSetterTests(): \Generator
/**
* @dataProvider getAttributeClassTests
*/
public function testAddAttributeToClass(string $sourceFilename, string $expectedSourceFilename, string $attributeClass, array $attributeOptions, string $attributePrefix = null): void
public function testAddAttributeToClass(string $sourceFilename, string $expectedSourceFilename, string $attributeClass, array $attributeOptions, ?string $attributePrefix = null): void
{
$source = file_get_contents(__DIR__.'/fixtures/source/'.$sourceFilename);
$expectedSource = file_get_contents(__DIR__.'/fixtures/add_class_attribute/'.$expectedSourceFilename);
Expand Down Expand Up @@ -242,7 +242,7 @@ public function getAddEntityFieldTests(): \Generator

yield 'entity_normal_add' => [
'User_simple.php',
new ClassProperty(propertyName: 'fooProp', type: 'string', length: 255, nullable: false, options: ['comment' => 'new field']),
new ClassProperty(propertyName: 'fooProp', type: 'string', length: 255, nullable: false, options: ['comment' => 'new field']),
'User_simple.php',
];

Expand Down Expand Up @@ -389,9 +389,9 @@ public function testAddOneToManyRelation(string $sourceFilename, string $expecte
$sourcePath = __DIR__.'/fixtures/source';
$expectedPath = __DIR__.'/fixtures/add_one_to_many_relation';

/** @legacy - Remove when Doctrine/ORM 2.x is no longer supported. */
/* @legacy - Remove when Doctrine/ORM 2.x is no longer supported. */
if (!class_exists(FieldMapping::class)) {
$expectedPath.= '/legacy';
$expectedPath .= '/legacy';
}

$this->runAddOneToManyRelationTests(
Expand Down

0 comments on commit cb48812

Please sign in to comment.