-
Notifications
You must be signed in to change notification settings - Fork 344
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
T&A 40791: Superglobals replacement in Test component #7803
Conversation
b84d423
to
377c484
Compare
377c484
to
c20fb05
Compare
Is this internally reviewed by @thojou or @mbecker-databay? If so, I add @kergomard as a reviewer here on GitHub. |
@dsstrassner Yes, this PR has been reviewed internally. All other refactorings look good to me. |
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.
Thank you very much @matheuszych and @thojou for this PRs!
First: Thank you very much for the boy-scouting! Much appreciated!
And then let us start with a more philosophical observation:
- This PR leaves me unsure in what direction we want to go. You know probably that I was not a big fan of the
InternalRequestService
and I'm still not happy with the dependence of ourRequestDataCollector
on theBaseGUIRequest
, but from where I stand in this PR we rather worsen the situation: We are increasing the dependece on theHTTP\Service
and keeping the one on ourRequestDataCollector
. Personally I would suggest to stick to theRequestDataCollector
and, if you have available time to remove the dependence on theBaseGUIRequest
, but this might be something to discuss. I think a case for keeping theRequestDataCollector
could be seen here and here and here. I think the abstraction away from direct access to an array-key, helps us to stick to a limited set of keys ...and it would remove duplicate code. Ideally the function should be calledgetQuestionIdsFromPost()
and this would be a clear sign that we should get rid of any uses of it.
Then I would have the following suggestion. You don't have to follow it, please provide an explanation if you don't, though:
- I would suggest to move this here back to depending on the Interface, if there is no very good reason not to. We should also move all other dependencies away from the implementation, if we have an interface, but this is for another time.
Please apply the following changes:
- If we go with this change: Please remove the check for an empty array here. It doesn't do anything anymore.
- Please keep the return types consistent here. I think you should return false and then we get a clear check on the next lines on true, as we know the variable has to always be a boolean, we can just check
if ($var)
- Please don't add any doc-blocks, if they are not absolutely necessary, and if you do add one, please make sure no redundant information is present there (so, no
@access public
). It just creates noise. - Could you please have a look at this here. I don't think you are checking for
$prev
to betrue
, you are checking for$prev
to not benull
, so we should be explicit about it. Additionally we could get rid of the quadrupel nesting by changing it toif ($key !== $first) {continue;} if ($prev !== null) {...
.
So, I think, I stop here. If you would like to discuss the whole philosophical issue just ping me, if not, I would suggest to stick to the RequestDataCollector
, ...at least in the classes we already have it.
Thanks again and best,
@kergomard
bf0403f
to
e48858a
Compare
I addressed the minor issues you mentioned. Further I will look into using the |
e48858a
to
125fb7e
Compare
…rding DataRequestCollector calls
125fb7e
to
a3bcf0c
Compare
@bidzanaaron and i implemented the requested changes regarding the |
@thojou will review internally and @kergomard could approve afterward and merge. |
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.
Thank you very much @matheuszych for the update!
I've only two little change requests:
- Could you please remove the fallback-parameter from the functions on the data_wrapper. My reasoning: The Wrapper should not and cannot know, when the fallback should be used. Is it when the corresponding key is not set? Is it when it is null? is it when it is the empty value of the variable-type? The consumer needs to know what data it needs, thus the wrapper should simply return null if the corresponding key is not set or the value if the key is set.
- And then the very trivial one: Please remove the
@throws
. We are not planing to react to them in any shape way or form, so we don't care.
As soon as this is done and rebased I will merge asap to avoid any more conflicts.
Thanks again and best,
@kergomard
Ok, I close this as we have a new version here. Thank you very much @matheuszych for pursuing this issue further. |
Superglobal variables such as $_GET or $_POST should not be accessed directly. Instead, use the request and refinery mechanisms. Currently, there are four instances where this change is not feasible due to limitations in the request and refinery systems, but these will be addressed in the future.
Mantis: 40791