Skip to content

Commit

Permalink
chore(di): use Autoconfigure attribute to set a class as public
Browse files Browse the repository at this point in the history
  • Loading branch information
brotkrueml committed Jan 23, 2025
1 parent 97fff32 commit 004a4a8
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 22 deletions.
2 changes: 2 additions & 0 deletions Classes/AdminPanel/SchemaModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@

use Brotkrueml\Schema\Cache\PagesCacheService;
use Brotkrueml\Schema\Extension;
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use TYPO3\CMS\Adminpanel\ModuleApi\AbstractModule;
use TYPO3\CMS\Adminpanel\ModuleApi\ShortInfoProviderInterface;

/**
* @internal
*/
#[Autoconfigure(public: true)]
final class SchemaModule extends AbstractModule implements ShortInfoProviderInterface
{
public function __construct(
Expand Down
2 changes: 2 additions & 0 deletions Classes/AdminPanel/TypesInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Brotkrueml\Schema\Cache\PagesCacheService;
use Brotkrueml\Schema\Extension;
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use TYPO3\CMS\Adminpanel\ModuleApi\ContentProviderInterface;
use TYPO3\CMS\Adminpanel\ModuleApi\ModuleData;
use TYPO3\CMS\Adminpanel\ModuleApi\ModuleInterface;
Expand All @@ -24,6 +25,7 @@
/**
* @internal
*/
#[Autoconfigure(public: true)]
final class TypesInformation implements ModuleInterface, ContentProviderInterface, ResourceProviderInterface
{
public function __construct(
Expand Down
2 changes: 2 additions & 0 deletions Classes/Cache/PagesCacheService.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@

namespace Brotkrueml\Schema\Cache;

use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;

/**
* @internal
*/
#[Autoconfigure(public: true)]
class PagesCacheService
{
private ?TypoScriptFrontendController $controller = null;
Expand Down
5 changes: 5 additions & 0 deletions Classes/Hooks/PageRenderer/SchemaMarkupInjection.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@
use Brotkrueml\Schema\Manager\SchemaManager;
use Psr\EventDispatcher\EventDispatcherInterface;
use Psr\Http\Message\ServerRequestInterface;
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use TYPO3\CMS\Core\Page\PageRenderer;

/**
* @internal
*/
#[Autoconfigure(public: true)]
final class SchemaMarkupInjection
{
public function __construct(
Expand Down
2 changes: 2 additions & 0 deletions Classes/JsonLd/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
use Brotkrueml\Schema\Core\Model\TypeInterface;
use Brotkrueml\Schema\Extension;
use Brotkrueml\Schema\Model\DataType\Boolean;
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;

/**
* @internal
*/
#[Autoconfigure(public: true)]
final class Renderer implements RendererInterface
{
private const CONTEXT = 'https://schema.org/';
Expand Down
2 changes: 2 additions & 0 deletions Classes/TypoScript/TypoScriptToSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@

use Brotkrueml\Schema\Core\Model\TypeInterface;
use Brotkrueml\Schema\Manager\SchemaManager;
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;

/**
* Convert any given TypoScript to proper schema types.
* The result will be added as single (nested) type to the SchemaManager.
* @internal
*/
#[Autoconfigure(public: true)]
final class TypoScriptToSchema
{
public function __construct(
Expand Down
2 changes: 2 additions & 0 deletions Classes/UserFunctions/FormEngine/WebPageTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
namespace Brotkrueml\Schema\UserFunctions\FormEngine;

use Brotkrueml\Schema\Type\TypeProvider;
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use TYPO3\CMS\Core\Information\Typo3Version;

/**
* Provides a user function used as itemProcFunc in TCA definition
* for pages.tx_schema_webpagetype field
* @internal
*/
#[Autoconfigure(public: true)]
final class WebPageTypes
{
public function __construct(
Expand Down
22 changes: 0 additions & 22 deletions Configuration/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

namespace Brotkrueml\Schema;

use Brotkrueml\Schema\AdminPanel\SchemaModule;
use Brotkrueml\Schema\AdminPanel\TypesInformation;
use Brotkrueml\Schema\Cache\PagesCacheService;
use Brotkrueml\Schema\Configuration\Configuration;
use Brotkrueml\Schema\Configuration\ConfigurationProvider;
Expand All @@ -23,12 +21,9 @@
use Brotkrueml\Schema\EventListener\RegisterRemovedTypePropertiesForPhysician;
use Brotkrueml\Schema\EventListener\RegisterTypePropertiesMovedFromOfficialToPending;
use Brotkrueml\Schema\Hooks\PageRenderer\SchemaMarkupInjection;
use Brotkrueml\Schema\JsonLd\Renderer;
use Brotkrueml\Schema\Lowlevel\ConfigurationModuleProvider\Types;
use Brotkrueml\Schema\Manager\SchemaManager;
use Brotkrueml\Schema\TypoScript\SchemaContentObject;
use Brotkrueml\Schema\TypoScript\TypoScriptToSchema;
use Brotkrueml\Schema\UserFunctions\FormEngine\WebPageTypes;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
Expand All @@ -53,29 +48,15 @@
'getConfiguration',
]);

$services->set(TypesInformation::class)
->public();

$services->set(SchemaMarkupInjection::class)
->public()
->arg('$configuration', service('schema.configuration'));

$services->set(Renderer::class)
->public();

$services->set(SchemaManager::class)
->arg('$configuration', service('schema.configuration'));

$services->set(TypoScriptToSchema::class)
->public();

$services->set(PagesCacheService::class)
->public()
->arg('$cache', service('cache.pages'));

$services->set(SchemaModule::class)
->public();

$services->set(AddBreadcrumbList::class)
->arg('$configuration', service('schema.configuration'))
->tag('event.listener', [
Expand Down Expand Up @@ -103,9 +84,6 @@
'identifier' => 'SCHEMA',
]);

$services->set(WebPageTypes::class)
->public();

$services->set('brotkrueml.schema.configuration.module.provider.types', Types::class)
->tag('lowlevel.configuration.module.provider', [
'identifier' => 'ext-schema/types',
Expand Down

0 comments on commit 004a4a8

Please sign in to comment.