diff --git a/core/modules/block_content/config/schema/block_content.schema.yml b/core/modules/block_content/config/schema/block_content.schema.yml index a39fda4..2e7c338 100644 --- a/core/modules/block_content/config/schema/block_content.schema.yml +++ b/core/modules/block_content/config/schema/block_content.schema.yml @@ -16,4 +16,3 @@ block_content.type.*: description: type: text label: 'Description' - diff --git a/core/modules/file/src/Plugin/migrate/source/d7/File.php b/core/modules/file/src/Plugin/migrate/source/d7/File.php index 93d92e4..d54c258 100644 --- a/core/modules/file/src/Plugin/migrate/source/d7/File.php +++ b/core/modules/file/src/Plugin/migrate/source/d7/File.php @@ -89,8 +89,8 @@ public function prepareRow(Row $row) { // At this point, $path could be an absolute path or a relative path, // depending on how the scheme's variable was set. So we need to shear out // the source_base_path in order to make them all relative. - // @todo Don't depend on destination configuration and figure out if this is - // even needed at all? https://www.drupal.org/node/2577871 + // @todo https://www.drupal.org/node/2577871 Don't depend on destination + // configuration and figure out if this is even needed at all? $path = str_replace($this->migration->get('destination')['source_base_path'], NULL, $path); $row->setSourceProperty('filepath', $path); return parent::prepareRow($row); diff --git a/core/modules/migrate/src/Entity/MigrationInterface.php b/core/modules/migrate/src/Entity/MigrationInterface.php index 1c8eb60..b35cf29 100644 --- a/core/modules/migrate/src/Entity/MigrationInterface.php +++ b/core/modules/migrate/src/Entity/MigrationInterface.php @@ -7,10 +7,13 @@ namespace Drupal\migrate\Entity; +use Drupal\Component\Plugin\DerivativeInspectionInterface; +use Drupal\Component\Plugin\PluginInspectionInterface; + /** * Interface for migrations. */ -interface MigrationInterface { +interface MigrationInterface extends PluginInspectionInterface, DerivativeInspectionInterface { /** * A constant used for systemOfRecord. @@ -101,6 +104,9 @@ * An alias for getPluginId() for backwards compatibility reasons. * * @return string + * The plugin_id of the plugin instance. + * + * @see \Drupal\migrate\Entity\MigrationInterface::getPluginId() */ public function id(); diff --git a/core/modules/migrate/src/MigrateExecutable.php b/core/modules/migrate/src/MigrateExecutable.php index 24c4711..7f9b00d 100644 --- a/core/modules/migrate/src/MigrateExecutable.php +++ b/core/modules/migrate/src/MigrateExecutable.php @@ -29,7 +29,7 @@ class MigrateExecutable implements MigrateExecutableInterface { /** * The configuration of the migration to do. * - * @var \Drupal\migrate\Plugin\Migration + * @var \Drupal\migrate\Entity\MigrationInterface */ protected $migration; diff --git a/core/modules/migrate/src/Plugin/Migration.php b/core/modules/migrate/src/Plugin/Migration.php index 25c61bc..0e1fd16 100644 --- a/core/modules/migrate/src/Plugin/Migration.php +++ b/core/modules/migrate/src/Plugin/Migration.php @@ -19,7 +19,6 @@ * * The migration entity stores the information about a single migration, like * the source, process and destination plugins. - * */ class Migration extends PluginBase implements MigrationInterface, RequirementsInterface { @@ -257,7 +256,7 @@ public function label() { } /** - * Gets any arbitrary property. + * Gets any arbitrary property's value. * * @param string $property * The property to retrieve. @@ -265,8 +264,8 @@ public function label() { * @return mixed * The value for that property, or NULL if the property does not exist. */ - public function get($key) { - return isset($this->$key) ? $this->$key : NULL; + public function get($property) { + return isset($this->$property) ? $this->$property : NULL; } /** diff --git a/core/modules/migrate/src/Plugin/MigrationDeriverTrait.php b/core/modules/migrate/src/Plugin/MigrationDeriverTrait.php index 00e4fab..c1a6eff 100644 --- a/core/modules/migrate/src/Plugin/MigrationDeriverTrait.php +++ b/core/modules/migrate/src/Plugin/MigrationDeriverTrait.php @@ -15,11 +15,8 @@ /** * Returns a fully initialized instance of a source plugin. * - * @param string $plugin_id - * The plugin ID. - * @param array $configuration - * (optional) Additional configuration for the plugin. Defaults to an empty - * array. + * @param string $source_plugin_id + * The source plugin ID. * * @return \Drupal\migrate\Plugin\MigrateSourceInterface|\Drupal\migrate\Plugin\RequirementsInterface * The fully initialized source plugin. diff --git a/core/modules/migrate/src/Plugin/MigrationPluginManagerInterface.php b/core/modules/migrate/src/Plugin/MigrationPluginManagerInterface.php index 87ec3c6..02d329b 100644 --- a/core/modules/migrate/src/Plugin/MigrationPluginManagerInterface.php +++ b/core/modules/migrate/src/Plugin/MigrationPluginManagerInterface.php @@ -10,7 +10,7 @@ use Drupal\Component\Plugin\PluginManagerInterface; /** - * Migration plugin manager interface + * Migration plugin manager interface. */ interface MigrationPluginManagerInterface extends PluginManagerInterface { diff --git a/core/modules/migrate/src/Tests/MigrateTestBase.php b/core/modules/migrate/src/Tests/MigrateTestBase.php index 2b956ee..19bf66b 100644 --- a/core/modules/migrate/src/Tests/MigrateTestBase.php +++ b/core/modules/migrate/src/Tests/MigrateTestBase.php @@ -227,7 +227,13 @@ protected function mockFailure($migration, array $row, $status = MigrateIdMapInt } /** + * Gets the migration plugin. + * + * @param $plugin_id + * The plugin ID of the migration to get. + * * @return \Drupal\migrate\Plugin\Migration + * The migration plugin. */ protected function getMigration($plugin_id) { return $this->container->get('plugin.manager.migration')->createInstance($plugin_id); diff --git a/core/modules/migrate/src/Tests/MigrationTest.php b/core/modules/migrate/src/Tests/MigrationTest.php index 8eeaa0e..998337d 100644 --- a/core/modules/migrate/src/Tests/MigrationTest.php +++ b/core/modules/migrate/src/Tests/MigrationTest.php @@ -14,6 +14,7 @@ * Tests the migration plugin. * * @group migrate + * * @coversDefaultClass \Drupal\migrate\Plugin\Migration */ class MigrationTest extends KernelTestBase { diff --git a/core/modules/migrate/tests/src/Unit/MigrationTest.php b/core/modules/migrate/tests/src/Unit/MigrationTest.php index a1d28af..b338fce 100644 --- a/core/modules/migrate/tests/src/Unit/MigrationTest.php +++ b/core/modules/migrate/tests/src/Unit/MigrationTest.php @@ -7,7 +7,6 @@ namespace Drupal\Tests\migrate\Unit; -use Drupal\Core\Entity\EntityManagerInterface; use Drupal\migrate\Plugin\Migration; use Drupal\migrate\Exception\RequirementsException; use Drupal\migrate\Plugin\MigrateDestinationInterface; @@ -18,6 +17,7 @@ /** * @coversDefaultClass \Drupal\migrate\Plugin\Migration + * * @group Migration */ class MigrationTest extends UnitTestCase { diff --git a/core/modules/migrate_drupal/src/MigrationCreationTrait.php b/core/modules/migrate_drupal/src/MigrationCreationTrait.php index daabc56..7e92e51 100644 --- a/core/modules/migrate_drupal/src/MigrationCreationTrait.php +++ b/core/modules/migrate_drupal/src/MigrationCreationTrait.php @@ -39,8 +39,8 @@ protected function getConnection(array $database) { /** * Gets the system data from the system table of the source Drupal database. * - * @param array $database - * Database array representing the source Drupal database. + * @param \Drupal\Core\Database\Connection $connection + * Database connection to the source Drupal database. * * @return array * The system data from the system table of the source Drupal database. diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/CckMigration.php b/core/modules/migrate_drupal/src/Plugin/migrate/CckMigration.php index 42cec25..e18e20c 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/CckMigration.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/CckMigration.php @@ -59,6 +59,8 @@ class CckMigration extends Migration implements ContainerFactoryPluginInterface * The plugin definition. * @param \Drupal\migrate\Plugin\MigratePluginManager $cck_manager * The cckfield plugin manager. + * @param \Drupal\migrate\Plugin\MigrationPluginManagerInterface $migration_plugin_manager + * The migration plugin manager. */ public function __construct(array $configuration, $plugin_id, $plugin_definition, MigratePluginManager $cck_manager, MigrationPluginManagerInterface $migration_plugin_manager) { parent::__construct($configuration, $plugin_id, $plugin_definition); @@ -99,8 +101,8 @@ public function getProcess() { $field_type = $row->getSourceProperty('type'); if (!isset($this->processedFieldTypes[$field_type]) && $this->cckPluginManager->hasDefinition($field_type)) { $this->processedFieldTypes[$field_type] = TRUE; - // Allow the cckfield plugin to alter the migration as necessary so that - // it knows how to handle fields of this type. + // Allow the cckfield plugin to alter the migration as necessary so + // that it knows how to handle fields of this type. if (!isset($this->cckPluginCache[$field_type])) { $this->cckPluginCache[$field_type] = $this->cckPluginManager->createInstance($field_type, [], $this); } diff --git a/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php index f64549d..59f28b5 100644 --- a/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php +++ b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php @@ -972,7 +972,8 @@ public function validateCredentialForm(array &$form, FormStateInterface $form_st // Store the retrived system data in from storage. $form_state->set('system_data', $system_data); - } catch (\Exception $e) { + } + catch (\Exception $e) { $error_message = [ '#type' => 'inline_template', '#template' => '{% trans %}Resolve the issue below to continue the upgrade.{% endtrans%}{{ errors }}', diff --git a/core/modules/node/src/Plugin/migrate/D6NodeDeriver.php b/core/modules/node/src/Plugin/migrate/D6NodeDeriver.php index 97c9329..109b8f1 100644 --- a/core/modules/node/src/Plugin/migrate/D6NodeDeriver.php +++ b/core/modules/node/src/Plugin/migrate/D6NodeDeriver.php @@ -22,9 +22,11 @@ class D6NodeDeriver extends DeriverBase implements ContainerDeriverInterface { use MigrationDeriverTrait; /** - * @var bool + * The base plugin ID this derivative is for. + * + * @var string */ - protected $init = FALSE; + protected $basePluginId; /** * Already-instantiated cckfield plugins, keyed by ID. @@ -34,6 +36,8 @@ class D6NodeDeriver extends DeriverBase implements ContainerDeriverInterface { protected $cckPluginCache; /** + * The CCK plugin manager. + * * @var \Drupal\Component\Plugin\PluginManagerInterface */ protected $cckPluginManager; @@ -41,8 +45,10 @@ class D6NodeDeriver extends DeriverBase implements ContainerDeriverInterface { /** * D6NodeDeriver constructor. * - * @param $base_plugin_id + * @param string $base_plugin_id + * The base plugin ID for the plugin ID. * @param \Drupal\Component\Plugin\PluginManagerInterface $cck_manager + * The CCK plugin manager. */ public function __construct($base_plugin_id, PluginManagerInterface $cck_manager) { $this->basePluginId = $base_plugin_id; @@ -64,10 +70,11 @@ public static function create(ContainerInterface $container, $base_plugin_id) { * * @param array $base_plugin_definition * The definition array of the base plugin. + * * @return array * An array of full derivative definitions keyed on derivative id. * - * @see getDerivativeDefinition() + * @see \Drupal\Component\Plugin\Derivative\DeriverBase::getDerivativeDefinition() */ public function getDerivativeDefinitions($base_plugin_definition) { // Read all CCK field instance definitions in the source database. @@ -93,12 +100,12 @@ public function getDerivativeDefinitions($base_plugin_definition) { $label = $base_plugin_definition['label']; $values['label'] = t("@label (@type)", [ '@label' => $label, - '@type' => $node_type + '@type' => $node_type, ]); $values['source']['node_type'] = $node_type; - // If this migration is based on the d6_node_revision template, it should - // explicitly depend on the corresponding d6_node variant. + // If this migration is based on the d6_node_revision template, it + // should explicitly depend on the corresponding d6_node variant. if ($base_plugin_definition['id'] == 'd6_node_revision') { $values['migration_dependencies']['required'][] = 'd6_node:' . $node_type; } diff --git a/core/modules/node/src/Plugin/migrate/D7NodeDeriver.php b/core/modules/node/src/Plugin/migrate/D7NodeDeriver.php index cfbd663..9d45254 100644 --- a/core/modules/node/src/Plugin/migrate/D7NodeDeriver.php +++ b/core/modules/node/src/Plugin/migrate/D7NodeDeriver.php @@ -21,9 +21,11 @@ class D7NodeDeriver extends DeriverBase implements ContainerDeriverInterface { use MigrationDeriverTrait; /** - * @var bool + * The base plugin ID this derivative is for. + * + * @var string */ - protected $init = FALSE; + protected $basePluginId; /** * Already-instantiated cckfield plugins, keyed by ID. @@ -33,6 +35,8 @@ class D7NodeDeriver extends DeriverBase implements ContainerDeriverInterface { protected $cckPluginCache; /** + * The CCK plugin manager. + * * @var \Drupal\Component\Plugin\PluginManagerInterface */ protected $cckPluginManager; @@ -40,8 +44,10 @@ class D7NodeDeriver extends DeriverBase implements ContainerDeriverInterface { /** * D7NodeDeriver constructor. * - * @param $base_plugin_id + * @param string $base_plugin_id + * The base plugin ID for the plugin ID. * @param \Drupal\Component\Plugin\PluginManagerInterface $cck_manager + * The CCK plugin manager. */ public function __construct($base_plugin_id, PluginManagerInterface $cck_manager) { $this->basePluginId = $base_plugin_id; @@ -78,7 +84,7 @@ public function getDerivativeDefinitions($base_plugin_definition) { $values['label'] = t('@label (@type)', [ '@label' => $values['label'], - '@type' => $row->getSourceProperty('name') + '@type' => $row->getSourceProperty('name'), ]); $values['source']['node_type'] = $node_type; @@ -108,5 +114,4 @@ public function getDerivativeDefinitions($base_plugin_definition) { return $this->derivatives; } - } diff --git a/core/modules/taxonomy/src/Plugin/migrate/D6TermNodeDeriver.php b/core/modules/taxonomy/src/Plugin/migrate/D6TermNodeDeriver.php index 539be68..245c026 100644 --- a/core/modules/taxonomy/src/Plugin/migrate/D6TermNodeDeriver.php +++ b/core/modules/taxonomy/src/Plugin/migrate/D6TermNodeDeriver.php @@ -19,8 +19,28 @@ class D6TermNodeDeriver extends DeriverBase implements ContainerDeriverInterface { use MigrationDeriverTrait; + /** + * The base plugin ID this derivative is for. + * + * @var string + */ protected $basePluginId; + /** + * The migration plugin manager. + * + * @var \Drupal\Component\Plugin\PluginManagerInterface + */ + protected $migrationPluginManager; + + /** + * D6TermNodeDeriver constructor. + * + * @param string $base_plugin_id + * The base plugin ID this derivative is for. + * @param \Drupal\Component\Plugin\PluginManagerInterface $migration_plugin_manager + * The migration plugin manager. + */ public function __construct($base_plugin_id, PluginManagerInterface $migration_plugin_manager) { $this->basePluginId = $base_plugin_id; $this->migrationPluginManager = $migration_plugin_manager; @@ -55,5 +75,4 @@ public function getDerivativeDefinitions($base_plugin_definition, $base_plugin_d return $this->derivatives; } - } diff --git a/core/modules/taxonomy/tests/modules/taxonomy_term_stub_test/migrations/taxonomy_term_stub_test.yml b/core/modules/taxonomy/tests/modules/taxonomy_term_stub_test/migrations/taxonomy_term_stub_test.yml index 92510aa..ddca901 100644 --- a/core/modules/taxonomy/tests/modules/taxonomy_term_stub_test/migrations/taxonomy_term_stub_test.yml +++ b/core/modules/taxonomy/tests/modules/taxonomy_term_stub_test/migrations/taxonomy_term_stub_test.yml @@ -27,5 +27,3 @@ destination: migration_dependencies: required: - vocabularies - - diff --git a/core/modules/user/src/Plugin/migrate/ProfileValues.php b/core/modules/user/src/Plugin/migrate/ProfileValues.php index 202e3c4..9beeb44 100644 --- a/core/modules/user/src/Plugin/migrate/ProfileValues.php +++ b/core/modules/user/src/Plugin/migrate/ProfileValues.php @@ -16,6 +16,8 @@ class ProfileValues extends Migration { /** + * Flag determining whether the process plugin has been initialized. + * * @var bool */ protected $init = FALSE; diff --git a/core/modules/user/src/Tests/Migrate/d7/UserMigrationClassTest.php b/core/modules/user/src/Tests/Migrate/d7/UserMigrationClassTest.php index 04d00c3..a804638 100644 --- a/core/modules/user/src/Tests/Migrate/d7/UserMigrationClassTest.php +++ b/core/modules/user/src/Tests/Migrate/d7/UserMigrationClassTest.php @@ -17,8 +17,10 @@ class UserMigrationClassTest extends MigrateDrupal7TestBase { /** - * Tests that profile fields are merged into the d6_profile_values migration's - * process pipeline by the d6_profile_values builder. + * Tests d6_profile_values builder. + * + * Ensures profile fields are merged into the d6_profile_values migration's + * process pipeline. */ public function testClass() { $migration = $this->getMigration('d7_user');