[TYPO3-core] RFC: #9318: Enhance and fix tslib_eidtools

Dmitry Dulepov [typo3] dmitry at typo3.org
Fri Sep 12 08:38:12 CEST 2008


Hi!

Benjamin Mack wrote:
> for this function, couldn't we put the three first lines of comment in 
> the beginning into the main comment structure?
> 
> +    /**
> +     * Makes TCA available inside eID
> +     *
> +     * @return    void
> +     */
> +    public static function initTCA() {
> +        // It is possible that $TCA is an array but it was not loaded 
> properly.
> +        // This happens if some badly made extension attempts to 
> manipulate
> +        // $TCA in the ext_localconf.php.
> +        if (!is_array($GLOBALS['TCA']) || 
> !isset($GLOBALS['TCA']['pages'])) {

This comment explain the "if" statement on the line 4. I agree it is not very obvious :( What if I rephrase it like: "Some badly made extensions attempt to manipulate TCA in a wrong way (inside ext_localconf.php). Therefore $TCA may become an array but in fact it is not loaded. The check below ensure that TCA is still loaded if such bad extensions are installed". Does this sound better?

I think the comment should stay before "if" and not inside phpDoc because it really applies to "if"-only. What do you think?

> Also, what's the reason for putting the function as "final"? (maybe I 
> don't see it).

The function is not final but the class is. This class has only static methods. We have such classes declared as "final" now. A good example would be t3lib_div.

> Other than that, +1 after reading.

Does +1 remain with comment before "if" and not in phpDoc? :)

-- 
Dmitry Dulepov
TYPO3 Core team
My TYPO3 book: http://www.packtpub.com/typo3-extension-development/book
In the blog: http://typo3bloke.net/pages/book-reviews/presentation-zen-by-garr-reynolds/


More information about the TYPO3-team-core mailing list