Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
fail-fast: false
matrix:
php:
- '8.0'
- '8.1'
- '8.2'
- '8.3'
- '8.4'

steps:
- uses: actions/checkout@v5
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@
"docs": "https://github.com/DataValues/Geo/#usage"
},
"require": {
"php": ">=8.0",
"php": ">=8.1",
"data-values/data-values": "^3.0|^2.0|^1.0|~0.1",
"data-values/interfaces": "^1.1.0"
},
"require-dev": {
"phpunit/phpunit": "^9.4.1",
"mediawiki/mediawiki-codesniffer": "^45",
"mediawiki/mediawiki-codesniffer": "^48",
"ockcyp/covers-validator": "^1.3.3",
"phpstan/phpstan": "^0.12.68 || ^1.0.0",
"phpmd/phpmd": "^2.9.1",
"vimeo/psalm": "^4.4.1",
"maglnet/composer-require-checker": "^3.0|^2.0"
"vimeo/psalm": "^5.26.1||^6.13.1",
"maglnet/composer-require-checker": "^4.7.1"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 3 additions & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@
<rule ref="Generic.Metrics.CyclomaticComplexity" />
<rule ref="Generic.Metrics.NestingLevel" />
<rule ref="Squiz.Operators.ValidLogicalOperators" />
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki"/>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
<exclude name="MediaWiki.Commenting.ClassAnnotations.UnrecognizedAnnotation" />
</rule>
</ruleset>
5 changes: 5 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@

<MissingPropertyType errorLevel="suppress" />
<DocblockTypeContradiction errorLevel="suppress" />
<InvalidOperand errorLevel="suppress" />
<UnusedClass errorLevel="suppress" />
<MissingOverrideAttribute errorLevel="suppress" />
<PossiblyUnusedMethod errorLevel="suppress" />

<!-- level 6 issues - really bad things -->

<MoreSpecificImplementedParamType errorLevel="suppress" />
<InvalidReturnType errorLevel="suppress" />
<DirectConstructorCall errorLevel="suppress" />

</issueHandlers>
</psalm>
1 change: 1 addition & 0 deletions src/Formatters/GlobeCoordinateFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* TODO: add formatting of globe and precision
*
* @since 0.1
* @api
*
* @license GPL-2.0-or-later
* @author Jeroen De Dauw < [email protected] >
Expand Down
1 change: 1 addition & 0 deletions src/Formatters/LatLongFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* MapsCoordinateParser class of the Maps extension for MediaWiki.
*
* @since 0.1, renamed in 2.0
* @api
*
* @license GPL-2.0-or-later
* @author Jeroen De Dauw < [email protected] >
Expand Down
1 change: 1 addition & 0 deletions src/GlobeMath.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* GlobeCoordinateValue objects.
*
* @since 0.2
* @api
*
* @license GPL-2.0-or-later
* @author Thiemo Kreuz
Expand Down
3 changes: 3 additions & 0 deletions src/PackagePrivate/DmPrecisionDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace DataValues\Geo\PackagePrivate;

/**
* @api
*/
class DmPrecisionDetector extends PrecisionDetector {

private DmsPrecisionDetector $dmsPrecisionDetector;
Expand Down
3 changes: 3 additions & 0 deletions src/PackagePrivate/DmsPrecisionDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace DataValues\Geo\PackagePrivate;

/**
* @api
*/
class DmsPrecisionDetector extends PrecisionDetector {

protected function detectDegreePrecision( float $degree ): float {
Expand Down
3 changes: 3 additions & 0 deletions src/PackagePrivate/FloatPrecisionDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace DataValues\Geo\PackagePrivate;

/**
* @api
*/
class FloatPrecisionDetector extends PrecisionDetector {

protected function detectDegreePrecision( float $degree ): float {
Expand Down
3 changes: 3 additions & 0 deletions src/PackagePrivate/LatLongPrecisionParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use ValueParsers\ParseException;
use ValueParsers\ParserOptions;

/**
* @api
*/
class LatLongPrecisionParser {

private ?ParserOptions $options;
Expand Down
3 changes: 3 additions & 0 deletions src/PackagePrivate/PreciseLatLong.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

use DataValues\Geo\Values\LatLongValue;

/**
* @api
*/
class PreciseLatLong {

private LatLongValue $latLong;
Expand Down
3 changes: 3 additions & 0 deletions src/PackagePrivate/Precision.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace DataValues\Geo\PackagePrivate;

/**
* @api
*/
class Precision {

private float $precision;
Expand Down
3 changes: 3 additions & 0 deletions src/PackagePrivate/PrecisionParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

use ValueParsers\ValueParser;

/**
* @api
*/
class PrecisionParser {

private ValueParser $latLongParser;
Expand Down
1 change: 1 addition & 0 deletions src/Parsers/DdCoordinateParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Parser for geographical coordinates in Decimal Degree notation.
*
* @since 0.1
* @api
*
* @license GPL-2.0-or-later
* @author Jeroen De Dauw < [email protected] >
Expand Down
1 change: 1 addition & 0 deletions src/Parsers/DmCoordinateParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* Parser for geographical coordinates in Decimal Minute notation.
*
* @since 0.1
* @api
*
* @license GPL-2.0-or-later
* @author Jeroen De Dauw < [email protected] >
Expand Down
1 change: 1 addition & 0 deletions src/Parsers/DmsCoordinateParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* Parser for geographical coordinates in Degree Minute Second notation.
*
* @since 0.1
* @api
*
* @license GPL-2.0-or-later
* @author Jeroen De Dauw < [email protected] >
Expand Down
1 change: 1 addition & 0 deletions src/Parsers/FloatCoordinateParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/**
* @since 0.1
* @api
*
* @license GPL-2.0-or-later
* @author Jeroen De Dauw < [email protected] >
Expand Down
3 changes: 2 additions & 1 deletion src/Parsers/GlobeCoordinateParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
/**
* Extends the LatLongParser by adding precision detection support.
*
* The object that gets constructed is a GlobeCoordinateValue rather then a LatLongValue.
* The object that gets constructed is a GlobeCoordinateValue rather than a LatLongValue.
*
* @since 0.1
* @api
*
* @license GPL-2.0-or-later
* @author Jeroen De Dauw < [email protected] >
Expand Down
1 change: 1 addition & 0 deletions src/Parsers/LatLongParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
* MapsCoordinateParser class of the Maps extension for MediaWiki.
*
* @since 0.1, name changed in 2.0
* @api
*
* @license GPL-2.0-or-later
* @author Jeroen De Dauw < [email protected] >
Expand Down
13 changes: 7 additions & 6 deletions src/Values/GlobeCoordinateValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Value Object representing a latitude-longitude pair with a certain precision on a certain globe.
*
* @since 0.1
* @api
*
* @license GPL-2.0-or-later
* @author Jeroen De Dauw < [email protected] >
Expand Down Expand Up @@ -122,7 +123,7 @@ public function getHash(): string {
* @return string
*/
public function serialize(): string {
return json_encode( $this->__serialize() );
return json_encode( $this->__serialize(), JSON_THROW_ON_ERROR );
}

public function __serialize(): array {
Expand All @@ -132,16 +133,16 @@ public function __serialize(): array {
/**
* @see Serializable::unserialize
*
* @param string $value
* @param string $data
*
* @throws InvalidArgumentException
*/
public function unserialize( $value ) {
$this->__unserialize( json_decode( $value ) );
public function unserialize( $data ): void {
$this->__unserialize( json_decode( $data ) );
}

public function __unserialize( array $data ): void {
[ $latitude, $longitude, $altitude, $precision, $globe ] = $data;
[ $latitude, $longitude, , $precision, $globe ] = $data;
$this->__construct( new LatLongValue( $latitude, $longitude ), $precision, $globe );
}

Expand Down Expand Up @@ -186,7 +187,7 @@ public function getArrayValue(): array {
public function toArray(): array {
return [
'value' => $this->getArrayValue(),
'type' => $this->getType(),
'type' => self::getType(),
];
}

Expand Down
7 changes: 4 additions & 3 deletions src/Values/LatLongValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* Longitude is specified in degrees within the range [-360, 360].
*
* @since 0.1
* @api
*
* @license GPL-2.0-or-later
* @author Jeroen De Dauw < [email protected] >
Expand Down Expand Up @@ -105,12 +106,12 @@ public function __serialize(): array {
/**
* @see Serializable::unserialize
*
* @param string $value
* @param string $data
*
* @throws InvalidArgumentException
*/
public function unserialize( $value ) {
$this->__unserialize( explode( '|', $value, 2 ) );
public function unserialize( $data ): void {
$this->__unserialize( explode( '|', $data, 2 ) );
}

public function __unserialize( array $data ): void {
Expand Down