-
Notifications
You must be signed in to change notification settings - Fork 17
IBX-10507: Updated method signatures to use nullable type hints for improved code readability and consistency. #636
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
IBX-10507: Updated method signatures to use nullable type hints for improved code readability and consistency. #636
Conversation
… readability and consistency.
… readability and consistency.
| * @param string|null $field | ||
| * @param mixed $value | ||
| */ | ||
| private function createAndPublishContent($field, $value) |
There was a problem hiding this comment.
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%" |
There was a problem hiding this comment.
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:
| $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 |
There was a problem hiding this comment.
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:
| $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.
| * @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. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
|


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