Skip to content

CS Update #1453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 7, 2024
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
2 changes: 1 addition & 1 deletion src/Autocomplete/src/Doctrine/EntitySearchUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(private EntityMetadataFactory $metadataFactory)
/**
* Adapted from easycorp/easyadmin EntityRepository.
*/
public function addSearchClause(QueryBuilder $queryBuilder, string $query, string $entityClass, array $searchableProperties = null): void
public function addSearchClause(QueryBuilder $queryBuilder, string $query, string $entityClass, ?array $searchableProperties = null): void
{
$entityMetadata = $this->metadataFactory->create($entityClass);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ public function __construct(
) {
}

public function loadChoiceList(callable $value = null): ChoiceListInterface
public function loadChoiceList(?callable $value = null): ChoiceListInterface
{
return $this->choiceList ??= new ArrayChoiceList([], $value);
}

public function loadChoicesForValues(array $values, callable $value = null): array
public function loadChoicesForValues(array $values, ?callable $value = null): array
{
$choices = $this->decorated->loadChoicesForValues($values, $value);
$this->choiceList = new ArrayChoiceList($choices, $value);

return $choices;
}

public function loadValuesForChoices(array $choices, callable $value = null): array
public function loadValuesForChoices(array $choices, ?callable $value = null): array
{
$values = $this->decorated->loadValuesForChoices($choices, $value);
$this->loadChoicesForValues($values, $value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function testItCanSearchOnRelationFields(): void
/**
* @return array<Product>
*/
private function callAddSearchClass(string $search, array $searchableProperties = null): array
private function callAddSearchClass(string $search, ?array $searchableProperties = null): array
{
/** @var ManagerRegistry $registry */
$registry = self::getContainer()->get('doctrine');
Expand Down
2 changes: 1 addition & 1 deletion src/LazyImage/src/BlurHash/BlurHash.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class BlurHash implements BlurHashInterface
{
private $imageManager;

public function __construct(ImageManager $imageManager = null)
public function __construct(?ImageManager $imageManager = null)
{
$this->imageManager = $imageManager;
}
Expand Down
4 changes: 2 additions & 2 deletions src/LiveComponent/src/Attribute/AsLiveComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ final class AsLiveComponent extends AsTwigComponent
* @param int $urlReferenceType Which type of URL should be generated for the given route. Use the constants from UrlGeneratorInterface (default: absolute path, e.g. "/dir/file").
*/
public function __construct(
string $name = null,
string $template = null,
?string $name = null,
?string $template = null,
private ?string $defaultAction = null,
bool $exposePublicProps = true,
string $attributesVar = 'attributes',
Expand Down
4 changes: 2 additions & 2 deletions src/LiveComponent/src/Attribute/LiveProp.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function __construct(
*
* @var string|string[]|null
*/
private null|string|array $onUpdated = null,
private string|array|null $onUpdated = null,

/**
* If true, this property will be synchronized with a query parameter
Expand Down Expand Up @@ -193,7 +193,7 @@ public function acceptUpdatesFromParent(): bool
return $this->updateFromParent;
}

public function onUpdated(): null|string|array
public function onUpdated(): string|array|null
{
return $this->onUpdated;
}
Expand Down
4 changes: 2 additions & 2 deletions src/LiveComponent/src/ComponentToolsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ public function setLiveResponder(LiveResponder $liveResponder): void
$this->liveResponder = $liveResponder;
}

public function emit(string $eventName, array $data = [], string $componentName = null): void
public function emit(string $eventName, array $data = [], ?string $componentName = null): void
{
$this->liveResponder->emit($eventName, $data, $componentName);
}

public function emitUp(string $eventName, array $data = [], string $componentName = null): void
public function emitUp(string $eventName, array $data = [], ?string $componentName = null): void
{
$this->liveResponder->emitUp($eventName, $data, $componentName);
}
Expand Down
4 changes: 2 additions & 2 deletions src/LiveComponent/src/LiveResponder.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class LiveResponder
*/
private array $browserEventsToDispatch = [];

public function emit(string $eventName, array $data = [], string $componentName = null): void
public function emit(string $eventName, array $data = [], ?string $componentName = null): void
{
$this->eventsToEmit[] = [
'event' => $eventName,
Expand All @@ -38,7 +38,7 @@ public function emit(string $eventName, array $data = [], string $componentName
];
}

public function emitUp(string $eventName, array $data = [], string $componentName = null): void
public function emitUp(string $eventName, array $data = [], ?string $componentName = null): void
{
$this->eventsToEmit[] = [
'event' => $eventName,
Expand Down
2 changes: 1 addition & 1 deletion src/LiveComponent/src/Metadata/LivePropMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function getFormat(): ?string
return $this->liveProp->format();
}

public function onUpdated(): null|string|array
public function onUpdated(): string|array|null
{
return $this->liveProp->onUpdated();
}
Expand Down
2 changes: 1 addition & 1 deletion src/LiveComponent/src/Test/InteractsWithLiveComponents.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
trait InteractsWithLiveComponents
{
protected function createLiveComponent(string $name, array $data = [], KernelBrowser $client = null): TestLiveComponent
protected function createLiveComponent(string $name, array $data = [], ?KernelBrowser $client = null): TestLiveComponent
{
if (!$this instanceof KernelTestCase) {
throw new \LogicException(sprintf('The "%s" trait can only be used on "%s" classes.', __TRAIT__, KernelTestCase::class));
Expand Down
2 changes: 1 addition & 1 deletion src/LiveComponent/src/Test/TestLiveComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function response(): Response
return $this->client->getResponse();
}

private function request(array $content = [], string $action = null): self
private function request(array $content = [], ?string $action = null): self
{
$csrfToken = $this->csrfToken();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class DeterministicTwigIdCalculator
* @param bool $increment Whether to increment the counter for this file+line
* @param string|null $key An optional key to use instead of the incremented counter
*/
public function calculateDeterministicId(bool $increment = true, string $key = null): string
public function calculateDeterministicId(bool $increment = true, ?string $key = null): string
{
$lineData = $this->guessTemplateInfo();

Expand Down
2 changes: 1 addition & 1 deletion src/LiveComponent/src/Twig/TemplateCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(private \IteratorAggregate $templateIterator, privat
{
}

public function warmUp(string $cacheDir, string $buildDir = null): array
public function warmUp(string $cacheDir, ?string $buildDir = null): array
{
$map = [];
foreach ($this->templateIterator as $item) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function __construct(
* Calculates the array of extra attributes that should be added to the root
* component element to activate the live controller functionality.
*/
public function attributesForRendering(MountedComponent $mounted, ComponentMetadata $metadata, bool $isChildComponent, string $deterministicId = null): LiveAttributesCollection
public function attributesForRendering(MountedComponent $mounted, ComponentMetadata $metadata, bool $isChildComponent, ?string $deterministicId = null): LiveAttributesCollection
{
$attributesCollection = $this->attributeHelper->create();
$attributesCollection->setLiveController($mounted->getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public function testHandleCheckboxChanges(): void
],
], $dehydratedProps['form']);

$getUrl = function (array $props, array $updatedProps = null) {
$getUrl = function (array $props, ?array $updatedProps = null) {
$url = '/_components/form_with_many_different_fields_type?props='.urlencode(json_encode($props));
if (null !== $updatedProps) {
$url .= '&updated='.urlencode(json_encode($updatedProps));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ final class LiveComponentHydratorTest extends KernelTestCase
use LiveComponentTestHelper;
use ResetDatabase;

private function executeHydrationTestCase(callable $testFactory, int $minPhpVersion = null): void
private function executeHydrationTestCase(callable $testFactory, ?int $minPhpVersion = null): void
{
if (null !== $minPhpVersion && $minPhpVersion > \PHP_VERSION_ID) {
$this->markTestSkipped(sprintf('Test requires PHP version %s or higher.', $minPhpVersion));
Expand Down Expand Up @@ -140,7 +140,7 @@ private function executeHydrationTestCase(callable $testFactory, int $minPhpVers
/**
* @dataProvider provideDehydrationHydrationTests
*/
public function testCanDehydrateAndHydrateComponentWithTestCases(callable $testFactory, int $minPhpVersion = null): void
public function testCanDehydrateAndHydrateComponentWithTestCases(callable $testFactory, ?int $minPhpVersion = null): void
{
$this->executeHydrationTestCase($testFactory, $minPhpVersion);
}
Expand Down Expand Up @@ -1199,7 +1199,7 @@ public function __construct()
/**
* @dataProvider provideInvalidHydrationTests
*/
public function testInvalidTypeHydration(callable $testFactory, int $minPhpVersion = null): void
public function testInvalidTypeHydration(callable $testFactory, ?int $minPhpVersion = null): void
{
$this->executeHydrationTestCase($testFactory, $minPhpVersion);
}
Expand Down Expand Up @@ -1614,7 +1614,7 @@ public function getTest(LiveComponentMetadataFactory $metadataFactory): Hydratio
);
}

public function expectsExceptionDuringHydration(string $exceptionClass, string $exceptionMessage = null): self
public function expectsExceptionDuringHydration(string $exceptionClass, ?string $exceptionMessage = null): self
{
$this->expectedHydrationException = $exceptionClass;
$this->expectHydrationExceptionMessage = $exceptionMessage;
Expand Down
4 changes: 2 additions & 2 deletions src/StimulusBundle/src/Dto/StimulusAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function addController(string $controllerName, array $controllerValues =
/**
* @param array $parameters Parameters to pass to the action. Optional.
*/
public function addAction(string $controllerName, string $actionName, string $eventName = null, array $parameters = []): void
public function addAction(string $controllerName, string $actionName, ?string $eventName = null, array $parameters = []): void
{
$controllerName = $this->normalizeControllerName($controllerName);
$this->actions[] = [
Expand All @@ -90,7 +90,7 @@ public function addAction(string $controllerName, string $actionName, string $ev
* @param string $controllerName the Stimulus controller name
* @param string|null $targetNames The space-separated list of target names if a string is passed to the 1st argument. Optional.
*/
public function addTarget(string $controllerName, string $targetNames = null): void
public function addTarget(string $controllerName, ?string $targetNames = null): void
{
if (null === $targetNames) {
return;
Expand Down
8 changes: 4 additions & 4 deletions src/StimulusBundle/src/Twig/StimulusTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function appendStimulusController(StimulusAttributes $stimulusAttributes,
/**
* @param array $parameters Parameters to pass to the action. Optional.
*/
public function renderStimulusAction(string $controllerName, string $actionName = null, string $eventName = null, array $parameters = []): StimulusAttributes
public function renderStimulusAction(string $controllerName, ?string $actionName = null, ?string $eventName = null, array $parameters = []): StimulusAttributes
{
$stimulusAttributes = $this->stimulusHelper->createStimulusAttributes();
$stimulusAttributes->addAction($controllerName, $actionName, $eventName, $parameters);
Expand All @@ -81,7 +81,7 @@ public function renderStimulusAction(string $controllerName, string $actionName
/**
* @param array $parameters Parameters to pass to the action. Optional.
*/
public function appendStimulusAction(StimulusAttributes $stimulusAttributes, string $controllerName, string $actionName, string $eventName = null, array $parameters = []): StimulusAttributes
public function appendStimulusAction(StimulusAttributes $stimulusAttributes, string $controllerName, string $actionName, ?string $eventName = null, array $parameters = []): StimulusAttributes
{
$stimulusAttributes->addAction($controllerName, $actionName, $eventName, $parameters);

Expand All @@ -92,7 +92,7 @@ public function appendStimulusAction(StimulusAttributes $stimulusAttributes, str
* @param string $controllerName the Stimulus controller name
* @param string|null $targetNames The space-separated list of target names if a string is passed to the 1st argument. Optional.
*/
public function renderStimulusTarget(string $controllerName, string $targetNames = null): StimulusAttributes
public function renderStimulusTarget(string $controllerName, ?string $targetNames = null): StimulusAttributes
{
$stimulusAttributes = $this->stimulusHelper->createStimulusAttributes();
$stimulusAttributes->addTarget($controllerName, $targetNames);
Expand All @@ -104,7 +104,7 @@ public function renderStimulusTarget(string $controllerName, string $targetNames
* @param string $controllerName the Stimulus controller name
* @param string|null $targetNames The space-separated list of target names if a string is passed to the 1st argument. Optional.
*/
public function appendStimulusTarget(StimulusAttributes $stimulusAttributes, string $controllerName, string $targetNames = null): StimulusAttributes
public function appendStimulusTarget(StimulusAttributes $stimulusAttributes, string $controllerName, ?string $targetNames = null): StimulusAttributes
{
$stimulusAttributes->addTarget($controllerName, $targetNames);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function isOptional(): bool
return true;
}

public function warmUp(string $cacheDir, string $buildDir = null): array
public function warmUp(string $cacheDir, ?string $buildDir = null): array
{
$this->translationsDumper->dump(
...$this->translatorBag->getCatalogues()
Expand Down
2 changes: 1 addition & 1 deletion src/Turbo/src/Broadcaster/BroadcasterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
interface BroadcasterInterface
{
/**
* @param array{id?: string|string[], transports?: string|string[], topics?: string|string[], template?: string, rendered_action?: string, private?: boolean, sse_id?: string, sse_type?: string, sse_retry?: int} $options
* @param array{id?: string|string[], transports?: string|string[], topics?: string|string[], template?: string, rendered_action?: string, private?: bool, sse_id?: string, sse_type?: string, sse_retry?: int} $options
*/
public function broadcast(object $entity, string $action, array $options): void;
}
2 changes: 1 addition & 1 deletion src/Turbo/src/Broadcaster/IdAccessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class IdAccessor
private $propertyAccessor;
private $doctrine;

public function __construct(PropertyAccessorInterface $propertyAccessor = null, ManagerRegistry $doctrine = null)
public function __construct(?PropertyAccessorInterface $propertyAccessor = null, ?ManagerRegistry $doctrine = null)
{
$this->propertyAccessor = $propertyAccessor ?? (class_exists(PropertyAccess::class) ? PropertyAccess::createPropertyAccessor() : null);
$this->doctrine = $doctrine;
Expand Down
2 changes: 1 addition & 1 deletion src/Turbo/src/Broadcaster/TwigBroadcaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class TwigBroadcaster implements BroadcasterInterface
/**
* @param array<string, string> $templatePrefixes
*/
public function __construct(BroadcasterInterface $broadcaster, Environment $twig, array $templatePrefixes = [], IdAccessor $idAccessor = null)
public function __construct(BroadcasterInterface $broadcaster, Environment $twig, array $templatePrefixes = [], ?IdAccessor $idAccessor = null)
{
$this->broadcaster = $broadcaster;
$this->twig = $twig;
Expand Down
2 changes: 1 addition & 1 deletion src/Turbo/src/Doctrine/BroadcastListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ final class BroadcastListener implements ResetInterface
*/
private $removedEntities;

public function __construct(BroadcasterInterface $broadcaster, Reader $annotationReader = null)
public function __construct(BroadcasterInterface $broadcaster, ?Reader $annotationReader = null)
{
$this->reset();

Expand Down
2 changes: 1 addition & 1 deletion src/Turbo/src/Twig/TwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function getFunctions(): iterable
/**
* @param object|string $topic
*/
public function turboStreamListen(Environment $env, $topic, string $transport = null): string
public function turboStreamListen(Environment $env, $topic, ?string $transport = null): string
{
$transport = $transport ?? $this->default;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct(
private ComponentFactory $componentFactory,
private Environment $twig,
private readonly array $componentClassMap,
string $anonymousDirectory = null,
?string $anonymousDirectory = null,
) {
parent::__construct();
$this->anonymousDirectory = $anonymousDirectory ?? 'components';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct(
$this->hasStub = class_exists(ClassStub::class);
}

public function collect(Request $request, Response $response, \Throwable $exception = null): void
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/TwigComponent/src/Event/PreRenderEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function getTemplate(): string
/**
* Change the twig template used.
*/
public function setTemplate(string $template, int $index = null): self
public function setTemplate(string $template, ?int $index = null): self
{
$this->template = $template;
$this->templateIndex = $index;
Expand Down
2 changes: 1 addition & 1 deletion src/TwigComponent/src/Test/InteractsWithTwigComponents.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected function mountTwigComponent(string $name, array $data = []): object
/**
* @param array<string,string> $blocks
*/
protected function renderTwigComponent(string $name, array $data = [], string $content = null, array $blocks = []): RenderedComponent
protected function renderTwigComponent(string $name, array $data = [], ?string $content = null, array $blocks = []): RenderedComponent
{
if (!$this instanceof KernelTestCase) {
throw new \LogicException(sprintf('The "%s" trait can only be used on "%s" classes.', __TRAIT__, KernelTestCase::class));
Expand Down
2 changes: 1 addition & 1 deletion src/TwigComponent/src/Twig/PropsNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
class PropsNode extends Node
{
public function __construct(array $propsNames, array $values, $lineno = 0, string $tag = null)
public function __construct(array $propsNames, array $values, $lineno = 0, ?string $tag = null)
{
parent::__construct($values, ['names' => $propsNames], $lineno, $tag);
}
Expand Down
2 changes: 1 addition & 1 deletion src/TwigComponent/src/Twig/TwigPreLexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public function preLexComponents(string $input): string
return $output;
}

private function consumeComponentName(string $customExceptionMessage = null): string
private function consumeComponentName(?string $customExceptionMessage = null): string
{
$start = $this->position;
while ($this->position < $this->length && preg_match('/[A-Za-z0-9_:@\-.]/', $this->input[$this->position])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function demoAutoValidatingForm(LiveDemoRepository $liveDemoRepository):
}

#[Route('/form-collection-type/{id}', name: 'app_demo_live_component_form_collection_type', defaults: ['id' => null])]
public function demoFormCollectionType(LiveDemoRepository $liveDemoRepository, Request $request, TodoListRepository $todoListRepository, TodoList $todoList = null): Response
public function demoFormCollectionType(LiveDemoRepository $liveDemoRepository, Request $request, TodoListRepository $todoListRepository, ?TodoList $todoList = null): Response
{
if (!$todoList) {
$todoList = new TodoList();
Expand Down Expand Up @@ -106,7 +106,7 @@ public function chartJs(LiveDemoRepository $liveDemoRepository): Response
}

#[Route('/invoice/{id}', name: 'app_demo_live_component_invoice', defaults: ['id' => null])]
public function invoice(LiveDemoRepository $liveDemoRepository, Invoice $invoice = null): Response
public function invoice(LiveDemoRepository $liveDemoRepository, ?Invoice $invoice = null): Response
{
$invoice = $invoice ?? new Invoice();

Expand Down
Loading