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: 0 additions & 2 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ jobs:
fail-fast: false
matrix:
php:
- '8.1'
- '8.2'
- '8.3'
- '8.4'
- '8.5'
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
"docs": "https://github.com/DataValues/Geo/#usage"
},
"require": {
"php": ">=8.1",
"php": ">=8.3",
"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": "^48",
"phpunit/phpunit": "^9.6",
"mediawiki/mediawiki-codesniffer": "^52",
"ockcyp/covers-validator": "^1.3.3",
"phpstan/phpstan": "^0.12.68 || ^1.0.0",
"phpmd/phpmd": "^2.9.1",
Expand Down
35 changes: 12 additions & 23 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="tests/bootstrap.php"
cacheTokens="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
verbose="false">
<testsuites>
<testsuite name="DataValuesGeo">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="tests/bootstrap.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" verbose="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="DataValuesGeo">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
40 changes: 20 additions & 20 deletions src/Formatters/LatLongFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,64 +35,64 @@ class LatLongFormatter implements ValueFormatter {
/**
* Output formats for use with the self::OPT_FORMAT option.
*/
public const TYPE_FLOAT = 'float';
public const TYPE_DMS = 'dms';
public const TYPE_DM = 'dm';
public const TYPE_DD = 'dd';
public const string TYPE_FLOAT = 'float';
public const string TYPE_DMS = 'dms';
public const string TYPE_DM = 'dm';
public const string TYPE_DD = 'dd';

/**
* The symbols representing the different directions for usage in directional notation.
* @since 0.1
*/
public const OPT_NORTH_SYMBOL = 'north';
public const OPT_EAST_SYMBOL = 'east';
public const OPT_SOUTH_SYMBOL = 'south';
public const OPT_WEST_SYMBOL = 'west';
public const string OPT_NORTH_SYMBOL = 'north';
public const string OPT_EAST_SYMBOL = 'east';
public const string OPT_SOUTH_SYMBOL = 'south';
public const string OPT_WEST_SYMBOL = 'west';

/**
* The symbols representing degrees, minutes and seconds.
* @since 0.1
*/
public const OPT_DEGREE_SYMBOL = 'degree';
public const OPT_MINUTE_SYMBOL = 'minute';
public const OPT_SECOND_SYMBOL = 'second';
public const string OPT_DEGREE_SYMBOL = 'degree';
public const string OPT_MINUTE_SYMBOL = 'minute';
public const string OPT_SECOND_SYMBOL = 'second';

/**
* Flags for use with the self::OPT_SPACING_LEVEL option.
*/
public const OPT_SPACE_LATLONG = 'latlong';
public const OPT_SPACE_DIRECTION = 'direction';
public const OPT_SPACE_COORDPARTS = 'coordparts';
public const string OPT_SPACE_LATLONG = 'latlong';
public const string OPT_SPACE_DIRECTION = 'direction';
public const string OPT_SPACE_COORDPARTS = 'coordparts';

/**
* Option specifying the output format (also referred to as output type). Must be one of the
* self::TYPE_… constants.
*/
public const OPT_FORMAT = 'geoformat';
public const string OPT_FORMAT = 'geoformat';

/**
* Boolean option specifying if negative coordinates should have minus signs, e.g. "-1°, -2°"
* (false) or cardinal directions, e.g. "1° S, 2° W" (true). Default is false.
*/
public const OPT_DIRECTIONAL = 'directional';
public const string OPT_DIRECTIONAL = 'directional';

/**
* Option for the separator character between latitude and longitude. Defaults to a comma.
*/
public const OPT_SEPARATOR_SYMBOL = 'separator';
public const string OPT_SEPARATOR_SYMBOL = 'separator';

/**
* Option specifying the amount and position of space characters in the output. Must be an array
* containing zero or more of the self::OPT_SPACE_… flags.
*/
public const OPT_SPACING_LEVEL = 'spacing';
public const string OPT_SPACING_LEVEL = 'spacing';

/**
* Option specifying the precision in fractional degrees. Must be a number or numeric string.
*/
public const OPT_PRECISION = 'precision';
public const string OPT_PRECISION = 'precision';

private const DEFAULT_PRECISION = 1 / 3600;
private const float DEFAULT_PRECISION = 1 / 3600;

private FormatterOptions $options;

Expand Down
2 changes: 1 addition & 1 deletion src/GlobeMath.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class GlobeMath {
/**
* @todo Move this constant next to GlobeCoordinateValue::GLOBE_EARTH?
*/
public const GLOBE_MOON = 'http://www.wikidata.org/entity/Q405';
public const string GLOBE_MOON = 'http://www.wikidata.org/entity/Q405';

/**
* @param string|null $globe IRI of a globe.
Expand Down
2 changes: 1 addition & 1 deletion src/Parsers/DdCoordinateParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class DdCoordinateParser extends LatLongParserBase {
* The symbol representing degrees.
* @since 0.1
*/
public const OPT_DEGREE_SYMBOL = 'degree';
public const string OPT_DEGREE_SYMBOL = 'degree';

/**
* Delimiters used to split a coordinate string when unable to split by using the separator.
Expand Down
4 changes: 2 additions & 2 deletions src/Parsers/DmCoordinateParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
*/
class DmCoordinateParser extends DdCoordinateParser {

public const FORMAT_NAME = 'dm-coordinate';
public const string FORMAT_NAME = 'dm-coordinate';

/**
* The symbols representing minutes.
* @since 0.1
*/
public const OPT_MINUTE_SYMBOL = 'minute';
public const string OPT_MINUTE_SYMBOL = 'minute';

/**
* @param ParserOptions|null $options
Expand Down
4 changes: 2 additions & 2 deletions src/Parsers/DmsCoordinateParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
*/
class DmsCoordinateParser extends DmCoordinateParser {

public const FORMAT_NAME = 'dms-coordinate';
public const string FORMAT_NAME = 'dms-coordinate';

/**
* The symbol representing seconds.
* @since 0.1
*/
public const OPT_SECOND_SYMBOL = 'second';
public const string OPT_SECOND_SYMBOL = 'second';

/**
* @param ?ParserOptions $options
Expand Down
2 changes: 1 addition & 1 deletion src/Parsers/FloatCoordinateParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
class FloatCoordinateParser extends LatLongParserBase {

public const FORMAT_NAME = 'float-coordinate';
public const string FORMAT_NAME = 'float-coordinate';

/**
* @see LatLongParserBase::getParsedCoordinate
Expand Down
4 changes: 2 additions & 2 deletions src/Parsers/GlobeCoordinateParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
*/
class GlobeCoordinateParser implements ValueParser {

public const FORMAT_NAME = 'globe-coordinate';
public const string FORMAT_NAME = 'globe-coordinate';

/**
* Option specifying the globe. Should be a string containing a Wikidata concept URI.
* Defaults to Earth.
*/
public const OPT_GLOBE = 'globe';
public const string OPT_GLOBE = 'globe';

private ParserOptions $options;
private ?LatLongPrecisionParser $latLongPrecisionParser = null;
Expand Down
24 changes: 12 additions & 12 deletions src/Parsers/LatLongParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,30 @@
*/
class LatLongParser implements ValueParser {

public const TYPE_FLOAT = 'float';
public const TYPE_DMS = 'dms';
public const TYPE_DM = 'dm';
public const TYPE_DD = 'dd';
public const string TYPE_FLOAT = 'float';
public const string TYPE_DMS = 'dms';
public const string TYPE_DM = 'dm';
public const string TYPE_DD = 'dd';

/**
* The symbols representing the different directions for usage in directional notation.
*/
public const OPT_NORTH_SYMBOL = 'north';
public const OPT_EAST_SYMBOL = 'east';
public const OPT_SOUTH_SYMBOL = 'south';
public const OPT_WEST_SYMBOL = 'west';
public const string OPT_NORTH_SYMBOL = 'north';
public const string OPT_EAST_SYMBOL = 'east';
public const string OPT_SOUTH_SYMBOL = 'south';
public const string OPT_WEST_SYMBOL = 'west';

/**
* The symbols representing degrees, minutes and seconds.
*/
public const OPT_DEGREE_SYMBOL = 'degree';
public const OPT_MINUTE_SYMBOL = 'minute';
public const OPT_SECOND_SYMBOL = 'second';
public const string OPT_DEGREE_SYMBOL = 'degree';
public const string OPT_MINUTE_SYMBOL = 'minute';
public const string OPT_SECOND_SYMBOL = 'second';

/**
* The symbol to use as a separator between latitude and longitude.
*/
public const OPT_SEPARATOR_SYMBOL = 'separator';
public const string OPT_SEPARATOR_SYMBOL = 'separator';

private ParserOptions $options;

Expand Down
12 changes: 6 additions & 6 deletions src/Parsers/LatLongParserBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@
*/
abstract class LatLongParserBase implements ValueParser {

public const FORMAT_NAME = 'geo-coordinate';
public const string FORMAT_NAME = 'geo-coordinate';

/**
* The symbols representing the different directions for usage in directional notation.
*/
public const OPT_NORTH_SYMBOL = 'north';
public const OPT_EAST_SYMBOL = 'east';
public const OPT_SOUTH_SYMBOL = 'south';
public const OPT_WEST_SYMBOL = 'west';
public const string OPT_NORTH_SYMBOL = 'north';
public const string OPT_EAST_SYMBOL = 'east';
public const string OPT_SOUTH_SYMBOL = 'south';
public const string OPT_WEST_SYMBOL = 'west';

/**
* The symbol to use as a separator between latitude and longitude.
*/
public const OPT_SEPARATOR_SYMBOL = 'separator';
public const string OPT_SEPARATOR_SYMBOL = 'separator';

private ParserOptions $options;

Expand Down
2 changes: 1 addition & 1 deletion src/Values/GlobeCoordinateValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class GlobeCoordinateValue implements DataValue {
/**
* Wikidata concept URI for the Earth. Used as default value when no other globe was specified.
*/
public const GLOBE_EARTH = 'http://www.wikidata.org/entity/Q2';
public const string GLOBE_EARTH = 'http://www.wikidata.org/entity/Q2';

/**
* @param LatLongValue $latLong
Expand Down
Loading