Improve typehint#382
Merged
VincentLanglet merged 3 commits intosonata-project:1.xfrom Apr 8, 2021
VincentLanglet:PhpdocType
Merged
Improve typehint#382VincentLanglet merged 3 commits intosonata-project:1.xfrom VincentLanglet:PhpdocType
VincentLanglet merged 3 commits intosonata-project:1.xfrom
VincentLanglet:PhpdocType
Conversation
phansys
reviewed
Apr 5, 2021
Member
phansys
left a comment
There was a problem hiding this comment.
Checking the configuration, the revision id seems to accept anything:
Maybe we could restrict the config to "integer" and "string".
Member
Author
It would be a BC-break no ? I think we will be able to restrict only for the next major... |
Member
Yes. We should deprecate the types that we consider invalid before. |
Member
Author
|
@phansys There is the following code: Would it work with string ? |
Member
I think the |
phansys
requested changes
Apr 6, 2021
phansys
previously approved these changes
Apr 7, 2021
franmomu
reviewed
Apr 8, 2021
| ->scalarNode('revision_id_field_type')->defaultValue('integer')->end() | ||
| ->scalarNode('revision_id_field_type') | ||
| ->defaultValue('integer') | ||
| // NEXT_MAJOR: Use validate() instead. |
franmomu
reviewed
Apr 8, 2021
| protected $revision; | ||
|
|
||
| public function __construct($className, $id, $revision) | ||
| public function __construct(?string $className, ?array $id, $revision) |
Member
There was a problem hiding this comment.
Suggested change
| public function __construct(?string $className, ?array $id, $revision) | |
| /** | |
| * @param int|string|null $revision | |
| */ | |
| public function __construct(?string $className, ?array $id, $revision) |
franmomu
previously approved these changes
Apr 8, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Subject
I am targeting this branch, because BC.
The
$revisionparam is often restrict tointbut could work with string too. (and SonataAdmin is usingint|string).The
$idseems to only work withint|string|arrayif I read the code.I also add some typehint for constructor or Exception/Object we're using.
This will fix some errors from https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/1386/checks?check_run_id=2265615169
Changelog