Skip to content

Commit f6bd630

Browse files
committed
Add hints
1 parent 773df87 commit f6bd630

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

src/Database/Database.php

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -481,16 +481,24 @@ function (?string $value) {
481481

482482
self::addFilter(
483483
Database::VAR_POINT,
484+
/**
485+
* @param mixed $value
486+
* @return mixed
487+
*/
484488
function (mixed $value) {
485-
if ($value === null) {
486-
return null;
489+
if (!is_array($value)) {
490+
return $value;
487491
}
488492
try {
489-
return self::encodeSpatialData($value, Database::VAR_POINT);
493+
return self::encodeSpatialData($value, Database::VAR_POINT);
490494
} catch (\Throwable) {
491-
throw new StructureException('Invalid point');
495+
return $value;
492496
}
493497
},
498+
/**
499+
* @param string|null $value
500+
* @return string|null
501+
*/
494502
function (?string $value) {
495503
if ($value === null) {
496504
return null;
@@ -501,6 +509,10 @@ function (?string $value) {
501509

502510
self::addFilter(
503511
Database::VAR_LINESTRING,
512+
/**
513+
* @param mixed $value
514+
* @return mixed
515+
*/
504516
function (mixed $value) {
505517
if (!is_array($value)) {
506518
return $value;
@@ -511,7 +523,10 @@ function (mixed $value) {
511523
return $value;
512524
}
513525
},
514-
526+
/**
527+
* @param string|null $value
528+
* @return string|null
529+
*/
515530
function (?string $value) {
516531
if (is_null($value)) {
517532
return null;
@@ -522,6 +537,10 @@ function (?string $value) {
522537

523538
self::addFilter(
524539
Database::VAR_POLYGON,
540+
/**
541+
* @param mixed $value
542+
* @return mixed
543+
*/
525544
function (mixed $value) {
526545
if (!is_array($value)) {
527546
return $value;
@@ -532,6 +551,10 @@ function (mixed $value) {
532551
return $value;
533552
}
534553
},
554+
/**
555+
* @param string|null $value
556+
* @return string|null
557+
*/
535558
function (?string $value) {
536559
if (is_null($value)) {
537560
return null;

tests/e2e/Adapter/Scopes/SpatialTests.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2101,6 +2101,7 @@ public function testInvalidSpatialTypes(): void
21012101
]));
21022102
$this->fail("Expected StructureException for invalid point");
21032103
} catch (\Throwable $th) {
2104+
var_dump($th);
21042105
$this->assertInstanceOf(StructureException::class, $th);
21052106
}
21062107

0 commit comments

Comments
 (0)