Skip to content

Conversation

brotkrueml
Copy link
Contributor

  • Avoid GeneralUtility::makeInstance(), use DI instead (class has to be set public therefore)
  • Use newly introduced request attribute to retrieve current page ID as best practise
  • Add request where missing as argument and improve docblock
  • Streamline namespace to be in line with other examples

Releases: main

- Avoid GeneralUtility::makeInstance(), use DI instead (has to be set public therefore)
- Use newly introduced request attribute to retrieve current page ID as best practise
- Add request where missing as argument and improve docblock
- Streamline namespace to be in line with other examples

Releases: main
['header'],
'tt_content',
['pid' => (int)$GLOBALS['TSFE']->id],
// The request attribute 'frontend.page.information' has been introduced
Copy link
Member

Choose a reason for hiding this comment

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

I would mention such information in the text not as a coment in the code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was by intention: Then it is to far away from the context. Ppl tend to just copy/paste without reading text above or below the code snippet. So, they copy the comment with it.

Copy link
Member

Choose a reason for hiding this comment

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

If they copy this comment they start wondering what a version switch is as they are then not in the context of the docs anymore

* @param array TypoScript configuration
* @param string Empty string (no content to process)
* @param array TypoScript configuration
* @param ServerRequestInterface $request The current PSR-7 request object
Copy link
Member

Choose a reason for hiding this comment

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

This comment contains no information beyond what the FQN would give you?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It also does not harm, Maybe not everyone knows what a ServerRequestInterface is.

Copy link
Contributor

Choose a reason for hiding this comment

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

We have 2 request objects in TYPO3. The original TYPO3 Request also known als TYPO3_REQUEST and the Extbase Request (which is dying with each further TYPO3 version). What about:

Suggested change
* @param ServerRequestInterface $request The current PSR-7 request object
* @param ServerRequestInterface $request The TYPO3 request object

@brotkrueml
Copy link
Contributor Author

Abandoned. Someone feel free to pick it up again.

@brotkrueml brotkrueml closed this Sep 8, 2024
@brotkrueml brotkrueml deleted the modernize-cobj-user-example branch September 8, 2024 19:45
@brotkrueml brotkrueml restored the modernize-cobj-user-example branch September 9, 2024 07:36
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.

3 participants