fix: SA: Fix "...does not match parent method..." rule.

SA stands for Static Analysis.
This commit is contained in:
Pol Dellaiera 2021-11-16 15:17:29 +01:00
parent e2a8437807
commit 479f0ce9ed
No known key found for this signature in database
GPG Key ID: D476DFE9C67467CA
2 changed files with 10 additions and 21 deletions

View File

@ -55,11 +55,6 @@ parameters:
count: 1 count: 1
path: src/Bundle/ChillMainBundle/Controller/ExportController.php path: src/Bundle/ChillMainBundle/Controller/ExportController.php
-
message: "#^Method Chill\\\\MainBundle\\\\Doctrine\\\\Type\\\\PointType\\:\\:getSqlDeclaration\\(\\) does not match parent method name\\: Doctrine\\\\DBAL\\\\Types\\\\Type\\:\\:getSQLDeclaration\\(\\)\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/Doctrine/Type/PointType.php
- -
message: "#^Foreach overwrites \\$line with its value variable\\.$#" message: "#^Foreach overwrites \\$line with its value variable\\.$#"
count: 2 count: 2

View File

@ -1,5 +1,7 @@
<?php <?php
declare(strict_types=1);
namespace Chill\MainBundle\Doctrine\Type; namespace Chill\MainBundle\Doctrine\Type;
use Chill\MainBundle\Doctrine\Model\Point; use Chill\MainBundle\Doctrine\Model\Point;
@ -7,40 +9,32 @@ use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\AbstractPlatform;
use Chill\MainBundle\Doctrine\Model\PointException; use Chill\MainBundle\Doctrine\Model\PointException;
/** /**
* A Type for Doctrine to implement the Geography Point type * A Type for Doctrine to implement the Geography Point type
* implemented by Postgis on postgis+postgresql databases * implemented by Postgis on postgis+postgresql databases
*
*/ */
class PointType extends Type { class PointType extends Type
{
const POINT = 'point'; public const POINT = 'point';
/** /**
*
* @param array $fieldDeclaration
* @param AbstractPlatform $platform
* @return string * @return string
*/ */
public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform) public function getSQLDeclaration(array $column, AbstractPlatform $platform)
{ {
return 'geometry(POINT,'.Point::$SRID.')'; return 'geometry(POINT,'.Point::$SRID.')';
} }
/** /**
*
* @param type $value
* @param AbstractPlatform $platform
* @return ?Point * @return ?Point
*/ */
public function convertToPHPValue($value, AbstractPlatform $platform) public function convertToPHPValue($value, AbstractPlatform $platform)
{ {
if ($value === NULL){ if ($value === NULL){
return NULL; return NULL;
} else {
return Point::fromGeoJson($value);
} }
return Point::fromGeoJson($value);
} }
public function getName() public function getName()
@ -52,9 +46,9 @@ class PointType extends Type {
{ {
if ($value === NULL){ if ($value === NULL){
return NULL; return NULL;
} else {
return $value->toWKT();
} }
return $value->toWKT();
} }
public function canRequireSQLConversion() public function canRequireSQLConversion()