Skip to content

Commit

Permalink
Merge pull request #114 from neos/feature/remove-injections
Browse files Browse the repository at this point in the history
FEATURE: Remove injections of removed services
  • Loading branch information
ahaeslich authored Dec 18, 2024
2 parents 33bb8cb + 48515ef commit 59fd1fc
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 1 deletion.
9 changes: 8 additions & 1 deletion config/set/contentrepository-90.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,16 @@
// Remove injections to classes which are gone now
$rectorConfig->ruleWithConfiguration(RemoveInjectionsRector::class, [
new RemoveInjection(\Neos\ContentRepository\Domain\Service\ContextFactoryInterface::class),
new RemoveInjection(\Neos\ContentRepository\Domain\Service\ContextFactory::class),
new RemoveInjection(\Neos\Neos\Domain\Service\ContentContextFactory::class),
new RemoveInjection(\Neos\Rector\ContentRepository90\Legacy\LegacyContextStub::class),
new RemoveInjection(\Neos\ContentRepository\Domain\Service\ContentDimensionCombinator::class),
new RemoveInjection(\Neos\ContentRepository\Domain\Factory\NodeFactory::class),
new RemoveInjection(\Neos\ContentRepository\Domain\Repository\WorkspaceRepository::class)
new RemoveInjection(\Neos\ContentRepository\Domain\Repository\WorkspaceRepository::class),
new RemoveInjection(\Neos\ContentRepository\Core\NodeType\NodeTypeManager::class),
new RemoveInjection(\Neos\Neos\Domain\Service\NodeSearchServiceInterface::class),
new RemoveInjection(\Neos\Neos\Domain\Service\NodeSearchService::class),
new RemoveInjection(\Neos\ContentRepository\Domain\Repository\NodeDataRepository::class),
]);

// todo these ToStringToMethodCallOrPropertyFetchRector rules are likely mostly obsolete and only to migrate from one Neos 9 beta to another but NOT for upgrading from 8.3
Expand Down
119 changes: 119 additions & 0 deletions tests/Sets/ContentRepository90/Fixture/inject-removal.php.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<?php

namespace Neos\Rector\Test;

use Neos\Flow\Annotations as Flow;
use Neos\ContentRepository\Domain\Service\Context;

class SomeClass extends AnotherClass
{
/**
* @Flow\Inject
* @var \Neos\Neos\KeepThis
*/
private $keepThisBecauseItDoesNotNeedToGetRemoved;

/**
* @var \Neos\Neos\Domain\Service\NodeSearchServiceInterface
*/
private $keepThisBecauseNoInject;

/**
* @Flow\Inject
* @var \Neos\Neos\Domain\Service\NodeSearchServiceInterface
*/
private $nodeSearchServiceInterface;

/**
* @Flow\Inject
* @var \Neos\Neos\Domain\Service\NodeSearchService
*/
private $nodeSearchService;

/**
* @Flow\Inject
* @var \Neos\ContentRepository\Domain\Service\NodeTypeManager
*/
protected $nodeTypeManagerNew;

/**
* @Flow\Inject
* @var \Neos\ContentRepository\Core\NodeType\NodeTypeManager
*/
protected $nodeTypeManagerOld;

/**
* @Flow\Inject
* @var \Neos\Neos\Domain\Service\ContentContextFactory
*/
protected $contentContextFactory;

/**
* @Flow\Inject
* @var \Neos\ContentRepository\Domain\Service\ContextFactoryInterface
*/
protected $contentRepositoryContextFactoryInterface;

/**
* @Flow\Inject
* @var \Neos\ContentRepository\Domain\Service\ContextFactory
*/
protected $contentRepositoryContextFactory;

/**
* @Flow\Inject
* @var \Neos\ContentRepository\Domain\Service\Context
*/
protected $context;

/**
* @Flow\Inject
* @var \Neos\Neos\Domain\Service\ContentContext
*/
protected $contentContext;

/**
* @Flow\Inject
* @var \Neos\ContentRepository\Domain\Repository\NodeDataRepository
*/
protected $nodeDataRepository;

/**
* @Flow\Inject
* @var \Neos\ContentRepository\Domain\Repository\WorkspaceRepository
*/
protected $workspaceRepository;
/**
* @Flow\Inject
* @var \Neos\ContentRepository\Domain\Service\ContentDimensionCombinator
*/
protected $contentDimensionCombinator;
/**
* @Flow\Inject
* @var \Neos\ContentRepository\Domain\Factory\NodeFactory
*/
protected $nodeFactory;
}

-----
<?php

namespace Neos\Rector\Test;

use Neos\Flow\Annotations as Flow;
use Neos\ContentRepository\Domain\Service\Context;

class SomeClass extends AnotherClass
{
/**
* @Flow\Inject
* @var \Neos\Neos\KeepThis
*/
private $keepThisBecauseItDoesNotNeedToGetRemoved;

/**
* @var \Neos\Neos\Domain\Service\NodeSearchServiceInterface
*/
private $keepThisBecauseNoInject;
}

0 comments on commit 59fd1fc

Please sign in to comment.