TaxTypeManager::__construct() has a space in hook name and cache key:

public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
    parent::__construct('Plugin/Commerce/TaxType', $namespaces, $module_handler, 'Drupal\commerce_tax\Plugin\Commerce\TaxType\TaxTypeInterface', 'Drupal\commerce_tax\Annotation\CommerceTaxType');

    $this->alterInfo('commerce_tax type_info');
    $this->setCacheBackend($cache_backend, 'commerce_tax type_plugins');
  }

While cache key with a space may not have an impact on overall functionality, alter hook name with a space in it makes it impossible to create an alter hook function since PHP does not allow functions have spaces in their names (e.g., function hook_commerce_tax type_info_alter(&$info) {}).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

maijs created an issue. See original summary.

maijs’s picture

A patch (without tests) is attached.

maijs’s picture

maijs’s picture

Status: Active » Needs review

While tests fail (they are not related to this issue), I'm marking it as Needs review.

  • bojanz committed 7cb499b on 8.x-2.x authored by maijs
    Issue #2895908 by maijs: TaxTypeManager defines invalid alter hook and...
bojanz’s picture

Status: Needs review » Fixed

Committed #2, we're basically fixing a typo here, the test doesn't seem needed.

Thank you for both patches, in any case. Greatly appreciated.

Status: Fixed » Closed (fixed)

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