Fix the issues reported by phpcs

Created on 15 May 2023, over 1 year ago
Updated 9 December 2023, 11 months ago

Problem/Motivation

$ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig geofield/

FILE: /geofield/geofield.module
-------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 13 WARNINGS AFFECTING 13 LINES
-------------------------------------------------------------------------------------
 21 | WARNING | Global constants should not be used, move it to a class or interface
 28 | WARNING | Global constants should not be used, move it to a class or interface
 35 | WARNING | Global constants should not be used, move it to a class or interface
 42 | WARNING | Global constants should not be used, move it to a class or interface
 49 | WARNING | Global constants should not be used, move it to a class or interface
 56 | WARNING | Global constants should not be used, move it to a class or interface
 61 | WARNING | Global constants should not be used, move it to a class or interface
 66 | WARNING | Global constants should not be used, move it to a class or interface
 71 | WARNING | Global constants should not be used, move it to a class or interface
 76 | WARNING | Global constants should not be used, move it to a class or interface
 81 | WARNING | Global constants should not be used, move it to a class or interface
 86 | WARNING | Global constants should not be used, move it to a class or interface
 91 | WARNING | Global constants should not be used, move it to a class or interface
-------------------------------------------------------------------------------------


FILE: /geofield/tests/src/Functional/GeofieldWidgetTest.php
-----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------------
 10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\StringTranslation\StringTranslationTrait.
-----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/tests/src/Kernel/GeofieldItemTest.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Field\FieldItemInterface.
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/tests/src/Kernel/ConstraintsTest.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------
 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\geofield\GeoPHP\GeoPHPWrapper.
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 7 WARNINGS AFFECTING 7 LINES
----------------------------------------------------------------------
  29 | WARNING | Line exceeds 80 characters; contains 172 characters
  47 | WARNING | Line exceeds 80 characters; contains 81 characters
  50 | WARNING | Line exceeds 80 characters; contains 81 characters
  85 | WARNING | Line exceeds 80 characters; contains 131 characters
  89 | WARNING | Line exceeds 80 characters; contains 83 characters
  95 | WARNING | Line exceeds 80 characters; contains 86 characters
 106 | WARNING | Line exceeds 80 characters; contains 216 characters
----------------------------------------------------------------------


FILE: /geofield/migrations/state/geofield.migrate_drupal.yml
---------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------
 3 | ERROR | [x] Expected 1 newline at end of file; 0 found
---------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------


FILE: /geofield/src/Feeds/Target/Geofield.php
----------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------
 8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Messenger\MessengerInterface.
----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/GeofieldProximitySourceBase.php
-------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-------------------------------------------------------------------------------
 130 | WARNING | Exceptions should not be translated
 160 | WARNING | Exceptions should not be translated
-------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/migrate/process/GeoField.php
-----------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------
 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\migrate\MigrateExecutableInterface.
-----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/migrate/process/GeofieldWKT.php
-------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------
 9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\geofield\WktGeneratorInterface.
-------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/migrate/process/GeofieldLatLon.php
-------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------
 9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\geofield\WktGeneratorInterface.
-------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/Field/FieldWidget/GeofieldBaseWidget.php
----------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------
 12 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\geofield\Plugin\GeofieldBackendManager.
----------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/Field/FieldType/GeofieldItem.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------
 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Field\FieldItemBase.
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/Field/FieldFormatter/LatLonFormatter.php
----------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------
 95 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/Field/FieldFormatter/GeofieldDefaultFormatter.php
--------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------
 9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\geofield\GeoPHP\GeoPHPInterface.
--------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/views/sort/GeofieldProximitySort.php
----------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------------------
 8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\geofield\Plugin\views\GeofieldProximityHandlerTrait.
----------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/views/filter/GeofieldRectBoundaryFilter.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------
  6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormStateInterface.
 25 | ERROR | [ ] Class property $no_operator should use lowerCamel naming without underscores
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/views/filter/GeofieldProximityFilter.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------
 11 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\views\Plugin\views\filter\NumericFilter.
-----------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/views/field/GeofieldProximityField.php
------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------
 11 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\geofield\Plugin\GeofieldProximitySourceManager.
------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/views/argument/GeofieldProximityArgument.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------
 8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormStateInterface.
-----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/views/argument/GeofieldRectBoundaryArgument.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------
 8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormStateInterface.
-----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/Validation/Constraint/GeoConstraint.php
---------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------
 17 | ERROR | Missing member variable doc comment
---------------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/Validation/Constraint/GeoConstraintValidator.php
-----------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\DependencyInjection\ContainerInjectionInterface.
-----------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/GeofieldProximitySource/ClientLocationOriginFilter.php
-----------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Render\FormattableMarkup.
-----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/GeofieldProximitySource/OriginFromProximityFilter.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------
 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormStateInterface.
-----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/GeofieldProximitySource/ManualOriginDefault.php
-----------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------
 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Render\FormattableMarkup.
-----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/GeofieldProximitySource/ContextProximityFilter.php
---------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------------------------------
 9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\geofield\Plugin\views\argument\GeofieldProximityArgument.
---------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/GeofieldProximitySourceManager.php
---------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Cache\CacheBackendInterface.
---------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------


FILE: /geofield/src/Plugin/GeofieldProximitySourceInterface.php
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------
 25 | WARNING | [x] '@todo: add more tests, particularly around max/min values.' should match the format '@todo Fix problem X here.'
-------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------

Steps to reproduce

vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig modules/contrib/geofield/

Proposed resolution

Before applying patch you need to create new file in src folder GeoFieldsInterface.php and then add code in this file:

<?php

namespace Drupal\geofield;

/**
 * Provides an interface.
 */
interface GeoFieldsInterface {

  /**
   * Point feature constant.
   *
   * @var string
   */
  const GEOFIELD_TYPE_POINT = 'POINT';

  /**
   * Multipoint feature constant.
   *
   * @var string
   */
  const GEOFIELD_TYPE_MULTIPOINT = 'MULTIPOINT';

  /**
   * Linestring feature constant.
   *
   * @var string
   */
  const GEOFIELD_TYPE_LINESTRING = 'LINESTRING';

  /**
   * Multilinestring feature constant.
   *
   * @var string
   */
  const GEOFIELD_TYPE_MULTILINESTRING = 'MULTILINESTRING';

  /**
   * Polygon feature constant.
   *
   * @var string
   */
  const GEOFIELD_TYPE_POLYGON = 'POLYGON';

  /**
   * Multipolygon feature constant.
   *
   * @var string
   */
  const GEOFIELD_TYPE_MULTIPOLYGON = 'MULTIPOLYGON';

  /* *
   * Max length of geohashes (imposed by database column length).
   */
  const GEOFIELD_GEOHASH_LENGTH = 16;

  /**
   * Diameter of the Earth in kilometers.
   */
  const GEOFIELD_KILOMETERS = 6371;

  /**
   * Diameter of the Earth in meters.
   */
  const GEOFIELD_METERS = 6371000;

  /**
   * Diameter of the Earth in miles.
   */
  const GEOFIELD_MILES = 3959;

  /**
   * Diameter of the Earth in yards.
   */
  const GEOFIELD_YARDS = 6975175;

  /**
   * Diameter of the Earth in feet.
   */
  const GEOFIELD_FEET = 20925525;

  /**
   * Diameter of the Earth in nautical miles.
   */
  const GEOFIELD_NAUTICAL_MILES = 3444;

}
๐Ÿ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia sakthi_dev

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @sakthi_dev
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    11 pass, 4 fail
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sakthi_dev

    Fixed the PHPCS issue. Please review.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Issue was unassigned.
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    -  // TODO: This code only covers configurable fields, handle base table fields.
    +  // @todo Fix problem configurable fields, handle base table fields here.

    The existing sentence is already correct: That @todo is about handling base table fields, not fixing problems with configurable fields. What needs to be changed is replacing TODO: with @todo.

    -   * @todo: add more tests, particularly around max/min values.
    +   * @todo Fix problem add more tests, particularly around max/min values here.
        */

    There is no need to add Fix problem; Fix problem add more tests does not make grammatically sense. Add more tests is correct.

     /**
    - * Trait GeofieldBoundaryHandlerTrait.
    + * Trait for GeofieldBoundaryHandlerTrait.
      */

    The description repeats the trait name, like the existing description. It needs to describe what the trait does.

       /**
        * {@inheritdoc}
        */
    -  public $no_operator = TRUE;
    +  public $noOperator = TRUE;
    

    That is a property inherited from a parent class, for which GeofieldRectBoundaryFilter is just setting a different default value. That property name cannot be changed, if the parent class does not change it.

  • Assigned to arti_parmar
  • Status changed to Needs review over 1 year ago
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    3 pass, 10 fail
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia arti_parmar

    Kindly review patch

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    -     // Generate the WKT version of the point geometry: 'POINT (-73.985664 41.748441)'
    +     // Generate the WKT version of the point geometry: 
    +     'POINT (-73.985664 41.748441)'

    In the existing code, 'POINT (-73.985664 41.748441)' is part of a comment. In the changed code, 'POINT (-73.985664 41.748441)' is part of PHP code.

    -     'value' => 'POLYGON((-73.98411932014324 40.754779803566606,-73.98502054237224 40.75354445673964,-73.98186626457073 40.75221155678824,-73.98092212699748 40.75344692838096,-73.98411932014324 40.754779803566606))',
    +     'value' => 'POLYGON((-73.98411932014324 40.754779803566606,
    +     -73.98502054237224 40.75354445673964,-73.98186626457073 40.75221155678824,
    +     -73.98092212699748 75344692838096,-73.98411932014324 40.754779803566606))',
          ];

    That change is not correct, as it introduces new lines characters in a literal string that did not contain them.

    -define('GEOFIELD_TYPE_MULTIPOINT', 'MULTIPOINT');
    +GeoFieldsInterface::GEOFIELD_TYPE_MULTIPOINT;

    That is wrong change: define('GEOFIELD_TYPE_MULTIPOINT', 'MULTIPOINT'); defines a constant, but GeoFieldsInterface::GEOFIELD_TYPE_MULTIPOINT is using a constant, not defining it.

    -(function(geolocation, $){
    -  if (geolocation) return;
    +(function (geolocation, $) {
    +  if (geolocation) { return;
    +  }

    The code is not correctly formatted: return must go on a new line.

    -    if (cache) callback(cache);
    +    if (cache) { callback(cache);
    +    }

    That code is not correctly formatted too.

             longitudeSpan.text(lon);
    -        return false;
    +        return FALSE;

    In JavaScript code, Drupal core uses false, not FALSE.

    -        $form_state->setError($element[$key], t('@title: @component_title is not valid.', ['@title' => $error_label, '@component_title' => $component['title']]));
    +        $form_state->setError($element[$key], t('@title: @component_title is not valid.',
    +        ['@title' => $error_label, '@component_title' => $component['title']]));
           }

    That code is not correctly formatted.

    -      $element['#element_validate'] = [[get_class($this), 'validateGeofieldGeometryText']];
    +      $element['#element_validate'] = [[get_class($this),
    +        'validateGeofieldGeometryText',
    +      ],
    +      ];

    That code is not formatted correctly.

    -      $values[$delta]['value'] = $this->geofieldBackendValue($this->wktGenerator->wktBuildPoint([trim($components['lon']), trim($components['lat'])]));
    +      $values[$delta]['value'] = $this->geofieldBackendValue($this->wktGenerator->wktBuildPoint(
    +      [trim($components['lon']), trim($components['lat'])]));

    That code is not correctly formatted.

    -      throw new InvalidPointException($this->t('@proximity_handler reports Invalid Point coordinates', [
    -        '@proximity_handler' => get_class($this),
    -      ]));
    +      throw new InvalidPointException("@proximity_handler reports Invalid Point coordinates", get_class($this)
    +      );

    That is a wrong change: The changed code is not equivalent to the existing code.

    -      throw new ProximityUnavailableException($this->t('@proximity_handler not able to calculate valid Proximity value', [
    -        '@proximity_handler' => get_class($this),
    -      ]));
    +      throw new ProximityUnavailableException("@proximity_handler not able to calculate valid Proximity value",
    +       get_class($this,
    +      ));

    To make clearer what is wrong in that change: The existing code passes a single argument to the ProximityUnavailableException constructor, while the changed code passes two arguments to the same constructor.

    -   * @todo: add more tests, particularly around max/min values.
    +   * @todo add more tests, particularly around max/min values.

    What follows @todo is a sentence: It starts with a capitalized word and it ends with a period (preferable), a question mark, or an exclamation point.

    (Furthermore, changing the code to follow the Drupal coding standards is a task.)

  • First commit to issue fork.
  • Open on Drupal.org โ†’
    Core: 10.1.4 + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    Not currently mergeable.
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    zniki.ru โ†’ made their first commit to this issueโ€™s fork.

  • Open on Drupal.org โ†’
    Core: 10.1.4 + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    Not currently mergeable.
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.1.4 + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    26 pass
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.1.4 + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    26 pass
  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    MR updated and ready for review.
    Not sure how to fix code style violations in README.md.

  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • First commit to issue fork.
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.1.4 + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    26 pass
  • Assigned to nitin_lama
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama India

    Please review.

  • Issue was unassigned.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama India
  • First commit to issue fork.
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.1.4 + Environment: PHP 8.1 & MySQL 5.7
    last update 12 months ago
    26 pass
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly itamair

    Hey folk here ... should/could we merge this?
    I added some commits ...
    Isn't enough for marking this as RWTBC and deploying this into dev branch?

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.1.4 + Environment: PHP 8.1 & MySQL 5.7
    last update 12 months ago
    26 pass
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    Thanks for update, I provide some comments on MR, please check.
    I added commit to fix use statement sort.

    Run phpcs on latest changes:

    $ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig geofield/
    
    FILE: /geofield/geofield.module
    -------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 13 WARNINGS AFFECTING 13 LINES
    -------------------------------------------------------------------------------------
     21 | WARNING | Global constants should not be used, move it to a class or interface
     28 | WARNING | Global constants should not be used, move it to a class or interface
     35 | WARNING | Global constants should not be used, move it to a class or interface
     42 | WARNING | Global constants should not be used, move it to a class or interface
     49 | WARNING | Global constants should not be used, move it to a class or interface
     56 | WARNING | Global constants should not be used, move it to a class or interface
     61 | WARNING | Global constants should not be used, move it to a class or interface
     66 | WARNING | Global constants should not be used, move it to a class or interface
     71 | WARNING | Global constants should not be used, move it to a class or interface
     76 | WARNING | Global constants should not be used, move it to a class or interface
     81 | WARNING | Global constants should not be used, move it to a class or interface
     86 | WARNING | Global constants should not be used, move it to a class or interface
     91 | WARNING | Global constants should not be used, move it to a class or interface
    -------------------------------------------------------------------------------------
    
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    Update issue summary. Add phpcs result on latest changes from 8.x-1.x.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly itamair

    Folks ... thanks for the good contribution here, but let's stop it here, also because this is already set as "Needs review".
    I am going to QA and Review this MR as it is now, and not expect further commits / changes, because indeed we don't need to be too picky and solve every single minor warning on PHPCs in the Geofield module ... because that's not really needed (many, if not even all, of the Drupal core modules are 100% compliant with drupal & php coding standards).

    Also I am not going to refactor all the constants now defined in the gefoield.module file, because that is working and has been working fine, and I don't want to risk any regression, also in the other modules that have Geofield as their dependency (Geofield Map, Leaflet, Geocoder ... ).

    I will come back to this shortly with my Tests & QA outcomes.

  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    Thanks for your feedback, as an option it's possible to create phpcs.xml.dist and mute some of the changes, that we don't want to happen.
    I have an idea to fix all phpcs violations and enable gitlab ci intergration (issue 3402400 ๐Ÿ“Œ Adopt GitlabCi Needs review ), to prevent future violations.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly itamair

    Thanks to you @zniki.ru ...
    Personally I am not sure we need to silent any phpcs warning on the Geofield module, and sincerely I don't think the module needs it.
    Simply we need to discriminate what we strictly need to fix and what not.
    I would keep the phpcs warnings (they can still help) and eventually fix the ones not already coped here, in the future ...
    For this MR I think that we added enough fixes.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly itamair

    Ok ... good job! I tested all this in a real project env of mine, and no issues were logged from Geofield module.
    So, let's merge into the 8.x-1.x-dev branch.
    Thanks everybody for the great contribution.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.1.4 + Environment: PHP 8.1 & MySQL 5.7
    last update 12 months ago
    26 pass
  • Status changed to RTBC 12 months ago
  • Status changed to Fixed 12 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly itamair
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    Thanks a lot for merging these changes to code base.
    Can you please check credits for this issue.
    According to documentation โ†’ I think that I, nitin_lama, Shank115, apaderno should also get credits on resolving this issue.

    • itamair โ†’ committed 679cda58 on 8.x-1.x
      Issue #3360474 by zniki.ru, itamair, sakthi_dev, nitin_lama, Shank115,...
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly itamair

    Fair enough. Pushed another empty commit in this, giving credits to all of you/them.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    Truly, zniki.ru was referring to the credits listed in Credit given to itamair, sakthi_dev at Specbee for Drupal India Association, arti_parmar at Smashing Infolabs Pvt. Ltd. Those do not require commits to be changed.

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed 11 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
Production build 0.71.5 2024