Remove description from @return $this

Created on 20 April 2020, almost 5 years ago
Updated 3 August 2024, 7 months ago

Problem/Motivation

1) Confirmed that the changes in #11 are for returning $this as noted in #6. Note that some core code adds a description for * @return $this and some do not.

-- @Kristen Pol ( #3115436: Use proper dependency injection and protect menu_block from changes to the SystemMenuBlock constructor , #13.1)

When you do @return $this, do not provide a description like "The called object" -- just take that line out.

-- @jhodgdon a leader of the documentation team ( #2711739: Missing summary/param/return docs for several QueryInterface methods , #18.3)

Proposed resolution

  1. Remove them.
  2. A coder sniffer is expected if necessary
  3. Meanwhile there should have usages that should be changed to $this, suggested to do it in a separate issue
  4. +++ b/core/lib/Drupal/Core/Entity/Query/QueryInterface.php
    @@ -111,19 +111,28 @@ public function notExists($field, $langcode = NULL);
    * @return \Drupal\Core\Entity\Query\QueryInterface
    * The called object.
    This should be changed to say:

    @return $this

    -- @jhodgdon (#2711739-#6.4)

Remaining tasks

Postponed on #3326851: Update about @return $this and possibly #3326850: Warn if @return $this has description .

This may help to find all the instances that need to be fixed.
grep -r -A1 '@return $this' core | grep -v return | grep -v -- -- | grep -v \*\/

Child issues

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Postponed

Version

11.0 🔥

Component
Other 

Last updated about 2 hours ago

Created by

🇨🇳China jungle Chongqing, China

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024