Skip to content

Commit

Permalink
Merge pull request #5048 from mhsdesign/task/combineTwoNodeTypeNotFou…
Browse files Browse the repository at this point in the history
…ndExceptionsIntoOne

TASK: Combine two `NodeTypeNotFoundExceptions` into one
  • Loading branch information
mhsdesign committed May 15, 2024
2 parents 966097d + 1c58528 commit 8a4759a
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
use Neos\ContentRepository\Core\Infrastructure\Property\PropertyConverter;
use Neos\ContentRepository\Core\NodeType\NodeTypeManager;
use Neos\ContentRepository\Core\NodeType\NodeTypeName;
use Neos\ContentRepository\Core\Projection\ContentGraph\ContentSubgraphIdentity;
use Neos\ContentRepository\Core\Projection\ContentGraph\CoverageByOrigin;
use Neos\ContentRepository\Core\Projection\ContentGraph\DimensionSpacePointsBySubtreeTags;
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
Expand All @@ -36,8 +35,7 @@
use Neos\ContentRepository\Core\Projection\ContentGraph\Timestamps;
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFoundException;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFound;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateClassification;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepository\Core\SharedModel\Node\NodeName;
Expand Down Expand Up @@ -159,7 +157,7 @@ public function mapReferenceRowsToReferences(

/**
* @param array<int,array<string,string>> $nodeRows
* @throws NodeTypeNotFoundException
* @throws NodeTypeNotFound
*/
public function mapNodeRowsToNodeAggregate(
array $nodeRows,
Expand Down Expand Up @@ -243,7 +241,7 @@ public function mapNodeRowsToNodeAggregate(
/**
* @param iterable<int,array<string,string>> $nodeRows
* @return iterable<int,NodeAggregate>
* @throws NodeTypeNotFoundException
* @throws NodeTypeNotFound
*/
public function mapNodeRowsToNodeAggregates(
iterable $nodeRows,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeIsNotOfTypeRoot;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeIsOfTypeRoot;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFound;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFoundException;
use Neos\ContentRepository\Core\SharedModel\Exception\PropertyCannotBeSet;
use Neos\ContentRepository\Core\SharedModel\Exception\ReferenceCannotBeSet;
use Neos\ContentRepository\Core\SharedModel\Exception\RootNodeAggregateDoesNotExist;
Expand Down Expand Up @@ -172,7 +171,7 @@ protected function requireRootNodeTypeToBeUnoccupied(

/**
* @param NodeType $nodeType
* @throws NodeTypeNotFoundException the configured child nodeType doesnt exist
* @throws NodeTypeNotFound the configured child nodeType doesnt exist
*/
protected function requireTetheredDescendantNodeTypesToExist(NodeType $nodeType): void
{
Expand Down Expand Up @@ -312,7 +311,7 @@ protected function requireConstraintsImposedByAncestorsAreMet(
}

/**
* @throws NodeTypeNotFoundException
* @throws NodeTypeNotFound
* @throws NodeConstraintException
*/
protected function requireNodeTypeConstraintsImposedByParentToBeMet(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
use Neos\ContentRepository\Core\Projection\ContentGraph\ContentGraphInterface;
use Neos\ContentRepository\Core\Projection\ContentGraph\NodePath;
use Neos\ContentRepository\Core\SharedModel\Exception\ContentStreamDoesNotExistYet;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFoundException;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFound;
use Neos\ContentRepository\Core\SharedModel\Exception\PropertyCannotBeSet;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateClassification;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
Expand Down Expand Up @@ -122,7 +122,7 @@ private function validateProperties(?PropertyValuesToWrite $propertyValues, Node

/**
* @throws ContentStreamDoesNotExistYet
* @throws NodeTypeNotFoundException
* @throws NodeTypeNotFound
*/
private function handleCreateNodeAggregateWithNodeAndSerializedProperties(
CreateNodeAggregateWithNodeAndSerializedProperties $command,
Expand Down Expand Up @@ -252,7 +252,7 @@ private function createRegularWithNode(

/**
* @throws ContentStreamDoesNotExistYet
* @throws NodeTypeNotFoundException
* @throws NodeTypeNotFound
*/
private function handleTetheredChildNodes(
CreateNodeAggregateWithNodeAndSerializedProperties $command,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
use Neos\ContentRepository\Core\SharedModel\Exception\NodeAggregatesTypeIsAmbiguous;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeConstraintException;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFound;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFoundException;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepository\Core\SharedModel\Node\NodeName;

Expand Down Expand Up @@ -97,7 +96,7 @@ abstract protected function createEventsForMissingTetheredNode(
/**
* @throws NodeTypeNotFound
* @throws NodeConstraintException
* @throws NodeTypeNotFoundException
* @throws NodeTypeNotFound
* @throws NodeAggregatesTypeIsAmbiguous
* @throws \Exception
*/
Expand Down Expand Up @@ -225,7 +224,7 @@ private function handleChangeNodeAggregateType(
/**
* NOTE: when changing this method, {@see NodeTypeChange::deleteDisallowedNodesWhenChangingNodeType}
* needs to be modified as well (as they are structurally the same)
* @throws NodeConstraintException|NodeTypeNotFoundException
* @throws NodeConstraintException|NodeTypeNotFound
*/
private function requireConstraintsImposedByHappyPathStrategyAreMet(
ContentGraphInterface $contentGraph,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
use Neos\ContentRepository\Core\SharedModel\Exception\NodeAggregatesTypeIsAmbiguous;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeIsNotOfTypeRoot;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFound;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFoundException;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateClassification;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepository\Core\SharedModel\Node\NodeName;
Expand Down Expand Up @@ -180,7 +179,7 @@ private function handleUpdateRootNodeAggregateDimensions(

/**
* @throws ContentStreamDoesNotExistYet
* @throws NodeTypeNotFoundException
* @throws NodeTypeNotFound
*/
private function handleTetheredRootChildNodes(
ContentStreamId $contentStreamId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ function () use ($commandHandlingDependencies, $remainingCommands) {
* @throws WorkspaceDoesNotExist
* @throws WorkspaceHasNoBaseWorkspaceName
* @throws \Neos\ContentRepository\Core\SharedModel\Exception\NodeConstraintException
* @throws \Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFoundException
* @throws \Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFound
* @throws \Symfony\Component\Serializer\Exception\ExceptionInterface
*/
private function handleDiscardIndividualNodesFromWorkspace(
Expand Down
10 changes: 5 additions & 5 deletions Neos.ContentRepository.Core/Classes/NodeType/NodeTypeManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use Neos\ContentRepository\Core\NodeType\Exception\TetheredNodeNotConfigured;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeConfigurationException;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeIsFinalException;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFoundException;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFound;
use Neos\ContentRepository\Core\SharedModel\Node\NodeName;
use Neos\Utility\Arrays;
use Neos\Utility\Exception\PropertyNotAccessibleException;
Expand Down Expand Up @@ -108,7 +108,7 @@ public function getSubNodeTypes(string|NodeTypeName $superTypeName, bool $includ
/**
* Returns the specified node type (which could be abstract)
*
* @throws NodeTypeNotFoundException
* @throws NodeTypeNotFound
*/
public function getNodeType(string|NodeTypeName $nodeTypeName): ?NodeType
{
Expand Down Expand Up @@ -269,7 +269,7 @@ public function isNodeTypeAllowedAsChildToTetheredNode(NodeType $parentNodeType,
* @param array<string,mixed> $completeNodeTypeConfiguration the full node type configuration for all node types
* @throws NodeConfigurationException
* @throws NodeTypeIsFinalException
* @throws NodeTypeNotFoundException
* @throws NodeTypeNotFound
*/
private function loadNodeType(string $nodeTypeName, array &$completeNodeTypeConfiguration): NodeType
{
Expand All @@ -278,7 +278,7 @@ private function loadNodeType(string $nodeTypeName, array &$completeNodeTypeConf
}

if (!isset($completeNodeTypeConfiguration[$nodeTypeName])) {
throw new NodeTypeNotFoundException('Node type "' . $nodeTypeName . '" does not exist', 1316451800);
throw new NodeTypeNotFound('Node type "' . $nodeTypeName . '" does not exist', 1316451800);
}

$nodeTypeConfiguration = $completeNodeTypeConfiguration[$nodeTypeName];
Expand Down Expand Up @@ -384,7 +384,7 @@ private function evaluateSuperTypeConfiguration(
*/
public function requireNodeType(string|NodeTypeName $nodeTypeName): NodeType
{
return $this->getNodeType($nodeTypeName) ?? throw new NodeTypeNotFoundException(
return $this->getNodeType($nodeTypeName) ?? throw new NodeTypeNotFound(
sprintf(
'The node type "%s" is not available',
$nodeTypeName instanceof NodeTypeName ? $nodeTypeName->value : $nodeTypeName
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Neos\ContentRepository\Core\NodeType\NodeTypeName;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeConfigurationException;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeIsFinalException;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFoundException;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFound;
use PHPUnit\Framework\TestCase;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Neos\ContentRepository\Core\DimensionSpace\VariantType;
use Neos\ContentRepository\Core\NodeType\NodeTypeManager;
use Neos\ContentRepository\Core\NodeType\NodeTypeName;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFoundException;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFound;

class DimensionAdjustment
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

use Behat\Gherkin\Node\TableNode;
use Neos\ContentRepository\Core\NodeType\NodeTypeName;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFoundException;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFound;
use Neos\ContentRepository\StructureAdjustment\Adjustment\StructureAdjustment;
use Neos\ContentRepository\StructureAdjustment\StructureAdjustmentService;
use Neos\ContentRepository\StructureAdjustment\StructureAdjustmentServiceFactory;
Expand All @@ -31,7 +31,7 @@ trait StructureAdjustmentsTrait

/**
* @When /^I adjust the node structure for node type "([^"]*)"$/
* @throws NodeTypeNotFoundException
* @throws NodeTypeNotFound
*/
public function iAdjustTheNodeStructureForNodeType(string $nodeTypeName): void
{
Expand All @@ -45,7 +45,7 @@ public function iAdjustTheNodeStructureForNodeType(string $nodeTypeName): void

/**
* @Then I expect no needed structure adjustments for type :nodeTypeName
* @throws NodeTypeNotFoundException
* @throws NodeTypeNotFound
*/
public function iExpectNoStructureAdjustmentsForType(string $nodeTypeName): void
{
Expand All @@ -58,7 +58,7 @@ public function iExpectNoStructureAdjustmentsForType(string $nodeTypeName): void

/**
* @Then /^I expect the following structure adjustments for type "([^"]*)":$/
* @throws NodeTypeNotFoundException
* @throws NodeTypeNotFound
*/
public function iExpectTheFollowingStructureAdjustmentsForType(string $nodeTypeName, TableNode $expectedAdjustments): void
{
Expand Down
4 changes: 2 additions & 2 deletions Neos.Media.Browser/Classes/Controller/UsageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindClosestNodeFilter;
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFoundException;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFound;
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Flow\Annotations as Flow;
Expand Down Expand Up @@ -107,7 +107,7 @@ public function relatedNodesAction(AssetInterface $asset)
);
try {
$nodeType = $contentRepository->getNodeTypeManager()->getNodeType($nodeAggregate->nodeTypeName);
} catch (NodeTypeNotFoundException $e) {
} catch (NodeTypeNotFound $e) {
$nodeType = null;
}

Expand Down
4 changes: 2 additions & 2 deletions Neos.Neos/Classes/Command/SiteCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace Neos\Neos\Command;

use Neos\ContentRepository\Core\SharedModel\Exception\NodeNameIsAlreadyCovered;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFoundException;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFound;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Cli\CommandController;
use Neos\Flow\Package\PackageManager;
Expand Down Expand Up @@ -89,7 +89,7 @@ public function createCommand($name, $packageKey, $nodeType, $nodeName = null, $

try {
$this->siteService->createSite($packageKey, $name, $nodeType, $nodeName, $inactive);
} catch (NodeTypeNotFoundException $exception) {
} catch (NodeTypeNotFound $exception) {
$this->outputLine('<error>The given node type "%s" was not found</error>', [$nodeType]);
$this->quit(1);
} catch (SiteNodeTypeIsInvalid $exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use Neos\ContentRepository\Core\Projection\Workspace\Workspace;
use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeNameIsAlreadyCovered;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFoundException;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFound;
use Neos\ContentRepository\Core\SharedModel\Node\NodeName;
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
Expand Down Expand Up @@ -389,7 +389,7 @@ public function createSiteNodeAction($packageKey, $siteName, $nodeType)
{
try {
$site = $this->siteService->createSite($packageKey, $siteName, $nodeType);
} catch (NodeTypeNotFoundException $exception) {
} catch (NodeTypeNotFound $exception) {
$this->addFlashMessage(
$this->getModuleLabel('sites.siteCreationError.givenNodeTypeNotFound.body', [$nodeType]),
$this->getModuleLabel('sites.siteCreationError.givenNodeTypeNotFound.title'),
Expand Down
4 changes: 2 additions & 2 deletions Neos.Neos/Classes/Domain/Service/SiteServiceInternals.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
use Neos\ContentRepository\Core\NodeType\NodeTypeName;
use Neos\ContentRepository\Core\Projection\ContentGraph\NodeAggregate;
use Neos\ContentRepository\Core\Service\ContentRepositoryBootstrapper;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFoundException;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFound;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepository\Core\SharedModel\Node\NodeVariantSelectionStrategy;
use Neos\Neos\Domain\Exception\SiteNodeTypeIsInvalid;
Expand Down Expand Up @@ -85,7 +85,7 @@ public function createSiteNodeIfNotExists(Site $site, string $nodeTypeName): voi
);
$siteNodeType = $this->nodeTypeManager->getNodeType($nodeTypeName);
if (!$siteNodeType) {
throw new NodeTypeNotFoundException(
throw new NodeTypeNotFound(
'Cannot create a site using a non-existing node type.',
1412372375
);
Expand Down
4 changes: 2 additions & 2 deletions Neos.Neos/Classes/Fusion/Cache/ContentCacheFlusher.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Neos\ContentRepository\Core\NodeType\NodeTypeName;
use Neos\ContentRepository\Core\Projection\ContentGraph\NodeAggregate;
use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFoundException;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFound;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
Expand Down Expand Up @@ -276,7 +276,7 @@ function (array $types, NodeType $superType) use ($self) {
/**
* Fetches possible usages of the asset and registers nodes that use the asset as changed.
*
* @throws NodeTypeNotFoundException
* @throws NodeTypeNotFound
*/
public function registerAssetChange(AssetInterface $asset): void
{
Expand Down

0 comments on commit 8a4759a

Please sign in to comment.