Skip to content

Commit e71cb19

Browse files
SomeMWDevJeroenDeDauw
authored andcommitted
Fix compatibility with latest SMW master
Closes #895
1 parent ec209b8 commit e71cb19

4 files changed

Lines changed: 15 additions & 14 deletions

File tree

src/SemanticMW/AreaDescription.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Maps\Presentation\MapsDistanceParser;
1111
use SMW\DataValueFactory;
1212
use SMW\DIProperty;
13+
use SMW\Query\Language\Description;
1314
use SMW\Query\Language\ThingDescription;
1415
use SMW\Query\Language\ValueDescription;
1516
use SMWDataItem;
@@ -43,7 +44,7 @@ public function __construct( SMWDataItem $areaCenter, int $comparator, string $r
4344
/**
4445
* @see Description::prune
4546
*/
46-
public function prune( &$maxsize, &$maxDepth, &$log ) {
47+
public function prune( &$maxsize, &$maxDepth, &$log ): Description {
4748
if ( ( $maxsize < $this->getSize() ) || ( $maxDepth < $this->getDepth() ) ) {
4849
$log[] = $this->getQueryString();
4950

@@ -59,7 +60,7 @@ public function prune( &$maxsize, &$maxDepth, &$log ) {
5960
return $this;
6061
}
6162

62-
public function getQueryString( $asValue = false ) {
63+
public function getQueryString( $asValue = false ): string {
6364
$centerString = DataValueFactory::getInstance()->newDataValueByItem(
6465
$this->center,
6566
$this->getProperty()

src/SemanticMW/CoordinateDescription.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
class CoordinateDescription extends ValueDescription {
1818

19-
public function getQueryString( $asValue = false ) {
19+
public function getQueryString( $asValue = false ): string {
2020
$queryString = DataValueFactory::getInstance()->newDataValueByItem(
2121
$this->getDataItem(),
2222
$this->getProperty()

src/SemanticMW/CoordinateValue.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function getQueryDescription( $value ) {
4343
throw new InvalidArgumentException( '$value needs to be a string' );
4444
}
4545

46-
[ $distance, $comparator ] = $this->parseUserValue( $value );
46+
[ $distance, $comparator ] = $this->parseAndReturnUserValue( $value );
4747
$distance = $this->parserDistance( $distance );
4848

4949
$this->setUserValue( $value );
@@ -69,7 +69,11 @@ public function getQueryDescription( $value ) {
6969
/**
7070
* @see SMWDataValue::parseUserValue
7171
*/
72-
protected function parseUserValue( $value ) {
72+
protected function parseUserValue( $value ): void {
73+
$this->parseAndReturnUserValue( $value );
74+
}
75+
76+
private function parseAndReturnUserValue( $value ): array {
7377
if ( !is_string( $value ) ) {
7478
throw new InvalidArgumentException( '$value needs to be a string' );
7579
}
@@ -245,16 +249,14 @@ protected function loadDataItem( SMWDataItem $dataItem ) {
245249
* $2: The location in directional DMS notation.
246250
* $3: The latitude in non-directional float notation.
247251
* $4 The longitude in non-directional float notation.
248-
*
249-
* @return array
250252
*/
251-
protected function getServiceLinkParams() {
253+
protected function getServiceLinkParams(): array {
252254
$coordinateSet = $this->m_dataitem->getCoordinateSet();
253255
return [
254256
$this->getFormattedCoord( $this->m_dataitem, 'float' ), // TODO
255257
$this->getFormattedCoord( $this->m_dataitem, 'dms' ), // TODO
256258
$coordinateSet['lat'],
257-
$coordinateSet['lon']
259+
$coordinateSet['lon'],
258260
];
259261
}
260262

src/SemanticMW/KmlPrinter.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,8 @@ private function getKMLLink( QueryResult $res, int $outputMode ): string {
8686
* @see SMWResultPrinter::getParamDefinitions
8787
*
8888
* @param ParamDefinition[] $definitions
89-
*
90-
* @return array
9189
*/
92-
public function getParamDefinitions( array $definitions ) {
90+
public function getParamDefinitions( array $definitions ): array {
9391
global $egMapsDefaultLabel, $egMapsDefaultTitle;
9492

9593
$definitions['text'] = [
@@ -134,7 +132,7 @@ public function getMimeType( QueryResult $queryResult ) {
134132
*
135133
* @return string|boolean
136134
*/
137-
public function getFileName( QueryResult $queryResult ) {
135+
public function getFileName( QueryResult $queryResult ): false|string {
138136
if ( $this->params['filename'] !== '' ) {
139137
$filename = $this->params['filename'];
140138

@@ -160,7 +158,7 @@ final public function getName() {
160158
* @param array $params
161159
* @param $outputMode
162160
*/
163-
protected function handleParameters( array $params, $outputMode ) {
161+
protected function handleParameters( array $params, $outputMode ): void {
164162
$this->params = $params;
165163
}
166164
}

0 commit comments

Comments
 (0)