Skip to content

[generate:plugin:skeleton] Namespace Error #3993

@drakythe

Description

@drakythe

Problem/Motivation

When a plugin skeleton is generated the namespace is broken in at least one situation

Details to include:
The generated code needs to be updated to include proper name spacing so that a generated plugin will run without errors.

How to reproduce

I followed instruction at https://docs.drupalcommerce.org/commerce2/developer-guide/checkout/create-custom-checkout-pane and ended up with a non-functioning plugin.

Details to include:

  • Drupal version 8.6.2
  • Console version 1.8.0
  • Console Launcher version 1.8.0

After running the commands

drupal generate:module  \
  --module="My checkout pane" \
  --machine-name="my_checkout_pane" \
  --module-path="modules/custom" \
  --description="My checkout pane" \
  --core="8.x" \
  --package="Custom" \
  --composer \
  --dependencies="commerce:commerce_checkout"

and

drupal generate:plugin:skeleton  \
  --module="my_checkout_pane" \
  --plugin-id="commerce_checkout_pane" \
  --class="CustomCompletionMessage"

I was presented with a plugin that began

<?php

namespace Drupal\my_checkout_pane\Plugin\CommerceCheckoutPane;

use Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CheckoutPaneInterface;

Located structurally in modules/custom/my_checkout_pane/src/Plugin/Commerce/CheckoutPane. Because of this the namespace line should read

namespace Drupal\my_checkout_pane\Plugin\Commerce\CheckoutPane;

(a backslash character entered between Commerce and CheckoutPane)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions