Resolve phpcs errors/warnings

Issue fork country-3372994

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

roshni27’s picture

roshni27 created an issue.
I am working on it.

roshni27’s picture

Issue summary: View changes

roshni27’s picture

Assigned: roshni27 » Unassigned
Status: Active » Needs review

Some issues which are better know to maintainer are pending, for reading purpose character limits issues remain and all remaining issues solve by me. Please review the MR.

batigolix made their first commit to this issue’s fork.

batigolix’s picture

I fixed the remaining phpcs issues.

  • e16b7159 committed on 8.x-1.x
    Issue #3372994 by roshni27, batigolix: Fix the warnings/errors reported...
batigolix’s picture

I tried to rebase the merge request but due to the recent changes this led to git conflicts and I could not safely resolve these.

So I took the low hanging fruit phpcs fixes from your merge requests and committed these.

This means there are 2 phpcs errors left that need to be fixed:

FILE: /var/www/html/web/modules/contrib/country/src/Plugin/Field/FieldFormatter/CountryDefaultFormatter.php
-----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------
 27 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
-----------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/country/src/Plugin/Field/FieldWidget/CountryAutocompleteWidget.php
----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------
 37 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------------------

I close the merge request, and set this issue to Needs Work

avpaderno’s picture

Status: Needs review » Needs work
batigolix’s picture

Issue summary: View changes
batigolix’s picture

Issue tags: +finalist-sprint
nitin_lama’s picture

Assigned: Unassigned » nitin_lama

nitin_lama’s picture

Status: Needs work » Needs review

Fixed issues. Please review.

nitin_lama’s picture

Assigned: nitin_lama » Unassigned
paraderojether’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new235.93 KB
new290.47 KB

Hi nitin_lama,

I reviewed MR!10 and applied it against Country 8.x-1.x-dev with Drupal core version 10.1.7 and confirmed it fixes the issues reported by phpcs.

I added screenshots for reference.
Thank you.

sleitner’s picture

Status: Reviewed & tested by the community » Needs work

public function getList() in CountryFieldManager should not be removed as long as it is used. And you revert some changes made by other issues in the meantime. Is this intended?

batigolix’s picture

Status: Needs work » Fixed

As mentioned in #8 : there are 2 phpcs errors that still need fixing.

Can you restrict your changes just to the 2 remaining phpcs errors?

If you think other issues need to be addressed, please create another issue.

If you have other phpcs output, please post it here as well

batigolix’s picture

Status: Fixed » Needs work
chaitanyadessai’s picture

Status: Needs work » Needs review
StatusFileSize
new4.01 KB

@batigolix Addressed #8 please review patch.

arjenk’s picture

Status: Needs review » Needs work

This is starting to look very good. Just a couple of small remarks;

+  public function __construct(CountryFieldManager $countryFieldManager) {
+    $this->countryFieldManager = $countryFieldManager;
+  }

You will need to call the parent::__construct() here, otherwise the non overridden functions in FormatterBase are missing services. The current implementation breaks the settings of the field.

+  public function __construct(CountryFieldManager $countryFieldManager) {
+    $this->countryFieldManager = $countryFieldManager;
+  }

That means this will also needs more parameters.

+  /**
+   * {@inheritdoc}
+   */

Bonus points for replacing this with the correct parameter definitions.

chaitanyadessai’s picture

Status: Needs work » Needs review
StatusFileSize
new6.38 KB

Please review Patch #22 addressed.

batigolix’s picture

Status: Needs review » Needs work

If I go to /admin/structure/types/manage/article/form-display and switch from the Default Widget to the Autocomplete Widget, then I get this error:

TypeError: Drupal\Core\Field\WidgetBase::__construct(): Argument #5 ($third_party_settings) must be of type array, null given, called in /var/www/html/web/modules/contrib/country/src/Plugin/Field/FieldWidget/CountryAutocompleteWidget.php on line 63 in Drupal\Core\Field\WidgetBase->__construct() (line 50 of /var/www/html/web/core/lib/Drupal/Core/Field/WidgetBase.php).

chaitanyadessai’s picture

Assigned: Unassigned » chaitanyadessai
chaitanyadessai’s picture

Assigned: chaitanyadessai » Unassigned
Status: Needs work » Needs review
StatusFileSize
new6.34 KB
new13.45 KB
new7.39 KB
new17 KB

Fixed Error mentioned in #24. please review updated patch, Thanks

  • c511f09c committed on 8.x-1.x
    Issue #3372994 by chaitanyadessai, nitin_lama, roshni27, batigolix,...
batigolix’s picture

Status: Needs review » Fixed

I tested this and it works now. I committed this.

Thanks everybody for their help

Status: Fixed » Closed (fixed)

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