-
Notifications
You must be signed in to change notification settings - Fork 443
Remove backslashes from DateTime references #6280
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
Conversation
The backslash is not part of the class name. It is only needed if you do not have a "use DateTime;" statement.
jokumer
left a comment
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.
Looks good
|
We are always using Fully Quallified names here and the FQN of DateTime is \DateTime. This way it is uniquely differnicated form other implementations called DateTime |
|
This is wrong. What you mean is FQDN. And it has much more than a leading backslash. https://www.checkdomain.de/hosting/lexikon/fqdn The TYPO3 documentation uses class names almost everywhere without leading backslashes. |
|
The Interface comes from PHP which has the root namespace And I agree, for distinction we should always use the full namespace if we notice it. Removing the absolutely identifying namespace is not good. |
|
Ok, I was wrong with the term FQDN. What is a fully qualified name in PHP? |
|
Without sticking to any FQ... expressions, I personally think the slash doesn't hurt inside the class and it's directly clear, that it's a PHP class and not an individual one. Relating to the reasoning of @linawolf it might also avoid the need to use aliases for individual DateTime implementations. |
|
Here is the answer from Chatgpt: "Is it recommended to have a leading backslash for a class name in a PHP documentation?"
|
|
I don't think your talk with ChatGTP adds anything useful but rather adds confusion. The fact that the code is in the documentation isn't of interest, as documentation and real-case-code are usually expected to have no fundamental differences. Notation of placeholders for classes or variables might be special cases where notation in documentation might differ or at least individual values have to be added by replacements. like in Your solution would add the PHP class with the use-statement which maps Beside the arguments which are mentioned in this thread already, your adjustment would overhaul the TYPO3 specific convention and require to replace all cases of PHP classes in the whole documentation, so this adjustment had a huge impact, no matter about any practical value, and should rather be started with a basic discussion than a simple single commit. |
|
@david: I cannot follow your argumentations. Is there really such a TYPO3 convention about a backslash before a class name? Where is it? |
|
@franzholz your question was very general, so chatGTP answered generally too -- too general to cover any specific use-cases. And if with the answer any sources are mentioned, you should link these sources perhaps.
If no specific namespace is written with the class-name the current namespace is used. So if you have a Controller with namespace Concerning the conventions I didn't find the specific document or paragraph, I found two links possibly of interest which were broken. I'm sure, @linawolf could help. |
|
@david: Yes, the PHP code is clear about the usage of a classname like |
|
For not so experienced programmers or people who just start programming those small differences might have huge negative impact, as it's, especially in the beginning, hard to know which details are important, which can be ignored. So if you want to change it, just find the right arguments to convince the community. Personally I don't think that it's worth it to think longer time about it, but if you've good arguments someone will perhaps agree with you. Keep in mind that you never had to convince the documentation team only but also the core programmers, as if consequently used, also according comments throughout the source-code had to be adjusted perhaps. |
The backslash is not part of the class name. It is only needed if you do not have a "use DateTime;" statement.