This task is for a new student in MD Systems, don't do it if it was not assigned to you.

Problem Description:
#2536418: Create a method/property for SourcePluginUiBase moved some code of the SourcePlugins to a base class which all SourcePlugins extend. The overviewForm() and overviewSubmitForm() methods in LocaleSourcePluginUi have an outdated PHPDoc, the other classes (including the base class) are trying to inherit their PHPDoc, but there is nothing to inherit.

Proposed Resoluton:
Update the documentation, as the interface it mentions does no longer exist.
The PHPDoc in LocaleSourcePluginUi should probably move to the SourcePluginUiInterface. Then the other Plugins can succesfully inherit the PHPDoc from the base class. Maybe there are some more methods which need documentation and should be added to the Interface.

Comments

LKS90’s picture

Issue summary: View changes
MatejZmitko’s picture

MatejZmitko’s picture

Status: Active » Needs review
StatusFileSize
new1.92 KB

Status: Needs review » Needs work

The last submitted patch, 3: My-first-patch_2539332.patch, failed testing.

johnchque’s picture

Issue summary: View changes
MatejZmitko’s picture

Assigned: Unassigned » MatejZmitko
Bambell’s picture

Hi @MatejZmitko. Here are some thoughts :

Looking at the issue summary, it states that methods overviewForm and overviewSubmitForm (should read overviewFormSubmit) of LocaleSourcePluginUi have outdated documentation. You got that right. Looking at those functions, we see that the documentation states that those methods implement interface TMGMTSourceUIControllerInterface which, if you search carefully (or with PHPStorm's ctrl+shift+F functionality) doesn't exist anymore. Further LocaleSourcePluginUi now extends SourcePluginUiBase which define / have an implementation for methods overviewForm and overviewFormSubmit, so those two methods in LocaleSourcePluginUi are actually overriding those of the parent class (inheritance = @inheritdoc). We see that the documentation for those two functions in SourcePluginUiBase mention {@inheritdoc}, but that class doesn't inherit any class that contain those functions. The issue summary states that you should "[Move] the PHPDoc in LocaleSourcePluginUi [to] SourcePluginUiInterface". However, the interface doesn't define those methods, so the methods in the base class should be documented. Those two methods in the base class are overridden in ConfigSourcePluginUi, ContentEntitySourcePluginUi and LocaleSourcePluginUi. In the first two classes, the methods try to inherit documentation from their parent class and the documentation for the methods in LocaleSourcePluginUi is outdated, as mentioned previously, so the only workaround to this is to write new documentation for the base class and inherit that documentation in LocaleSourcePluginUi. That way, those 3 classes will inherit documentation from their parent class. Those methods appear to take the same parameters as Drupal\tmgmt\SourcePluginUiBase\overviewSearchFormPart, so it would certainly make sense to copy that documentation. Note that only the first of the two methods return something.

Hope that helps to move forward with the issue.

MatejZmitko’s picture

Status: Needs work » Needs review
StatusFileSize
new2.12 KB

The first path with fixed mistakes

Bambell’s picture

Status: Needs review » Needs work
  1. +++ b/sources/locale/src/LocaleSourcePluginUi.php
    @@ -94,7 +94,10 @@ class LocaleSourcePluginUi extends SourcePluginUiBase {
    +   *
    +   *
    ...
    +   *
    
    @@ -243,7 +246,9 @@ class LocaleSourcePluginUi extends SourcePluginUiBase {
    +   *
    +   *
    

    Can this be removed?

  2. +++ b/src/SourcePluginUiBase.php
    @@ -47,7 +47,17 @@ class SourcePluginUiBase extends PluginBase implements SourcePluginUiInterface {
    +   * @param FormStateInterface $form_state
    +   *   Drupal form_state array.
    
    @@ -71,7 +81,15 @@ class SourcePluginUiBase extends PluginBase implements SourcePluginUiInterface {
    +   * @param FormStateInterface $form_state
    +   *   Drupal form_state array.
    

    Sorry for the poor advise, but form_state isn't an array, but rather an object. This would be more appropriate :

    @param \Drupal\Core\Form\FormStateInterface $form_state
      The current state of the form.

I guess the documentation for the other parameters is fine enough.

MatejZmitko’s picture

Status: Needs work » Needs review
StatusFileSize
new4.52 KB
MatejZmitko’s picture

StatusFileSize
new2.01 KB
MatejZmitko’s picture

StatusFileSize
new2.05 KB
Bambell’s picture

In case it wasn't noticed yet, those files that Git generate are plain text files, so you can open them up with any text editor and investigate their content. As mentioned multiple times already :

"An interdiff is a text file in patch format that describes the changes between two versions of a patch.".
https://www.drupal.org/documentation/git/interdiff

#12 doesn't correspond to this description; it's #11 with spaces between the @param tags.

Can you please try uploading again an interdiff of #3 with #11 or better, #8 (preivous patch) with #11?

MatejZmitko’s picture

StatusFileSize
new1.91 KB
johnchque’s picture

Status: Needs review » Needs work
+++ b/src/SourcePluginUiBase.php
@@ -47,7 +47,15 @@ class SourcePluginUiBase extends PluginBase implements SourcePluginUiInterface {
+   *  The current state of the form

There should be 3 spaces between '*' and 'The current state...'

+++ b/src/SourcePluginUiBase.php
@@ -47,7 +47,15 @@ class SourcePluginUiBase extends PluginBase implements SourcePluginUiInterface {
+   *  The current state of the form

@@ -71,7 +79,12 @@ class SourcePluginUiBase extends PluginBase implements SourcePluginUiInterface {
+   *  The current state of the form

Missing . in the end.

MatejZmitko’s picture

Status: Needs work » Needs review
StatusFileSize
new1.91 KB
Bambell’s picture

Hi @MatejZmitko. I think you forgot to upload the corresponding patch and only uploaded an interdiff. It would also help if you could leave a comment along with your uploads.

MatejZmitko’s picture

StatusFileSize
new1.91 KB
new2.12 KB

So, this is the interdiff with all the code modifications between patch #8 and #11.

MatejZmitko’s picture

StatusFileSize
new2.12 KB
new1.91 KB

Sorry for the wrong file naming, should be fine now. An interdiff between patch #8 and #11

Bambell’s picture

Status: Needs review » Needs work
StatusFileSize
new29.89 KB
+++ b/sources/locale/src/LocaleSourcePluginUi.php
@@ -94,7 +94,10 @@ class LocaleSourcePluginUi extends SourcePluginUiBase {
+   *
+   *
...
+   *

@@ -243,7 +246,9 @@ class LocaleSourcePluginUi extends SourcePluginUiBase {
+   *
+   *

+++ b/src/SourcePluginUiBase.php
@@ -71,7 +81,15 @@ class SourcePluginUiBase extends PluginBase implements SourcePluginUiInterface {
+   *

Not yet, unfortunately. This patch is still introducing unneeded spaces. Also, it would help if you could name your patches using the "Patchname suggestion" button :

Patchname suggestion button.

MatejZmitko’s picture

Status: Needs work » Needs review
StatusFileSize
new2.02 KB

Final patch in this issue, with all needed code modifications.

Bambell’s picture

Looks good to me, yes. Thanks.

miro_dietiker’s picture

Status: Needs review » Needs work

@Bambell, plz add the missing first line comment summary for the methods.

Bambell’s picture

Status: Needs work » Needs review
StatusFileSize
new2.14 KB
new747 bytes

Adding a comment to the docblocks.

miro_dietiker’s picture

Status: Needs review » Fixed

Committed.

  • miro_dietiker committed 1e8b385 on 8.x-1.x authored by Bambell
    Issue #2539332 by MatejZmitko, Bambell: Add missing documentation to...

Status: Fixed » Closed (fixed)

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