Skip to content

Commit 875d4ce

Browse files
Further work on type structure
1 parent cb11867 commit 875d4ce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1426
-1287
lines changed

src/Expressions/Exists.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,23 @@ final class Exists implements BooleanType
4545
*/
4646
private ?WhereClause $where;
4747

48-
/**
49-
* @var bool Whether to insert parentheses around the expression
50-
*/
51-
private bool $insertParentheses;
48+
/**
49+
* @var bool Whether to insert parentheses around the expression
50+
*/
51+
private bool $insertParentheses;
5252

53-
/**
53+
/**
5454
* Exists constructor.
5555
*
5656
* @param MatchClause $match The MATCH part of the EXISTS expression
5757
* @param WhereClause|null $where The optional WHERE part of the EXISTS expression
58-
* @param bool $insertParentheses Whether to insert parentheses around the expression
58+
* @param bool $insertParentheses Whether to insert parentheses around the expression
5959
*/
6060
public function __construct(MatchClause $match, ?WhereClause $where = null, bool $insertParentheses = false)
6161
{
6262
$this->match = $match;
6363
$this->where = $where;
64-
$this->insertParentheses = $insertParentheses;
64+
$this->insertParentheses = $insertParentheses;
6565
}
6666

6767
/**
@@ -84,15 +84,15 @@ public function getWhere(): ?WhereClause
8484
return $this->where;
8585
}
8686

87-
/**
88-
* Returns whether it inserts parentheses around the expression.
89-
*
90-
* @return bool
91-
*/
92-
public function insertsParentheses(): bool
93-
{
94-
return $this->insertParentheses;
95-
}
87+
/**
88+
* Returns whether it inserts parentheses around the expression.
89+
*
90+
* @return bool
91+
*/
92+
public function insertsParentheses(): bool
93+
{
94+
return $this->insertParentheses;
95+
}
9696

9797
/**
9898
* @inheritDoc
@@ -101,10 +101,10 @@ public function toQuery(): string
101101
{
102102
if (isset($this->where)) {
103103
return sprintf(
104-
$this->insertParentheses ? "(EXISTS { %s %s })" : "EXISTS { %s %s }",
105-
$this->match->toQuery(),
106-
$this->where->toQuery()
107-
);
104+
$this->insertParentheses ? "(EXISTS { %s %s })" : "EXISTS { %s %s }",
105+
$this->match->toQuery(),
106+
$this->where->toQuery()
107+
);
108108
}
109109

110110
return sprintf($this->insertParentheses ? "(EXISTS { %s })" : "EXISTS { %s }", $this->match->toQuery());

src/Expressions/Functions/All.php

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
1-
<?php
2-
1+
<?php declare(strict_types=1);
32
/*
4-
* Cypher DSL
5-
* Copyright (C) 2021 Wikibase Solutions
6-
*
7-
* This program is free software; you can redistribute it and/or
8-
* modify it under the terms of the GNU General Public License
9-
* as published by the Free Software Foundation; either version 2
10-
* of the License, or (at your option) any later version.
3+
* This file is part of php-cypher-dsl.
114
*
12-
* This program is distributed in the hope that it will be useful,
13-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-
* GNU General Public License for more details.
5+
* Copyright (C) 2021 Wikibase Solutions
166
*
17-
* You should have received a copy of the GNU General Public License
18-
* along with this program; if not, write to the Free Software
19-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
209
*/
21-
2210
namespace WikibaseSolutions\CypherDSL\Expressions\Functions;
2311

24-
use WikibaseSolutions\CypherDSL\Expressions\Literals\ExpressionList;
12+
use WikibaseSolutions\CypherDSL\Expressions\Literals\List_;
2513
use WikibaseSolutions\CypherDSL\Expressions\Variable;
2614
use WikibaseSolutions\CypherDSL\Traits\TypeTraits\PropertyTypeTraits\BooleanTypeTrait;
2715
use WikibaseSolutions\CypherDSL\Types\AnyType;
@@ -32,8 +20,11 @@
3220
* Represents the "all()" function.
3321
*
3422
* @see https://neo4j.com/docs/cypher-manual/current/functions/predicate/#functions-all
23+
* @see Func::all()
24+
*
25+
* @internal This class is not covered by the backwards compatibility promise of php-cypher-dsl
3526
*/
36-
class All extends Func implements BooleanType
27+
final class All extends Func implements BooleanType
3728
{
3829
use BooleanTypeTrait;
3930

@@ -53,7 +44,7 @@ class All extends Func implements BooleanType
5344
private AnyType $predicate;
5445

5546
/**
56-
* All constructor. The signature of the "all()" function is:
47+
* The signature of the "all()" function is:
5748
*
5849
* all(variable :: VARIABLE IN list :: LIST OF ANY? WHERE predicate :: ANY?) :: (BOOLEAN?)
5950
*
@@ -64,7 +55,7 @@ class All extends Func implements BooleanType
6455
public function __construct($variable, $list, AnyType $predicate)
6556
{
6657
$this->variable = is_string($variable) ? new Variable($variable) : $variable;
67-
$this->list = is_array($list) ? new ExpressionList($list) : $list;
58+
$this->list = is_array($list) ? new List_($list) : $list;
6859
$this->predicate = $predicate;
6960
}
7061

src/Expressions/Functions/Any.php

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,12 @@
1-
<?php
2-
1+
<?php declare(strict_types=1);
32
/*
4-
* Cypher DSL
5-
* Copyright (C) 2021 Wikibase Solutions
6-
*
7-
* This program is free software; you can redistribute it and/or
8-
* modify it under the terms of the GNU General Public License
9-
* as published by the Free Software Foundation; either version 2
10-
* of the License, or (at your option) any later version.
3+
* This file is part of php-cypher-dsl.
114
*
12-
* This program is distributed in the hope that it will be useful,
13-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-
* GNU General Public License for more details.
5+
* Copyright (C) 2021 Wikibase Solutions
166
*
17-
* You should have received a copy of the GNU General Public License
18-
* along with this program; if not, write to the Free Software
19-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
209
*/
21-
2210
namespace WikibaseSolutions\CypherDSL\Expressions\Functions;
2311

2412
use WikibaseSolutions\CypherDSL\Expressions\Variable;
@@ -31,8 +19,11 @@
3119
* Represents the "any()" function.
3220
*
3321
* @see https://neo4j.com/docs/cypher-manual/current/functions/predicate/#functions-any
22+
* @see Func::any()
23+
*
24+
* @internal This class is not covered by the backwards compatibility promise of php-cypher-dsl
3425
*/
35-
class Any extends Func implements BooleanType
26+
final class Any extends Func implements BooleanType
3627
{
3728
use BooleanTypeTrait;
3829

@@ -52,7 +43,7 @@ class Any extends Func implements BooleanType
5243
private AnyType $predicate;
5344

5445
/**
55-
* Any constructor. The signature of the "any()" function is:
46+
* The signature of the "any()" function is:
5647
*
5748
* any(variable :: VARIABLE IN list :: LIST OF ANY? WHERE predicate :: ANY?) :: (BOOLEAN?)
5849
*

src/Expressions/Functions/Date.php

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,12 @@
1-
<?php
2-
1+
<?php declare(strict_types=1);
32
/*
4-
* Cypher DSL
5-
* Copyright (C) 2021 Wikibase Solutions
3+
* This file is part of php-cypher-dsl.
64
*
7-
* This program is free software; you can redistribute it and/or
8-
* modify it under the terms of the GNU General Public License
9-
* as published by the Free Software Foundation; either version 2
10-
* of the License, or (at your option) any later version.
11-
*
12-
* This program is distributed in the hope that it will be useful,
13-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-
* GNU General Public License for more details.
5+
* Copyright (C) 2021 Wikibase Solutions
166
*
17-
* You should have received a copy of the GNU General Public License
18-
* along with this program; if not, write to the Free Software
19-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
209
*/
21-
2210
namespace WikibaseSolutions\CypherDSL\Expressions\Functions;
2311

2412
use WikibaseSolutions\CypherDSL\Traits\TypeTraits\PropertyTypeTraits\DateTypeTrait;
@@ -28,12 +16,12 @@
2816
/**
2917
* This class represents the "date()" function.
3018
*
31-
* @note You most likely do not want to use this function directly. You probably want to use the Literal
32-
* class to construct these objects for you.
33-
*
3419
* @see https://neo4j.com/docs/cypher-manual/current/functions/temporal/#functions-date
20+
* @see Func::date()
21+
*
22+
* @internal This class is not covered by the backwards compatibility promise of php-cypher-dsl
3523
*/
36-
class Date extends Func implements DateType
24+
final class Date extends Func implements DateType
3725
{
3826
use DateTypeTrait;
3927

@@ -43,7 +31,7 @@ class Date extends Func implements DateType
4331
private ?AnyType $value;
4432

4533
/**
46-
* Date constructor. The signature of the "date()" function is:
34+
* The signature of the "date()" function is:
4735
*
4836
* date(input = DEFAULT_TEMPORAL_ARGUMENT :: ANY?) :: (DATE?)
4937
*

src/Expressions/Functions/DateTime.php

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,12 @@
1-
<?php
2-
1+
<?php declare(strict_types=1);
32
/*
4-
* Cypher DSL
5-
* Copyright (C) 2021 Wikibase Solutions
3+
* This file is part of php-cypher-dsl.
64
*
7-
* This program is free software; you can redistribute it and/or
8-
* modify it under the terms of the GNU General Public License
9-
* as published by the Free Software Foundation; either version 2
10-
* of the License, or (at your option) any later version.
11-
*
12-
* This program is distributed in the hope that it will be useful,
13-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-
* GNU General Public License for more details.
5+
* Copyright (C) 2021 Wikibase Solutions
166
*
17-
* You should have received a copy of the GNU General Public License
18-
* along with this program; if not, write to the Free Software
19-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
209
*/
21-
2210
namespace WikibaseSolutions\CypherDSL\Expressions\Functions;
2311

2412
use WikibaseSolutions\CypherDSL\Traits\TypeTraits\PropertyTypeTraits\DateTimeTypeTrait;
@@ -28,12 +16,12 @@
2816
/**
2917
* This class represents the "datetime()" function.
3018
*
31-
* @note You most likely do not want to use this function directly. You probably want to use the Literal
32-
* class to construct these objects for you.
33-
*
3419
* @see https://neo4j.com/docs/cypher-manual/current/functions/temporal/#functions-datetime
20+
* @see Func::datetime()
21+
*
22+
* @internal This class is not covered by the backwards compatibility promise of php-cypher-dsl
3523
*/
36-
class DateTime extends Func implements DateTimeType
24+
final class DateTime extends Func implements DateTimeType
3725
{
3826
use DateTimeTypeTrait;
3927

@@ -43,7 +31,7 @@ class DateTime extends Func implements DateTimeType
4331
private ?AnyType $value;
4432

4533
/**
46-
* DateTime constructor. The signature of the "datetime()" function is:
34+
* The signature of the "datetime()" function is:
4735
*
4836
* datetime(input = DEFAULT_TEMPORAL_ARGUMENT :: ANY?) :: (DATETIME?)
4937
*

src/Expressions/Functions/Exists.php

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,12 @@
1-
<?php
2-
1+
<?php declare(strict_types=1);
32
/*
4-
* Cypher DSL
5-
* Copyright (C) 2021 Wikibase Solutions
6-
*
7-
* This program is free software; you can redistribute it and/or
8-
* modify it under the terms of the GNU General Public License
9-
* as published by the Free Software Foundation; either version 2
10-
* of the License, or (at your option) any later version.
3+
* This file is part of php-cypher-dsl.
114
*
12-
* This program is distributed in the hope that it will be useful,
13-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-
* GNU General Public License for more details.
5+
* Copyright (C) 2021 Wikibase Solutions
166
*
17-
* You should have received a copy of the GNU General Public License
18-
* along with this program; if not, write to the Free Software
19-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
209
*/
21-
2210
namespace WikibaseSolutions\CypherDSL\Expressions\Functions;
2311

2412
use WikibaseSolutions\CypherDSL\Traits\TypeTraits\PropertyTypeTraits\BooleanTypeTrait;
@@ -29,8 +17,11 @@
2917
* This class represents the "exists()" function.
3018
*
3119
* @see https://neo4j.com/docs/cypher-manual/current/functions/predicate/#functions-exists
20+
* @see Func::exists()
21+
*
22+
* @internal This class is not covered by the backwards compatibility promise of php-cypher-dsl
3223
*/
33-
class Exists extends Func implements BooleanType
24+
final class Exists extends Func implements BooleanType
3425
{
3526
use BooleanTypeTrait;
3627

@@ -40,7 +31,7 @@ class Exists extends Func implements BooleanType
4031
private AnyType $expression;
4132

4233
/**
43-
* Exists constructor. The signature of the "exists()" function is:
34+
* The signature of the "exists()" function is:
4435
*
4536
* exists(input :: ANY?) :: (BOOLEAN?)
4637
*

0 commit comments

Comments
 (0)