Skip to content

Conversation

@wiewiurdp
Copy link
Contributor

@wiewiurdp wiewiurdp commented Aug 18, 2025

🎫 Issue IBX-10507

Description:

Updated method signatures to use nullable type hints for improved code readability and consistency.

@wiewiurdp wiewiurdp changed the title Update method signatures to use nullable type hints for improved code… IBX-10507: Updated method signatures to use nullable type hints for improved code readability and consistency. Aug 18, 2025
@wiewiurdp wiewiurdp marked this pull request as ready for review August 18, 2025 14:03
* @param string|null $field
* @param mixed $value
*/
private function createAndPublishContent($field, $value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use strict types here instead?

$imageFileList: '@Ibexa\Bundle\Core\Imagine\VariationPurger\LegacyStorageImageFileList'
$variationPathGenerator: '@ibexa.image_alias.variation_path_generator'
$filterConfiguration: "@liip_imagine.filter.configuration"
$imagesDir: "%ibexa.site_access.config.default.image.published_images_dir%"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While at it, for consistency:

Suggested change
$imagesDir: "%ibexa.site_access.config.default.image.published_images_dir%"
$imagesDir: '%ibexa.site_access.config.default.image.published_images_dir%'

if ($path[0] === '/' && $this->siteAccess->matcher instanceof SiteAccess\URILexer) {
$path = $this->siteAccess->matcher->analyseLink($path);
if (
$this->siteAccess === null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd actually prefer here to see:

Suggested change
$this->siteAccess === null
!isset($this->siteAccess)

because on main the property has a strict type, so if it's not set, trying to do $this->siteAccess === null will result in a fatal error if property was not initialized.

Comment on lines 1079 to 1081
* @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo|null $versionInfo
* @param \Ibexa\Contracts\Core\Repository\Values\User\User|null $creator if set given user is used to create the draft - otherwise the current-user is used
* @param \Ibexa\Contracts\Core\Repository\Values\Content\Language|null if not set the draft is created with the initialLanguage code of the source version or if not present with the main language.
* @param \Ibexa\Contracts\Core\Repository\Values\Content\Language|null $language if not set the draft is created with the initialLanguage code of the source version or if not present with the main language.
Copy link
Member

@alongosz alongosz Aug 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these doc blocks are 1:1 copy of the interface doc for the method, they can be removed here as they're inherited by default.


/**
* @param \Ibexa\Contracts\Core\Repository\Values\Content\URLAlias
* @param \Ibexa\Contracts\Core\Repository\Values\Content\URLAlias $createdUrlAlias
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These can be simply removed, there's already a strict type there, so this doc block doesn't add any extra value


/**
* @param \Ibexa\Contracts\Core\Repository\Values\Content\URLAlias
* @param array<mixed> $testData
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most likely array{\Ibexa\Contracts\Core\Repository\Values\Content\URLAlias, int} (at least based on the variable names later on)

* Return a list of user's browser preferred locales directly from Accept-Language header.
*
* @param \Symfony\Component\HttpFoundation\Request request to retrieve information from, use current if null
* @param \Symfony\Component\HttpFoundation\Request $request
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obsolete as we have strict typing in method arguments

* @param int $languageArgumentIndex From 0 and up, so the array index on $arguments.
*/
final public function testForLanguagesLookup($method, array $arguments, $return, $languageArgumentIndex, callable $callback = null, int $alwaysAvailableArgumentIndex = null)
final public function testForLanguagesLookup($method, array $arguments, $return, $languageArgumentIndex, ?callable $callback = null, ?int $alwaysAvailableArgumentIndex = null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can split it into multiple lines for readability

* @param int $languageArgumentIndex From 0 and up, so the array index on $arguments.
*/
final public function testForLanguagesPassTrough($method, array $arguments, $return, $languageArgumentIndex, callable $callback = null, int $alwaysAvailableArgumentIndex = null)
final public function testForLanguagesPassTrough($method, array $arguments, $return, $languageArgumentIndex, ?callable $callback = null, ?int $alwaysAvailableArgumentIndex = null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

… proper formatting and annotation adjustments
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
4.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@adamwojs adamwojs merged commit 8608e1e into 4.6 Aug 20, 2025
23 of 24 checks passed
@adamwojs adamwojs deleted the IBX-10507-fixing-implicitly-nullable-parameters branch August 20, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants