API page: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Controlle...

Enter a descriptive title (above) relating to abstract class ControllerBase, then describe the problem you have found:

protected $stateService is documented as @var \Drupal\Core\KeyValueStore\KeyValueStoreInterface but it is actually @var \Drupal\Core\State\StateInterface.

Likewise, protected function state() is documented as @return \Drupal\Core\KeyValueStore\KeyValueStoreInterface but it actually should be @return \Drupal\Core\State\StateInterface.

Note the core 'state' service, which is stored in the $stateService instance variable and returned by the state() function, is documented in core.services.yml as:

  state:
    class: Drupal\Core\State\State
    arguments: ['@keyvalue', '@cache.bootstrap', '@lock']
    tags:
      - { name: needs_destruction }
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TR created an issue. See original summary.

TR’s picture

TR’s picture

Patch still applies ...

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

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now 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.

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

This is indeed the interface of the class we store in the variable (from ::state()).

alexpott’s picture

Title: ControllerBase documentation is wrong » Fix ControllerBase stateService documentation
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 126b594c58 to 8.6.x and 631cda4187 to 8.5.x. Thanks!

  • alexpott committed 126b594 on 8.6.x
    Issue #2921734 by TR: Fix ControllerBase stateService documentation
    

  • alexpott committed 631cda4 on 8.5.x
    Issue #2921734 by TR: Fix ControllerBase stateService documentation
    
    (...

Status: Fixed » Closed (fixed)

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