Skip to content
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

[BUGFIX] Fix missing “null” annotation for parameter $sectionName #813

Merged
merged 4 commits into from
Nov 20, 2023
Merged

[BUGFIX] Fix missing “null” annotation for parameter $sectionName #813

merged 4 commits into from
Nov 20, 2023

Conversation

magicsunday
Copy link
Contributor

@magicsunday magicsunday commented Sep 26, 2023

Correct $sectionName's annotation that this can be null. Add missing default values to method parameters.

@mbrodala
Copy link
Contributor

Can you explain in more detail why this change is necessary?

Currently the only call to this method in Fluid itself is in the RenderViewHelper which does provide all necessary arguments:

$content = $view->renderPartial($partial, $section, $variables, $optional);

@magicsunday
Copy link
Contributor Author

magicsunday commented Sep 26, 2023

Because, for example, I create an instance of StandaloneView in a middleware to render a partial. I don't need a section there. Phpstan then issues an error here (Parameter #2 $sectionName of method TYPO3Fluid\Fluid\View\AbstractTemplateView::renderPartial() expects string, null given.). Furthermore, the annotation in @param is simply wrong because the method checks for !== null, but the annotated type is "string". And if $sectionName is checked for null, so the value can be null, then it can also be defined and initialized as a default value in the method. Everything else is unclean in my opinion.

@mbrodala
Copy link
Contributor

Thanks for the explanation, makes sense. And $variables is either passed to renderSection() where it is optional or to VariableProviderInterface::getScopeCopy() which enforces a constructor where $variables are optional.

So all in all 👍

@s2b
Copy link
Contributor

s2b commented Sep 26, 2023

LGTM, can be merged once #814 is merged and the branch has been rebased.

@s2b
Copy link
Contributor

s2b commented Sep 26, 2023

Can you also adjust your commit message to use one of the prefixes described here:
https://docs.typo3.org/m/typo3/guide-contributionworkflow/main/en-us/Appendix/CommitMessage.html#summary-line-first-line

and a shorter title with an optional longer description if necessary.

@magicsunday magicsunday changed the title Fix missing default variable values, Corrected $sectionName's annotat… [BUGFIX] Fix missing “null” annotation for parameter $sectionName Sep 27, 2023
@s2b
Copy link
Contributor

s2b commented Oct 4, 2023

Can you fix the CGL issue in your changes?

@s2b
Copy link
Contributor

s2b commented Nov 20, 2023

Just did some CGL changes, nothing substantial, so I'm merging without additional review.

@s2b s2b enabled auto-merge (squash) November 20, 2023 11:22
@s2b s2b disabled auto-merge November 20, 2023 11:23
@s2b s2b merged commit f1395e2 into TYPO3:main Nov 20, 2023
2 checks passed
@kitsunet
Copy link
Contributor

kitsunet commented Nov 28, 2023

This change breaks API as the signature of AbstractTemplateView::renderPartial is no longer in line with the Interface which does not declare those arguments optional, this minor release containing it (2.10.0) breaks for Neos. :(

@s2b
Copy link
Contributor

s2b commented Nov 28, 2023

@kitsunet Ugh, sorry about that. Will take a look at it tomorrow!

You're talking about https://github.com/neos/fluidadaptor, right?

@kitsunet
Copy link
Contributor

In this case https://github.com/neos/form/blob/master/Classes/Core/Renderer/FluidFormRenderer.php#L203
The fix is easy, will do it tomorrow, was just unexpected to see CI breaking

kitsunet added a commit to neos/form that referenced this pull request Nov 29, 2023
Avoid fatal error due to changes in fluid.

See TYPO3/Fluid#813
@lolli42
Copy link
Member

lolli42 commented Nov 29, 2023

So neos/form adapted its implementation. There is nothing more to do for us, here, right?

@kitsunet
Copy link
Contributor

Nope, all good :)

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.

5 participants