Skip to content

Commit

Permalink
BAP-22912: Fix PHP 8.4 deprecation messages
Browse files Browse the repository at this point in the history
  • Loading branch information
mbessolov committed Jan 30, 2025
1 parent d561b6c commit dfcffd3
Show file tree
Hide file tree
Showing 156 changed files with 266 additions and 265 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function find(ButtonSearchContext $buttonSearchContext);
public function isAvailable(
ButtonInterface $button,
ButtonSearchContext $buttonSearchContext,
Collection $errors = null
?Collection $errors = null
);

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Oro/Bundle/ActionBundle/Helper/ContextHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ContextHelper
public function __construct(
DoctrineHelper $doctrineHelper,
PropertyAccessorInterface $propertyAccessor,
RequestStack $requestStack = null
?RequestStack $requestStack = null
) {
$this->doctrineHelper = $doctrineHelper;
$this->propertyAccessor = $propertyAccessor;
Expand All @@ -47,7 +47,7 @@ public function __construct(
* @param array|null $context
* @return array
*/
public function getContext(array $context = null)
public function getContext(?array $context = null)
{
if (null === $context) {
$route = $this->getRequestParameter(self::ROUTE_PARAM) ?: $this->getRequestParameter('_route');
Expand Down Expand Up @@ -102,7 +102,7 @@ public function getActionParameters(array $context)
* @param array|null $context
* @return ActionData
*/
public function getActionData(array $context = null)
public function getActionData(?array $context = null)
{
$context = $this->getContext($context);

Expand Down
4 changes: 2 additions & 2 deletions src/Oro/Bundle/ActionBundle/Model/ActionGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(
}

#[\Override]
public function execute(ActionData $data, Collection $errors = null): ActionData
public function execute(ActionData $data, ?Collection $errors = null): ActionData
{
$this->parametersResolver->resolve($data, $this, $errors);

Expand Down Expand Up @@ -76,7 +76,7 @@ public function getDefinition(): ActionGroupDefinition
}

#[\Override]
public function isAllowed(ActionData $data, Collection $errors = null): bool
public function isAllowed(ActionData $data, ?Collection $errors = null): bool
{
$guardEvent = new ActionGroupGuardEvent($data, $this->getDefinition(), $errors);
$this->eventDispatcher->dispatch($guardEvent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ParametersResolver
public function resolve(
ActionData $data,
ActionGroupInterface $actionGroup,
Collection $errors = null,
?Collection $errors = null,
bool $checkSnakeCase = false
) {
$violations = [];
Expand Down
4 changes: 2 additions & 2 deletions src/Oro/Bundle/ActionBundle/Model/ActionGroupInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface ActionGroupInterface
* @return ActionData
* @throws ForbiddenActionGroupException
*/
public function execute(ActionData $data, Collection $errors = null): ActionData;
public function execute(ActionData $data, ?Collection $errors = null): ActionData;

/**
* @return ActionGroupDefinition
Expand All @@ -30,7 +30,7 @@ public function getDefinition(): ActionGroupDefinition;
* @param Collection|null $errors
* @return bool
*/
public function isAllowed(ActionData $data, Collection $errors = null): bool;
public function isAllowed(ActionData $data, ?Collection $errors = null): bool;

/**
* @return array|Parameter[]
Expand Down
10 changes: 5 additions & 5 deletions src/Oro/Bundle/ActionBundle/Model/Operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function init(ActionData $data)
* @param Collection $errors
* @throws ForbiddenOperationException
*/
public function execute(ActionData $data, Collection $errors = null)
public function execute(ActionData $data, ?Collection $errors = null)
{
if (!$this->isAllowed($data, $errors)) {
throw new ForbiddenOperationException(sprintf('Operation "%s" is not allowed.', $this->getName()));
Expand Down Expand Up @@ -152,14 +152,14 @@ public function isAvailable(ActionData $data)
* @param Collection|null $errors
* @return bool
*/
public function isAllowed(ActionData $data, Collection $errors = null)
public function isAllowed(ActionData $data, ?Collection $errors = null)
{
return $this->isPreConditionAllowed($data, $errors)
&& $this->getDefinition()->getEnabled()
&& $this->isConditionAllowed($data, $errors);
}

private function isConditionAllowed(ActionData $data, Collection $errors = null): bool
private function isConditionAllowed(ActionData $data, ?Collection $errors = null): bool
{
$guardEvent = new OperationGuardEvent($data, $this->getDefinition(), $errors);
$this->eventDispatcher->dispatch($guardEvent);
Expand All @@ -179,7 +179,7 @@ private function isConditionAllowed(ActionData $data, Collection $errors = null)
* @param Collection|null $errors
* @return bool
*/
protected function isPreConditionAllowed(ActionData $data, Collection $errors = null)
protected function isPreConditionAllowed(ActionData $data, ?Collection $errors = null)
{
$announceEvent = new OperationAnnounceEvent($data, $this->getDefinition(), $errors);
$this->eventDispatcher->dispatch($announceEvent);
Expand Down Expand Up @@ -267,7 +267,7 @@ protected function executeActions(ActionData $data, $name)
* @param Collection|null $errors
* @return boolean
*/
protected function evaluateConditions(ActionData $data, $name, Collection $errors = null)
protected function evaluateConditions(ActionData $data, $name, ?Collection $errors = null)
{
if (!array_key_exists($name, $this->conditions)) {
$this->conditions[$name] = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function testInitializeExceptionInvalidTime()
/**
* @dataProvider executeDataProvider
*/
public function testExecute(array $options, \DateTime $expectedResult = null)
public function testExecute(array $options, ?\DateTime $expectedResult = null)
{
$context = new ItemStub([]);
$attributeName = (string)$options['attribute'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ protected function setUp(): void
public function testExecute(
array $types,
array $expected,
string $argument = null,
\Throwable $exception = null
?string $argument = null,
?\Throwable $exception = null
): void {
$this->input->expects($this->once())
->method('getArgument')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function testSetGroups()
/**
* @dataProvider isApplicableDataProvider
*/
public function testIsApplicable(ActionData $actionData, Operation $operation = null, bool $expected = false)
public function testIsApplicable(ActionData $actionData, ?Operation $operation = null, bool $expected = false)
{
$this->registry->expects($this->once())
->method('findByName')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function testGetRowConfiguration(
ResultRecord $record,
ButtonsCollection $buttonsCollection,
array $expectedActions,
array $groups = null
?array $groups = null
): void {
$this->buttonProvider->expects($this->any())
->method('match')
Expand Down Expand Up @@ -501,7 +501,7 @@ public function testOnConfigureActionsWithFewDatagrids(): void
);
}

private function getRowActionConfig(string $label = null, array $data = []): array
private function getRowActionConfig(?string $label = null, array $data = []): array
{
return array_merge([
'type' => 'button-widget',
Expand Down Expand Up @@ -535,7 +535,7 @@ private function createOperationButton(
string $name,
bool $isAvailable,
array $datagridOptions = [],
string $label = null
?string $label = null
): ButtonInterface {
$definition = $this->createMock(OperationDefinition::class);
$definition->expects($this->any())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function testSubmit(
array $submittedData,
ActionData $expectedData,
array $expectedChildrenOptions = [],
ActionData $expectedDefaultData = null
?ActionData $expectedDefaultData = null
) {
$form = $this->factory->create(OperationType::class, $defaultData, $inputOptions);

Expand Down Expand Up @@ -224,7 +224,7 @@ public function submitDataProvider(): array
/**
* @dataProvider exceptionDataProvider
*/
public function testException(array $options, string $exception, string $message, ActionData $data = null)
public function testException(array $options, string $exception, string $message, ?ActionData $data = null)
{
$this->expectException($exception);
$this->expectExceptionMessage($message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public function testGetActionData(
?Request $request,
int $requestStackCalls,
ActionData $expected,
array $context = null
?array $context = null
) {
$entity = new \stdClass();
$entity->id = 42;
Expand Down Expand Up @@ -393,7 +393,7 @@ public function testGetActionDataWithCache()
$this->assertEquals($actionData, $this->helper->getActionData($context2));
}

private function getEntity(int $id = null): object
private function getEntity(?int $id = null): object
{
$entity = new \stdClass();
$entity->id = $id;
Expand All @@ -402,9 +402,9 @@ private function getEntity(int $id = null): object
}

private function generateOperationToken(
string $entityClass = null,
?string $entityClass = null,
mixed $entityId = null,
string $datagrid = null
?string $datagrid = null
): string {
$array = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,8 @@ private function setEntityConfigProvider(
string $field,
bool $multiple = false,
bool $hasConfig = true,
string $label = null,
string $fieldType = null
?string $label = null,
?string $fieldType = null
): void {
$labelOption = $multiple ? 'plural_label' : 'label';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private function violationTypeProviderArgs(
string $type,
string $gotType,
string $gotValue,
string $customMessage = null
?string $customMessage = null
): array {
$typedParam = new Parameter($paramName);
$typedParam->setType($type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function guessClassAttributeFormDataProvider(): array
];
}

private function createAttribute(string $type, string $propertyPath = null, array $options = []): Attribute
private function createAttribute(string $type, ?string $propertyPath = null, array $options = []): Attribute
{
$attribute = new Attribute();
$attribute->setType($type)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public function findDataProvider(): array
public function testFindByName(
string $operationName,
?string $expected,
OperationFindCriteria $criteria = null,
?OperationFindCriteria $criteria = null,
array $filterResult = []
) {
$this->configurationProvider->expects($this->once())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class TestTarget
{
private ?int $id;

public function __construct(int $id = null)
public function __construct(?int $id = null)
{
$this->id = $id;
}
Expand Down
10 changes: 5 additions & 5 deletions src/Oro/Bundle/ActivityListBundle/Entity/ActivityList.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public function getOrganization()
*
* @return self
*/
public function setOrganization(Organization $organization = null)
public function setOrganization(?Organization $organization = null)
{
$this->organization = $organization;

Expand All @@ -317,7 +317,7 @@ public function setOrganization(Organization $organization = null)
*
* @return self
*/
public function setOwner(User $owner = null)
public function setOwner(?User $owner = null)
{
$this->owner = $owner;

Expand Down Expand Up @@ -346,7 +346,7 @@ public function getRelatedActivityClass()
* @return self
*/
#[\Override]
public function setUpdatedBy(User $updatedBy = null)
public function setUpdatedBy(?User $updatedBy = null)
{
$this->updatedBySet = false;
if ($updatedBy !== null) {
Expand Down Expand Up @@ -422,7 +422,7 @@ public function getCreatedAt()
* @return $this
*/
#[\Override]
public function setCreatedAt(\DateTimeInterface $createdAt = null)
public function setCreatedAt(?\DateTimeInterface $createdAt = null)
{
$this->createdAt = $createdAt;

Expand All @@ -444,7 +444,7 @@ public function getUpdatedAt()
* @return $this
*/
#[\Override]
public function setUpdatedAt(\DateTimeInterface $updatedAt = null)
public function setUpdatedAt(?\DateTimeInterface $updatedAt = null)
{
$this->updatedAtSet = false;
if ($updatedAt !== null) {
Expand Down
6 changes: 3 additions & 3 deletions src/Oro/Bundle/ActivityListBundle/Entity/ActivityOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function getOrganization()
*
* @return self
*/
public function setOrganization(Organization $organization = null)
public function setOrganization(?Organization $organization = null)
{
$this->organization = $organization;

Expand All @@ -84,7 +84,7 @@ public function getActivity()
*
* @return self
*/
public function setActivity(ActivityList $activity = null)
public function setActivity(?ActivityList $activity = null)
{
$this->activity = $activity;

Expand All @@ -96,7 +96,7 @@ public function setActivity(ActivityList $activity = null)
*
* @return self
*/
public function setUser(User $user = null)
public function setUser(?User $user = null)
{
$this->user = $user;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function getValueDataProvider(): array
];
}

private function getFieldMetadata(string $fieldName = null, array $options = []): FieldMetadata
private function getFieldMetadata(?string $fieldName = null, array $options = []): FieldMetadata
{
$result = $this->createMock(FieldMetadata::class);
$result->expects($this->any())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected function setUp(): void
$this->testActivityProvider = new TestActivityProvider();
}

private function getActivityListChainProvider(string $testActivityAclClass = null): ActivityListChainProvider
private function getActivityListChainProvider(?string $testActivityAclClass = null): ActivityListChainProvider
{
$activityAclClasses = [];
if ($testActivityAclClass) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ public function isEqualDataProvider(): array
];
}

private function createAddress(int $id = null): AbstractAddress
private function createAddress(?int $id = null): AbstractAddress
{
$address = $this->getMockForAbstractClass(AbstractAddress::class);
if (null !== $id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function isEqualDataProvider(): array
];
}

private function createEmail(string $email = null, int $id = null): AbstractEmail
private function createEmail(?string $email = null, ?int $id = null): AbstractEmail
{
$arguments = [];
if ($email) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function isEqualDataProvider(): array
];
}

private function createPhone(string $phone = null, int $id = null): AbstractPhone
private function createPhone(?string $phone = null, ?int $id = null): AbstractPhone
{
$arguments = [];
if ($phone) {
Expand Down
Loading

0 comments on commit dfcffd3

Please sign in to comment.