Issue Bug Closed

#96657ExtensionConfigurationExtensionNotConfiguredException and ExtensionConfigurationPathDoesNotExistException are marked as @internal

Stephan Großberndt 01/27/22, 13:03 updated 10/04/22, 14:14

Description

ExtensionConfigurationExtensionNotConfiguredException and ExtensionConfigurationPathDoesNotExistException are marked as internal@

But if you want to fetch the extension configuration you have to use GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('my_ext') – e.g. like this:

use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException;
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException;

class Foo {
    public function __construct() {
        try {
            $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('my_ext');
        } catch (ExtensionConfigurationExtensionNotConfiguredException|ExtensionConfigurationPathDoesNotExistException $e) {
            // show an error message on how to configure the extension
        }
    }
}

where ->get() may fail with the mentioned exceptions. So the extension authors have to handle them in their code (and PHPStorm complains because they are internal@).

The classes are marked as internal@ because they should not be constructed outside of TYPO3 core, but with the current internal@ mark their “use” statement for catching is reported as well.

Reviews 2