diff --git a/docs/en/cookbook/custom_documentclass_mapper.rst b/docs/en/cookbook/custom_documentclass_mapper.rst index 36340a4d3..bb4d67892 100644 --- a/docs/en/cookbook/custom_documentclass_mapper.rst +++ b/docs/en/cookbook/custom_documentclass_mapper.rst @@ -62,9 +62,9 @@ custom mapper:: /* prepare the doctrine configuration */ $config = new \Doctrine\ODM\PHPCR\Configuration(); - $map = array( + $map = [ 'standard-templating-kit:pages/stkSection' => \Sandbox\MagnoliaBundle\Document\Section::class, - ); + ]; $mapper = new MagnoliaDocumentClassMapper($map); $config->setDocumentClassMapper($mapper); @@ -125,18 +125,18 @@ of instantiating the default one. An example from the `symfony cmf sandbox`_ $container ->register('doctrine.odm_configuration', '%doctrine_phpcr.odm.configuration.class%') - ->addMethodCall('setDocumentClassMapper', array( + ->addMethodCall('setDocumentClassMapper', [ new Reference('sandbox_magnolia.odm_mapper'), - )) + ]) ; $container ->setDefinition('sandbox_amgnolia.odm_mapper', new Definition( MagnoliaDocumentClassMapper::class, - array( - array( + [ + [ 'standard-templating-kit:pages/stkSection' => Section::class, - ), - ), + ], + ], )); .. _`symfony cmf sandbox`: https://github.com/symfony-cmf/cmf-sandbox/tree/magnolia_integration diff --git a/lib/Doctrine/ODM/PHPCR/Query/Builder/ConverterBase.php b/lib/Doctrine/ODM/PHPCR/Query/Builder/ConverterBase.php index 7caf40854..6411e35f6 100644 --- a/lib/Doctrine/ODM/PHPCR/Query/Builder/ConverterBase.php +++ b/lib/Doctrine/ODM/PHPCR/Query/Builder/ConverterBase.php @@ -3,7 +3,6 @@ namespace Doctrine\ODM\PHPCR\Query\Builder; use Doctrine\ODM\PHPCR\Exception\InvalidArgumentException; -use Doctrine\ODM\PHPCR\Query\Builder\AbstractNode as QBConstants; use PHPCR\Query\QOM\BindVariableValueInterface; use PHPCR\Query\QOM\ChildNodeInterface; use PHPCR\Query\QOM\ChildNodeJoinConditionInterface; @@ -117,7 +116,7 @@ protected function dispatchMany(array $nodes): void * * @return object|array - PHPCR QOM object or array of objects */ - public function dispatch(QBConstants $node) + public function dispatch(AbstractNode $node) { $methodName = sprintf('walk%s', $node->getName()); @@ -134,7 +133,7 @@ public function dispatch(QBConstants $node) /** * @return ColumnInterface[] */ - public function walkSelect(QBConstants $node): array + public function walkSelect(AbstractNode $node): array { $columns = []; @@ -175,7 +174,7 @@ public function walkSelectAdd(SelectAdd $node): array return $this->columns; } - public function walkFrom(QBConstants $node): SourceInterface + public function walkFrom(AbstractNode $node): SourceInterface { $source = $node->getChild(); $res = $this->dispatch($source); @@ -234,11 +233,11 @@ public function walkWhereOr(WhereOr $whereOr): ConstraintInterface protected function walkSourceJoin(SourceJoin $node): JoinInterface { - $left = $this->dispatch($node->getChildOfType(QBConstants::NT_SOURCE_JOIN_LEFT)); + $left = $this->dispatch($node->getChildOfType(AbstractNode::NT_SOURCE_JOIN_LEFT)); \assert($left instanceof SourceInterface); - $right = $this->dispatch($node->getChildOfType(QBConstants::NT_SOURCE_JOIN_RIGHT)); + $right = $this->dispatch($node->getChildOfType(AbstractNode::NT_SOURCE_JOIN_RIGHT)); \assert($right instanceof SourceInterface); - $cond = $this->dispatch($node->getChildOfType(QBConstants::NT_SOURCE_JOIN_CONDITION_FACTORY)); + $cond = $this->dispatch($node->getChildOfType(AbstractNode::NT_SOURCE_JOIN_CONDITION_FACTORY)); \assert($cond instanceof JoinConditionInterface); return $this->qomf()->join($left, $right, $node->getJoinType(), $cond); @@ -302,7 +301,7 @@ protected function walkSourceJoinConditionSameDocument(SourceJoinConditionSameDo ); } - protected function doWalkConstraintComposite(QBConstants $node, $method) + protected function doWalkConstraintComposite(AbstractNode $node, $method) { $children = $node->getChildren(); @@ -391,10 +390,10 @@ protected function walkConstraintChild(ConstraintChild $node): ChildNodeInterfac protected function walkConstraintComparison(ConstraintComparison $node): ComparisonInterface { $dynOp = $node->getChildOfType( - QBConstants::NT_OPERAND_DYNAMIC + AbstractNode::NT_OPERAND_DYNAMIC ); $statOp = $node->getChildOfType( - QBConstants::NT_OPERAND_STATIC + AbstractNode::NT_OPERAND_STATIC ); $phpcrDynOp = $this->dispatch($dynOp); @@ -412,7 +411,7 @@ protected function walkConstraintComparison(ConstraintComparison $node): Compari protected function walkConstraintNot(ConstraintNot $node): ConstraintInterface { $con = $node->getChildOfType( - QBConstants::NT_CONSTRAINT + AbstractNode::NT_CONSTRAINT ); $phpcrCon = $this->dispatch($con); @@ -464,7 +463,7 @@ protected function walkOperandDynamicName(OperandDynamicName $node): NodeNameInt protected function walkOperandDynamicLowerCase(OperandDynamicLowerCase $node): LowerCaseInterface { $child = $node->getChildOfType( - QBConstants::NT_OPERAND_DYNAMIC + AbstractNode::NT_OPERAND_DYNAMIC ); $phpcrChild = $this->dispatch($child); @@ -478,7 +477,7 @@ protected function walkOperandDynamicLowerCase(OperandDynamicLowerCase $node): L protected function walkOperandDynamicUpperCase(OperandDynamicUpperCase $node): UpperCaseInterface { $child = $node->getChildOfType( - QBConstants::NT_OPERAND_DYNAMIC + AbstractNode::NT_OPERAND_DYNAMIC ); $phpcrChild = $this->dispatch($child); @@ -513,7 +512,7 @@ protected function walkOrderBy(OrderBy $node): array foreach ($orderings as $ordering) { \assert($ordering instanceof Ordering); $dynOp = $ordering->getChildOfType( - QBConstants::NT_OPERAND_DYNAMIC + AbstractNode::NT_OPERAND_DYNAMIC ); $phpcrDynOp = $this->dispatch($dynOp); diff --git a/tests/Doctrine/Tests/ODM/PHPCR/Query/QueryTest.php b/tests/Doctrine/Tests/ODM/PHPCR/Query/QueryTest.php index 69044f6f1..d3a3c5642 100644 --- a/tests/Doctrine/Tests/ODM/PHPCR/Query/QueryTest.php +++ b/tests/Doctrine/Tests/ODM/PHPCR/Query/QueryTest.php @@ -122,9 +122,9 @@ public function testExecuteParameters(): void ->method('bindValue') ->with( $this->callback(function (string $key): bool { - return $key === 'kfoo' || $key === 'kbar'; + return 'kfoo' === $key || 'kbar' === $key; }), $this->callback(function (string $value): bool { - return $value === 'bar' || $value === 'foo'; + return 'bar' === $value || 'foo' === $value; }) ) ; diff --git a/tests/phpunit_doctrine_dbal.xml.dist b/tests/phpunit_doctrine_dbal.xml.dist index 19bc21242..ec0ce1873 100644 --- a/tests/phpunit_doctrine_dbal.xml.dist +++ b/tests/phpunit_doctrine_dbal.xml.dist @@ -10,6 +10,7 @@ +