Problem/Motivation

The feature added in #2205271: Project namespace for dependencies was missing some documentation of the new 'project' key. Let's add it here.

Steps to reproduce

Proposed resolution

In \Drupal\Core\Extension\InfoParserInterface::parse change
* - (versions): Version information, consisting of one or more
to
* - (versions): (optional) Version information, consisting of one or more

Remaining tasks

MR with the recommended change
Review
Commit

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-2586483

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

David_Rothstein created an issue. See original summary.

David_Rothstein’s picture

Status: Active » Needs review
StatusFileSize
new1.78 KB

Here's a patch.

The first part seems worth slipping in here (I already included it in the Drupal 7 commit for the above issue).

The second part is the main change. It might actually make sense to change the code so the 'project' key is always present (it could be set to NULL if there is no project specified) but for now this patch just documents the current behavior.

jhodgdon’s picture

+++ b/core/lib/Drupal/Core/Extension/InfoParserInterface.php
@@ -34,7 +34,7 @@
-   *   - (versions): Version information, consisting of one or more
+   *   - (versions): Optional version information, consisting of one or more

Normally to indicate that something is optional in a list, the syntax is:

* - key: (optional) Information goes here
trobey’s picture

Status: Needs review » Reviewed & tested by the community

In this case we have

* - (key): (optional) Information goes here

Which could be confusing since it implies (optional) is part of the string to appear in the file. For the case when the key is enclosed in parenthesis the following probably makes the break between the file syntax and description of the syntax clearer

* - (key): Optional key, information goes here

This is followed elsewhere so it is not new. So I think the current patch is fine.

jhodgdon’s picture

Status: Reviewed & tested by the community » Needs work

This (optional) is the standard way to do this. See:
https://www.drupal.org/node/1354#lists

snehi’s picture

Status: Needs work » Needs review
StatusFileSize
new1.78 KB
new893 bytes

Please review attached one.

jhodgdon’s picture

Status: Needs review » Needs work

Thanks! Closer...

+++ b/core/lib/Drupal/Core/Extension/InfoParserInterface.php
@@ -34,7 +34,7 @@
+   *   - versions: (Optional) Version information, consisting of one or more

(optional) should be lower-case by convention.

Also in this case "(versions)" is what is actually in the string here, and you'd need to omit that whole piece for this to work, so I think we should leave the parens on (versions) here?

snehi’s picture

You mean to say only

+++ b/core/lib/Drupal/Core/Extension/InfoParserInterface.php
@@ -34,7 +34,7 @@
+   *   - (versions): 

will work ?

jhodgdon’s picture

Should say:

* - (versions): (optional) Blah blah blah etc.
snehi’s picture

Status: Needs work » Needs review
StatusFileSize
new1.78 KB
new904 bytes

Done. Thanks !!

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!

xjm’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +rc eligible

As a docs-only fix, this change is rc eligible. Reference: https://www.drupal.org/core/d8-allowed-changes#rc

  1. --- a/core/lib/Drupal/Core/Extension/InfoParserInterface.php
    +++ b/core/lib/Drupal/Core/Extension/InfoParserInterface.php
    
    @@ -34,7 +34,7 @@
    -   *   - (versions): Version information, consisting of one or more
    +   *   - (versions): (optional) Version information, consisting of one or more
    

    The array key (versions) is really wrapped in parentheses? Huh. :)

  2. +++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php
    @@ -637,8 +637,10 @@ protected function verifyImplementations(&$implementations, $hook) {
    -   *   An associative array with three keys:
    +   *   An associative array with either three or four keys:
        *   - 'name' includes the name of the thing to depend on (e.g. 'foo').
    +   *   - 'project' (if present) contains the name of the project that contains
    +   *     the thing to depend on.
        *   - 'original_version' contains the original version string (which can be
        *     used in the UI for reporting incompatibilities).
        *   - 'versions' is a list of associative arrays, each containing the keys
    

    Shouldn't this also use our standard format for associative arrays? E.g.:

    - name: The name of the thing to depend on (e.g. 'foo').
    - project: (optional) The name of the project.... (etc.)
    

NW for #2; it seems to be in the scope stated in the issue title. Thanks!

jhodgdon’s picture

Good idea! Might as well make the docs even better. :)

anil280988’s picture

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

Done Changes

Mixologic’s picture

Doing some testbot maintenance and need to kill the test run in #14. Since it is only affecting comments, I assume that's fine.

Status: Needs review » Needs work

The last submitted patch, 14: 2586483-14.patch, failed testing.

jhodgdon’s picture

Thanks! The changes in ModuleHandler look good. But:

+++ b/core/lib/Drupal/Core/Extension/InfoParserInterface.php
@@ -34,7 +34,7 @@
+   *   - (versions): optional Version information, consisting of one or more

The patch in #10 was correct in this line. This patch isn't. Please go back to the patch in #10 version.

snehi’s picture

Status: Needs work » Needs review
StatusFileSize
new2.19 KB
new902 bytes

Done.

jhodgdon’s picture

Status: Needs review » Needs work
+++ b/core/lib/Drupal/Core/Extension/InfoParserInterface.php
@@ -34,7 +34,7 @@
+   *   - versions: (optional) Version information, consisting of one or more

This line is still wrong. Again, please go back to the patch in #10 for this line.

snehi’s picture

Status: Needs work » Needs review
StatusFileSize
new2.19 KB
new904 bytes

Status: Needs review » Needs work

The last submitted patch, 20: 2586483-20.patch, failed testing.

snehi’s picture

Status: Needs work » Needs review

The last submitted patch, 14: 2586483-14.patch, failed testing.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! This looks fine. We could change
@return
to
@return array
in the second hunk, but at least this documentation is better.

The last submitted patch, 14: 2586483-14.patch, failed testing.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php
@@ -637,11 +637,13 @@ protected function verifyImplementations(&$implementations, $hook) {
+   *   - project: (optional) The name of the project that contains
+   *     the thing to depend on.

I'm not sure (optional) makes much sense in an @return - I think we need to document why it is present when it is.

rakesh.gectcr’s picture

StatusFileSize
new2.17 KB
new765 bytes

We don't really need that (optional) .

rakesh.gectcr’s picture

Status: Needs work » Needs review
anil280988’s picture

StatusFileSize
new1.99 KB

Hi All,
In the API (https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Extension!ModuleH...), It state that 3 values are returned,so Have removed optional key.

The last submitted patch, 18: 2586483-18.patch, failed testing.

jhodgdon’s picture

Status: Needs review » Needs work

I'm sorry, but I don't think either of the two patches here is correct.

If you look at the code linked in #29, you'll see in the first few lines:

// Split out the optional project name.
  if (strpos($dependency, ':') !== FALSE) {
    list($project_name, $dependency) = explode(':', $dependency);
    $value['project'] = $project_name;
  }

So definitely 'project' can be returned, but it is not always returned. So the patch in #29 is incorrect.

The patch in #27 is also unclear. It says it can return 3 or 4 keys, which is correct, but it doesn't say which one is sometimes not there or why. In #26, @alexpott requested that we not use (optional) in there to describe this, which I agree with. But we still need to put something in there to tell people that project might be missing, and why.

Also, whoever is working on the next patch, please start by assigning the issue to yourself first, so that we don't have two people submitting patches on the same issue. That is a waste of time, both for people making the patches and for reviewers. Thanks!

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Title: Update documentation for project namespaces in dependencies » Update documentation for project versions in \Drupal\Core\Extension\InfoParserInterface::parse
Issue summary: View changes
Issue tags: -Needs backport to D7 +Novice

The documentation that was in the ModuleHandler is now in \Drupal\Core\Extension\Dependency::createFromString and has since been updated. I don't think that requires a change anymore. What is left is simply to add (optional). I have updated the issue summary

quietone’s picture

Priority: Normal » Minor
brandonlira’s picture

Assigned: Unassigned » brandonlira

brandonlira’s picture

Status: Needs work » Needs review

Hi all,
I have created a new MR !11528 with the necessary documentation update.

This is now ready for review. Let me know if any further adjustments are needed.

Thanks!

brandonlira’s picture

Assigned: brandonlira » Unassigned
nexusnovaz’s picture

Status: Needs review » Reviewed & tested by the community

The change is simple and LGTM. Seems the error is unrelated through im not able to rerun the job?

quietone’s picture

Status: Reviewed & tested by the community » Needs work

This needs another adjustment to meet coding standards.

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

sivaji_ganesh_jojodae’s picture

Status: Needs work » Needs review

Updated to reflect comment #55.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Seems pretty straight forward.

  • quietone committed cad023bb on 11.1.x
    Issue #2586483 by brandonlira, snehi, anil280988, rakesh.gectcr,...

  • quietone committed 40a05844 on 11.x
    Issue #2586483 by brandonlira, snehi, anil280988, rakesh.gectcr,...
quietone’s picture

Version: 11.x-dev » 11.1.x-dev
Status: Reviewed & tested by the community » Fixed

Nice to get this finally fixed!

Status: Fixed » Closed (fixed)

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