]> git.openstreetmap.org Git - nominatim.git/commitdiff
add PHPCS Squiz.Arrays.ArrayDeclaration.KeyNotAligned rule
authorMarc Tobias Metten <mtmail@gmx.net>
Mon, 7 May 2018 22:37:41 +0000 (00:37 +0200)
committerMarc Tobias Metten <mtmail@gmx.net>
Mon, 7 May 2018 22:37:41 +0000 (00:37 +0200)
lib/template/details-json.php
phpcs.xml
test/php/Nominatim/DebugTest.php
website/status.php

index 288c914c10294c9bc0c2d7817f97ba8c879e7b08..9b4237c70720331a82b20160f2570c1b7bc3c0df 100644 (file)
@@ -33,33 +33,33 @@ $aPlaceDetails['rank_search'] = (int) $aPointDetails['rank_search'];
 
 $aPlaceDetails['isarea'] = ($aPointDetails['isarea'] == 't');
 $aPlaceDetails['centroid'] = array(
-    'type' => 'Point',
-    'coordinates' => array( (float) $aPointDetails['lon'], (float) $aPointDetails['lat'] )
-);
+                              'type' => 'Point',
+                              'coordinates' => array( (float) $aPointDetails['lon'], (float) $aPointDetails['lat'] )
+                             );
 
 $aPlaceDetails['geometry'] = json_decode($aPointDetails['asgeojson']);
 
 $funcMapAddressLine = function ($aFull) {
     $aMapped = array(
-        'localname' => $aFull['localname'],
-        'place_id' => isset($aFull['place_id']) ? (int) $aFull['place_id'] : null,
-        'osm_id' => isset($aFull['osm_id']) ? (int) $aFull['osm_id'] : null,
-        'osm_type' => isset($aFull['osm_type']) ? $aFull['osm_type'] : null,
-        'class' => $aFull['class'],
-        'type' => $aFull['type'],
-        'admin_level' => isset($aFull['admin_level']) ? (int) $aFull['admin_level'] : null,
-        'rank_address' => $aFull['rank_address'] ? (int) $aFull['rank_address'] : null,
-        'distance' => (float) $aFull['distance']
-    );
+                'localname' => $aFull['localname'],
+                'place_id' => isset($aFull['place_id']) ? (int) $aFull['place_id'] : null,
+                'osm_id' => isset($aFull['osm_id']) ? (int) $aFull['osm_id'] : null,
+                'osm_type' => isset($aFull['osm_type']) ? $aFull['osm_type'] : null,
+                'class' => $aFull['class'],
+                'type' => $aFull['type'],
+                'admin_level' => isset($aFull['admin_level']) ? (int) $aFull['admin_level'] : null,
+                'rank_address' => $aFull['rank_address'] ? (int) $aFull['rank_address'] : null,
+                'distance' => (float) $aFull['distance']
+               );
 
     return $aMapped;
 };
 
 $funcMapKeyword = function ($aFull) {
     $aMapped = array(
-        'id' => (int) $aFull['word_id'],
-        'token' => $aFull['word_token']
-    );
+                'id' => (int) $aFull['word_id'],
+                'token' => $aFull['word_token']
+               );
     return $aMapped;
 };
 
index 09360731510b48b7ecdf8ebe8827897029b5a3db..ab9d3969284b0961f0b4f31c9d4243de05556e5d 100644 (file)
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -93,6 +93,8 @@
        INDENTATION, SPACING
        ************************************************************** -->
 
+  <rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned" />
+
   <!-- Aligned looks nicer, but causes too many warnings currently -->
   <rule ref="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned">
     <severity>0</severity>
 
 
 
-
   <!-- **************************************************************
        VARIABLES
        ************************************************************** -->
index 7ed08122f8e32db2270c497e90c553d4deabaab2..6e0c25f3a22a150b4b4838c5ffeaba03713f09e5 100644 (file)
@@ -179,19 +179,19 @@ EOT
 
         // header are taken from first group item, thus no key3 gets printed
         $aGroups = array(
-            'group1' => array(
-                array('key1' => 'val1', 'key2' => 'val2'),
-                array('key1' => 'one', 'key2' => 'two', 'unknown' => 1),
-            ),
-            'group2' => array(
-                array('key1' => 'val1', 'key2' => 'val2', 'key3' => 'val3'),
-            )
-        );
+                    'group1' => array(
+                                 array('key1' => 'val1', 'key2' => 'val2'),
+                                 array('key1' => 'one', 'key2' => 'two', 'unknown' => 1),
+                                ),
+                    'group2' => array(
+                                 array('key1' => 'val1', 'key2' => 'val2', 'key3' => 'val3'),
+                                )
+                   );
         Debug::printGroupTable('Table3', $aGroups);
 
         $aGroups = array(
-            'group1' => array($this->oWithDebuginfo, $this->oWithDebuginfo),
-        );
+                    'group1' => array($this->oWithDebuginfo, $this->oWithDebuginfo),
+                   );
         Debug::printGroupTable('Table4', $aGroups);
     }
 }
index 262fe8e0159cd59e8148f8c26038fb4a223d048d..c0c379d0a983e6dd6d331d5a0089a75866570952 100644 (file)
@@ -24,9 +24,9 @@ try {
 } catch (Exception $oErr) {
     if ($sOutputFormat == 'json') {
         $aResponse = array(
-                  'status' => $oErr->getCode(),
-                  'message' => $oErr->getMessage()
-                 );
+                      'status' => $oErr->getCode(),
+                      'message' => $oErr->getMessage()
+                     );
         javascript_renderData($aResponse);
     } else {
         header('HTTP/1.0 500 Internal Server Error');
@@ -39,10 +39,10 @@ try {
 if ($sOutputFormat == 'json') {
     $epoch = $oStatus->dataDate();
     $aResponse = array(
-              'status' => 0,
-              'message' => 'OK',
-              'data_updated' => (new DateTime('@'.$epoch))->format(DateTime::RFC3339)
-             );
+                  'status' => 0,
+                  'message' => 'OK',
+                  'data_updated' => (new DateTime('@'.$epoch))->format(DateTime::RFC3339)
+                 );
     javascript_renderData($aResponse);
 } else {
     echo 'OK';