46
46
use WikibaseSolutions \CypherDSL \Patterns \Node ;
47
47
use WikibaseSolutions \CypherDSL \Patterns \Pattern ;
48
48
use WikibaseSolutions \CypherDSL \Patterns \Relationship ;
49
+ use WikibaseSolutions \CypherDSL \Syntax \Alias ;
49
50
use WikibaseSolutions \CypherDSL \Syntax \PropertyReplacement ;
50
51
use WikibaseSolutions \CypherDSL \Traits \ErrorTrait ;
51
52
use WikibaseSolutions \CypherDSL \Traits \EscapeTrait ;
52
53
use WikibaseSolutions \CypherDSL \Types \AnyType ;
53
54
use WikibaseSolutions \CypherDSL \Types \PropertyTypes \BooleanType ;
55
+ use WikibaseSolutions \CypherDSL \Types \PropertyTypes \IntegerType ;
54
56
use WikibaseSolutions \CypherDSL \Types \PropertyTypes \NumeralType ;
55
57
use WikibaseSolutions \CypherDSL \Types \StructuralTypes \StructuralType ;
56
58
@@ -319,13 +321,14 @@ public static function exists($match, $where = null, bool $insertParentheses = f
319
321
/**
320
322
* Creates a CALL sub query clause and adds it to the query.
321
323
*
322
- * @param Query|callable(Query):void $query A callable decorating a query, or the actual CALL subquery
324
+ * @note This feature is not part of the openCypher standard. For more information, see https://github.com/opencypher/openCypher/blob/a507292d35280aca9e37bf938cdec4fdd1e64ba9/docs/standardisation-scope.adoc.
325
+ *
326
+ * @param Query|callable(Query):void $query A callable decorating a query, or the actual subquery
323
327
* @param Variable|Pattern|string|Variable[]|Pattern[]|string[] $variables The variables to include in the WITH clause for correlation
324
328
*
325
- * @return Query
329
+ * @return $this
326
330
*
327
331
* @see https://neo4j.com/docs/cypher-manual/current/clauses/call-subquery/
328
- * @see CallClause
329
332
*/
330
333
public function call ($ query = null , $ variables = []): self
331
334
{
@@ -355,8 +358,9 @@ public function call($query = null, $variables = []): self
355
358
* Creates the CALL procedure clause.
356
359
*
357
360
* @param Procedure $procedure The procedure to call
358
- * @param string|Variable|string[]|Variable[] $yields The result fields that should be returned
359
- * @return Query
361
+ * @param string|Variable|Alias|string[]|Variable[]|Alias[] $yields The result fields that should be returned
362
+ *
363
+ * @return $this
360
364
*
361
365
* @see https://neo4j.com/docs/cypher-manual/current/clauses/call/
362
366
* @see https://s3.amazonaws.com/artifacts.opencypher.org/openCypher9.pdf (page 122)
@@ -403,14 +407,13 @@ public function match($patterns): self
403
407
/**
404
408
* Creates the RETURN clause.
405
409
*
406
- * @param AnyType|AnyType[] $expressions The expressions to return; if the array-key is
407
- * non-numerical, it is used as the alias
408
- * @param bool $distinct
410
+ * @param AnyType|Alias|Pattern|int|float|string|bool|array|AnyType[]|Alias[]|Pattern[]|int[]|float[]|string[]|bool[]|array[] $expressions The expressions to return
411
+ * @param bool $distinct Whether to be a RETURN DISTINCT query
409
412
*
410
413
* @return $this
411
414
*
412
- * @see https://neo4j.com/docs/cypher-manual/current/clauses/return/#return-column-alias
413
415
* @see https://neo4j.com/docs/cypher-manual/current/clauses/return/
416
+ * @see https://s3.amazonaws.com/artifacts.opencypher.org/openCypher9.pdf (page 74)
414
417
*/
415
418
public function returning ($ expressions , bool $ distinct = false ): self
416
419
{
@@ -435,6 +438,7 @@ public function returning($expressions, bool $distinct = false): self
435
438
* @return $this
436
439
*
437
440
* @see https://neo4j.com/docs/cypher-manual/current/clauses/create/
441
+ * @see https://s3.amazonaws.com/artifacts.opencypher.org/openCypher9.pdf (page 99)
438
442
*/
439
443
public function create ($ patterns ): self
440
444
{
@@ -482,6 +486,7 @@ public function delete($structures, bool $detach = false): self
482
486
*
483
487
* @return $this
484
488
* @see https://neo4j.com/docs/cypher-manual/current/clauses/delete/
489
+ * @see https://s3.amazonaws.com/artifacts.opencypher.org/openCypher9.pdf (page 105)
485
490
* @deprecated Use Query::delete(..., true) instead
486
491
*/
487
492
public function detachDelete ($ variables ): self
@@ -512,10 +517,12 @@ public function limit($limit): self
512
517
/**
513
518
* Creates the SKIP clause.
514
519
*
515
- * @param NumeralType |int|float $amount The amount to skip
520
+ * @param IntegerType |int $amount The amount to skip
516
521
*
517
522
* @return $this
523
+ *
518
524
* @see https://neo4j.com/docs/cypher-manual/current/clauses/skip/
525
+ * @see https://s3.amazonaws.com/artifacts.opencypher.org/openCypher9.pdf (page 96)
519
526
*/
520
527
public function skip ($ amount ): self
521
528
{
@@ -533,6 +540,7 @@ public function skip($amount): self
533
540
* @param CompletePattern $pattern The pattern to merge
534
541
* @param SetClause|null $createClause The clause to execute when the pattern is created
535
542
* @param SetClause|null $matchClause The clause to execute when the pattern is matched
543
+ *
536
544
* @return $this
537
545
*
538
546
* @see https://neo4j.com/docs/cypher-manual/current/clauses/merge/
@@ -542,14 +550,8 @@ public function merge(CompletePattern $pattern, SetClause $createClause = null,
542
550
{
543
551
$ mergeClause = new MergeClause ();
544
552
$ mergeClause ->setPattern ($ pattern );
545
-
546
- if (isset ($ createClause )) {
547
- $ mergeClause ->setOnCreate ($ createClause );
548
- }
549
-
550
- if (isset ($ matchClause )) {
551
- $ mergeClause ->setOnMatch ($ matchClause );
552
- }
553
+ $ mergeClause ->setOnCreate ($ createClause );
554
+ $ mergeClause ->setOnMatch ($ matchClause );
553
555
554
556
$ this ->clauses [] = $ mergeClause ;
555
557
@@ -560,6 +562,7 @@ public function merge(CompletePattern $pattern, SetClause $createClause = null,
560
562
* Creates the OPTIONAL MATCH clause.
561
563
*
562
564
* @param CompletePattern|CompletePattern[] $patterns A single pattern or a list of patterns
565
+ *
563
566
* @return $this
564
567
*
565
568
* @see https://neo4j.com/docs/cypher-manual/current/clauses/optional-match/
@@ -586,8 +589,9 @@ public function optionalMatch($patterns): self
586
589
* @param bool $descending Whether to order in descending order
587
590
*
588
591
* @return $this
589
- * @see https://neo4j.com/docs/cypher-manual/current/clauses/order-by/
590
592
*
593
+ * @see https://neo4j.com/docs/cypher-manual/current/clauses/order-by/
594
+ * @see https://s3.amazonaws.com/artifacts.opencypher.org/openCypher9.pdf (page 93)
591
595
*/
592
596
public function orderBy ($ properties , bool $ descending = false ): self
593
597
{
@@ -610,8 +614,9 @@ public function orderBy($properties, bool $descending = false): self
610
614
* @param Property|Label|Property[]|Label[] $expressions The expressions to remove (should either be a Node or a Property)
611
615
*
612
616
* @return $this
613
- * @see https://neo4j.com/docs/cypher-manual/current/clauses/remove/
614
617
*
618
+ * @see https://neo4j.com/docs/cypher-manual/current/clauses/remove/
619
+ * @see https://s3.amazonaws.com/artifacts.opencypher.org/openCypher9.pdf (page 113)
615
620
*/
616
621
public function remove ($ expressions ): self
617
622
{
@@ -633,8 +638,9 @@ public function remove($expressions): self
633
638
* @param PropertyReplacement|Label|PropertyReplacement[]|Label[] $expressions A single expression or a list of expressions
634
639
*
635
640
* @return $this
636
- * @see https://neo4j.com/docs/cypher-manual/current/clauses/set/
637
641
*
642
+ * @see https://neo4j.com/docs/cypher-manual/current/clauses/set/
643
+ * @see https://s3.amazonaws.com/artifacts.opencypher.org/openCypher9.pdf (page 107)
638
644
*/
639
645
public function set ($ expressions ): self
640
646
{
@@ -653,12 +659,14 @@ public function set($expressions): self
653
659
/**
654
660
* Creates the WHERE clause.
655
661
*
656
- * @param BooleanType|BooleanType[] $expressions The expression to match
662
+ * @param BooleanType|bool| BooleanType[]|bool [] $expressions The expression to match
657
663
* @param string $operator The operator with which to unify the given expressions, should be either WhereClause::OR,
658
664
* WhereClause::AND or WhereClause::XOR
659
665
*
660
666
* @return $this
667
+ *
661
668
* @see https://neo4j.com/docs/cypher-manual/current/clauses/where/
669
+ * @see https://s3.amazonaws.com/artifacts.opencypher.org/openCypher9.pdf (page 83)
662
670
*/
663
671
public function where ($ expressions , string $ operator = WhereClause::AND ): self
664
672
{
@@ -680,10 +688,12 @@ public function where($expressions, string $operator = WhereClause::AND): self
680
688
/**
681
689
* Creates the WITH clause.
682
690
*
683
- * @param AnyType[]|AnyType $expressions The entries to add; if the array-key is non-numerical, it is used as the alias
691
+ * @param AnyType|Alias|Pattern|int|float|string|bool|array|AnyType[]|Alias[]|Pattern[]|int[]|float[]|string[]|bool[]|array[] $expressions The entries to add; if the array-key is non-numerical, it is used as the alias
692
+ *
693
+ * @return $this
684
694
*
685
- * @return Query
686
695
* @see https://neo4j.com/docs/cypher-manual/current/clauses/with/
696
+ * @see https://s3.amazonaws.com/artifacts.opencypher.org/openCypher9.pdf (page 78)
687
697
*/
688
698
public function with ($ expressions ): self
689
699
{
@@ -704,7 +714,8 @@ public function with($expressions): self
704
714
*
705
715
* @param string $clause The name of the clause; for instance "MATCH"
706
716
* @param string $subject The subject/body of the clause
707
- * @return Query
717
+ *
718
+ * @return $this
708
719
*/
709
720
public function raw (string $ clause , string $ subject ): self
710
721
{
@@ -719,9 +730,10 @@ public function raw(string $clause, string $subject): self
719
730
* @param Query|callable(Query):void $queryOrCallable The callable decorating a fresh query instance or the query instance to be attached after the union clause.
720
731
* @param bool $all Whether the union should include all results or remove the duplicates instead.
721
732
*
722
- * @return Query
733
+ * @return $this
723
734
*
724
735
* @see https://neo4j.com/docs/cypher-manual/current/clauses/union/
736
+ * @see https://s3.amazonaws.com/artifacts.opencypher.org/openCypher9.pdf (page 128)
725
737
*/
726
738
public function union ($ queryOrCallable , bool $ all = false ): self
727
739
{
@@ -748,7 +760,8 @@ public function union($queryOrCallable, bool $all = false): self
748
760
* Add a clause to the query.
749
761
*
750
762
* @param Clause $clause The clause to add to the query
751
- * @return Query
763
+ *
764
+ * @return $this
752
765
*/
753
766
public function addClause (Clause $ clause ): self
754
767
{
0 commit comments