 .../migrate/src/Plugin/MigrateBuilderInterface.php |  4 +-
 .../src/Plugin/MigrateDestinationInterface.php     |  8 ++--
 .../src/Plugin/MigrateDestinationPluginManager.php |  6 +--
 .../migrate/src/Plugin/MigrateIdMapInterface.php   | 22 ++++++-----
 .../migrate/src/Plugin/MigratePluginManager.php    |  5 ++-
 .../migrate/src/Plugin/MigrateProcessInterface.php | 10 ++---
 .../migrate/src/Plugin/MigrateSourceInterface.php  | 14 ++++---
 .../src/Plugin/migrate/process/DedupeEntity.php    |  2 +
 .../src/Plugin/migrate/process/DefaultValue.php    |  2 +-
 .../migrate/src/Plugin/migrate/process/Flatten.php |  1 +
 .../migrate/src/Plugin/migrate/process/Get.php     |  3 ++
 .../src/Plugin/migrate/process/Iterator.php        |  1 +
 .../src/Plugin/migrate/process/MachineName.php     | 10 +++--
 .../src/Plugin/migrate/process/Migration.php       |  7 +++-
 .../migrate/src/Plugin/migrate/process/Route.php   | 12 +++---
 .../src/Plugin/migrate/source/DummyQueryTrait.php  |  7 +++-
 .../src/Plugin/migrate/source/EmptySource.php      |  3 ++
 .../src/Plugin/migrate/source/SourcePluginBase.php | 45 ++++++++++++++--------
 .../migrate/src/Plugin/migrate/source/SqlBase.php  | 20 ++++++----
 19 files changed, 116 insertions(+), 66 deletions(-)

diff --git a/core/modules/migrate/src/Plugin/MigrateBuilderInterface.php b/core/modules/migrate/src/Plugin/MigrateBuilderInterface.php
index c615dd4..511af1b 100644
--- a/core/modules/migrate/src/Plugin/MigrateBuilderInterface.php
+++ b/core/modules/migrate/src/Plugin/MigrateBuilderInterface.php
@@ -8,14 +8,14 @@
 namespace Drupal\migrate\Plugin;
 
 /**
  * Defines the builder plugin type.
  *
  * Builder plugins implement custom logic to generate migration entities from
- * migration templates. For example, a migration may need to be customized
- * based on data that's present in the source database; such customization is
+ * migration templates. For example, a migration may need to be customized based
+ * on data that's present in the source database; such customization is
  * implemented by builders.
  */
 interface MigrateBuilderInterface {
 
   /**
    * Builds migration entities based on a template.
diff --git a/core/modules/migrate/src/Plugin/MigrateDestinationInterface.php b/core/modules/migrate/src/Plugin/MigrateDestinationInterface.php
index 08a12e5..97c684d 100644
--- a/core/modules/migrate/src/Plugin/MigrateDestinationInterface.php
+++ b/core/modules/migrate/src/Plugin/MigrateDestinationInterface.php
@@ -9,12 +9,14 @@
 
 use Drupal\Component\Plugin\PluginInspectionInterface;
 use Drupal\migrate\Entity\MigrationInterface;
 use Drupal\migrate\Row;
 
 /**
+ * Defines an interface for Migration Destination classes.
+ *
  * Destinations are responsible for persisting source data into the destination
  * Drupal.
  *
  * @see \Drupal\migrate\Plugin\destination\DestinationBase
  * @see \Drupal\migrate\Plugin\MigrateDestinationPluginManager
  * @see \Drupal\migrate\Annotation\MigrateDestination
@@ -40,17 +42,17 @@ public function getIds();
   /**
    * Returns an array of destination fields.
    *
    * Derived classes must implement fields(), returning a list of available
    * destination fields.
    *
-   * @todo Review the cases where we need the Migration parameter,
-   * can we avoid that?
+   * @todo Review the cases where we need the Migration parameter, can we avoid
+   *   that? To be resolved with https://www.drupal.org/node/2543568.
    *
    * @param \Drupal\migrate\Entity\MigrationInterface $migration
-   *   (optional) The migration containing this destination.
+   *   (optional) The migration containing this destination. Defaults to NULL.
    *
    * @return array
    *   - Keys: machine names of the fields
    *   - Values: Human-friendly descriptions of the fields.
    */
   public function fields(MigrationInterface $migration = NULL);
diff --git a/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php b/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php
index 96f7be5..383a7de 100644
--- a/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php
+++ b/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php
@@ -2,13 +2,12 @@
 
 /**
  * @file
  * Contains \Drupal\migrate\Plugin\MigrateDestinationPluginManager.
  */
 
-
 namespace Drupal\migrate\Plugin;
 
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\migrate\Entity\MigrationInterface;
@@ -34,24 +33,25 @@ class MigrateDestinationPluginManager extends MigratePluginManager {
 
   /**
    * Constructs a MigrateDestinationPluginManager object.
    *
    * @param string $type
    *   The type of the plugin: row, source, process, destination, entity_field,
-   * id_map.
+   *   id_map.
    * @param \Traversable $namespaces
    *   An object that implements \Traversable which contains the root paths
    *   keyed by the corresponding namespace to look for plugin implementations.
    * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
    * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
    *   The entity manager.
    * @param string $annotation
-   *   The annotation class name.
+   *   (optional) The annotation class name. Defaults to
+   *   'Drupal\migrate\Annotation\MigrateDestination'.
    */
   public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EntityManagerInterface $entity_manager, $annotation = 'Drupal\migrate\Annotation\MigrateDestination') {
     parent::__construct($type, $namespaces, $cache_backend, $module_handler, $annotation);
     $this->entityManager = $entity_manager;
   }
 
diff --git a/core/modules/migrate/src/Plugin/MigrateIdMapInterface.php b/core/modules/migrate/src/Plugin/MigrateIdMapInterface.php
index 36be2dd..6a7a9d0 100644
--- a/core/modules/migrate/src/Plugin/MigrateIdMapInterface.php
+++ b/core/modules/migrate/src/Plugin/MigrateIdMapInterface.php
@@ -34,48 +34,52 @@
   const ROLLBACK_DELETE = 0;
   const ROLLBACK_PRESERVE = 1;
 
   /**
    * Saves a mapping from the source identifiers to the destination identifiers.
    *
-   * Called upon import of one row, we record a mapping from the source ID
-   * to the destination ID. Also may be called, setting the third parameter to
+   * Called upon import of one row, we record a mapping from the source ID to
+   * the destination ID. Also may be called, setting the third parameter to
    * NEEDS_UPDATE, to signal an existing record should be re-migrated.
    *
    * @param \Drupal\migrate\Row $row
    *   The raw source data. We use the ID map derived from the source object
    *   to get the source identifier values.
    * @param array $destination_id_values
    *   An array of destination identifier values.
    * @param int $status
-   *   Status of the source row in the map.
+   *   (optional) Status of the source row in the map. Defaults to
+   *   self::STATUS_IMPORTED.
    * @param int $rollback_action
-   *   How to handle the destination object on rollback.
+   *   (optional) How to handle the destination object on rollback. Defaults to
+   *   self::ROLLBACK_DELETE.
    */
   public function saveIdMapping(Row $row, array $destination_id_values, $status = self::STATUS_IMPORTED, $rollback_action = self::ROLLBACK_DELETE);
 
   /**
    * Saves a message related to a source record in the migration message table.
    *
    * @param array $source_id_values
    *   The source identifier keyed values of the record, e.g. ['nid' => 5].
    * @param string $message
    *   The message to record.
    * @param int $level
-   *   Optional message severity (defaults to MESSAGE_ERROR).
+   *   (optional) The message severity. Defaults to
+   *   MigrationInterface::MESSAGE_ERROR.
    */
   public function saveMessage(array $source_id_values, $message, $level = MigrationInterface::MESSAGE_ERROR);
 
   /**
    * Retrieves an iterator over messages relate to source records.
    *
    * @param array $source_id_values
-   *   (optional) The source identifier keyed values of the record, e.g. ['nid' => 5].
-   *   If empty, all messages are retrieved.
+   *   (optional) The source identifier keyed values of the record, e.g.
+   *   ['nid' => 5]. If empty (the default), all messages are retrieved.
    * @param int $level
-   *   (optional) Message severity. If NULL, retrieve messages of all severities.
+   *   (optional) Message severity. If NULL (the default), retrieve messages of
+   *   all severities.
    *
    * @return \Iterator
    *   Retrieves an iterator over the message rows.
    */
   public function getMessageIterator(array $source_id_values = [], $level = NULL);
 
@@ -133,13 +137,13 @@ public function messageCount();
   /**
    * Deletes the map and message entries for a given source record.
    *
    * @param array $source_id_values
    *   The source identifier keyed values of the record, e.g. ['nid' => 5].
    * @param bool $messages_only
-   *   TRUE to only delete the migrate messages.
+   *   (optional) TRUE to only delete the migrate messages. Defaults to FALSE.
    */
   public function delete(array $source_id_values, $messages_only = FALSE);
 
   /**
    * Deletes the map and message table entries for a given destination row.
    *
diff --git a/core/modules/migrate/src/Plugin/MigratePluginManager.php b/core/modules/migrate/src/Plugin/MigratePluginManager.php
index 84f2278..6ca1a24 100644
--- a/core/modules/migrate/src/Plugin/MigratePluginManager.php
+++ b/core/modules/migrate/src/Plugin/MigratePluginManager.php
@@ -31,22 +31,23 @@ class MigratePluginManager extends DefaultPluginManager {
 
   /**
    * Constructs a MigratePluginManager object.
    *
    * @param string $type
    *   The type of the plugin: row, source, process, destination, entity_field,
-   * id_map.
+   *   id_map.
    * @param \Traversable $namespaces
    *   An object that implements \Traversable which contains the root paths
    *   keyed by the corresponding namespace to look for plugin implementations.
    * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
    *   Cache backend instance to use.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler to invoke the alter hook with.
    * @param string $annotation
-   *   The annotation class name.
+   *   (optional) The annotation class name. Defaults to
+   *   'Drupal\Component\Annotation\PluginID'.
    */
   public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, $annotation = 'Drupal\Component\Annotation\PluginID') {
     $plugin_interface = isset($plugin_interface_map[$type]) ? $plugin_interface_map[$type] : NULL;
     parent::__construct("Plugin/migrate/$type", $namespaces, $module_handler, $plugin_interface, $annotation);
     $this->alterInfo('migrate_' . $type . '_info');
     $this->setCacheBackend($cache_backend, 'migrate_plugins_' . $type);
diff --git a/core/modules/migrate/src/Plugin/MigrateProcessInterface.php b/core/modules/migrate/src/Plugin/MigrateProcessInterface.php
index 6f9d7ae..f6f6403 100644
--- a/core/modules/migrate/src/Plugin/MigrateProcessInterface.php
+++ b/core/modules/migrate/src/Plugin/MigrateProcessInterface.php
@@ -34,18 +34,18 @@
    *
    * @param mixed $value
    *   The value to be transformed.
    * @param \Drupal\migrate\MigrateExecutableInterface $migrate_executable
    *   The migration in which this process is being executed.
    * @param \Drupal\migrate\Row $row
-   *   The row from the source to process. Normally, just transforming the
-   *   value is adequate but very rarely you might need to change two columns
-   *   at the same time or something like that.
+   *   The row from the source to process. Normally, just transforming the value
+   *   is adequate but very rarely you might need to change two columns at the
+   *   same time or something like that.
    * @param string $destination_property
-   *   The destination property currently worked on. This is only used
-   *   together with the $row above.
+   *   The destination property currently worked on. This is only used together
+   *   with the $row above.
    *
    * @return string|array
    *   The newly transformed value.
    */
   public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property);
 
diff --git a/core/modules/migrate/src/Plugin/MigrateSourceInterface.php b/core/modules/migrate/src/Plugin/MigrateSourceInterface.php
index 3620e67..9216f82 100644
--- a/core/modules/migrate/src/Plugin/MigrateSourceInterface.php
+++ b/core/modules/migrate/src/Plugin/MigrateSourceInterface.php
@@ -28,29 +28,33 @@
    *   Available fields in the source, keys are the field machine names as used
    *   in field mappings, values are descriptions.
    */
   public function fields();
 
   /**
-   * Add additional data to the row.
+   * Adds additional data to the row.
    *
    * @param \Drupal\Migrate\Row $row
    *   The row object.
    *
    * @return bool
    *   FALSE if this row needs to be skipped.
    */
   public function prepareRow(Row $row);
 
+  /**
+   * Allows class to decide how it will react when it is treated like a string.
+   */
   public function __toString();
 
   /**
-   * Defines the source fields uniquely identifying a source row. None of these
-   * fields should contain a NULL value - if necessary, use prepareRow() or
-   * hook_migrate_prepare_row() to rewrite NULL values to appropriate empty
-   * values (such as '' or 0).
+   * Defines the source fields uniquely identifying a source row.
+   *
+   * None of these fields should contain a NULL value. If necessary, use
+   * prepareRow() or hook_migrate_prepare_row() to rewrite NULL values to
+   * appropriate empty values (such as '' or 0).
    *
    * @return array
    *   Array keyed by source field name, with values being a schema array
    *   describing the field (such as ['type' => 'string]).
    */
   public function getIds();
diff --git a/core/modules/migrate/src/Plugin/migrate/process/DedupeEntity.php b/core/modules/migrate/src/Plugin/migrate/process/DedupeEntity.php
index 58bcdf8..175e9c9 100644
--- a/core/modules/migrate/src/Plugin/migrate/process/DedupeEntity.php
+++ b/core/modules/migrate/src/Plugin/migrate/process/DedupeEntity.php
@@ -19,12 +19,14 @@
  *   id = "dedupe_entity"
  * )
  */
 class DedupeEntity extends DedupeBase implements ContainerFactoryPluginInterface {
 
   /**
+   * The entity query factory.
+   *
    * @var \Drupal\Core\Entity\Query\QueryFactoryInterface
    */
   protected $entityQueryFactory;
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/migrate/src/Plugin/migrate/process/DefaultValue.php b/core/modules/migrate/src/Plugin/migrate/process/DefaultValue.php
index 1725818..87f2b6f 100644
--- a/core/modules/migrate/src/Plugin/migrate/process/DefaultValue.php
+++ b/core/modules/migrate/src/Plugin/migrate/process/DefaultValue.php
@@ -8,13 +8,12 @@
 namespace Drupal\migrate\Plugin\migrate\process;
 
 use Drupal\migrate\ProcessPluginBase;
 use Drupal\migrate\MigrateExecutableInterface;
 use Drupal\migrate\Row;
 
-
 /**
  * This plugin sets missing values on the destination.
  *
  * @MigrateProcessPlugin(
  *   id = "default_value"
  * )
@@ -27,7 +26,8 @@ class DefaultValue extends ProcessPluginBase {
   public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
     if (!empty($this->configuration['strict'])) {
       return isset($value) ? $value : $this->configuration['default_value'];
     }
     return $value ?: $this->configuration['default_value'];
   }
+
 }
diff --git a/core/modules/migrate/src/Plugin/migrate/process/Flatten.php b/core/modules/migrate/src/Plugin/migrate/process/Flatten.php
index 52781a0..56b042a 100644
--- a/core/modules/migrate/src/Plugin/migrate/process/Flatten.php
+++ b/core/modules/migrate/src/Plugin/migrate/process/Flatten.php
@@ -31,7 +31,8 @@ class Flatten extends ProcessPluginBase {
    *
    * For example, array(array(1, 2, array(3, 4))) becomes array(1, 2, 3, 4).
    */
   public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
     return iterator_to_array(new \RecursiveIteratorIterator(new \RecursiveArrayIterator($value)), FALSE);
   }
+
 }
diff --git a/core/modules/migrate/src/Plugin/migrate/process/Get.php b/core/modules/migrate/src/Plugin/migrate/process/Get.php
index 07e4b04..5b720bc 100644
--- a/core/modules/migrate/src/Plugin/migrate/process/Get.php
+++ b/core/modules/migrate/src/Plugin/migrate/process/Get.php
@@ -18,12 +18,14 @@
  *   id = "get"
  * )
  */
 class Get extends ProcessPluginBase {
 
   /**
+   * Flag indicating whether there are multiple values.
+   *
    * @var bool
    */
   protected $multiple;
 
   /**
    * {@inheritdoc}
@@ -66,7 +68,8 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
   /**
    * {@inheritdoc}
    */
   public function multiple() {
     return $this->multiple;
   }
+
 }
diff --git a/core/modules/migrate/src/Plugin/migrate/process/Iterator.php b/core/modules/migrate/src/Plugin/migrate/process/Iterator.php
index 7706a5e..906513c 100644
--- a/core/modules/migrate/src/Plugin/migrate/process/Iterator.php
+++ b/core/modules/migrate/src/Plugin/migrate/process/Iterator.php
@@ -62,7 +62,8 @@ protected function transformKey($key, MigrateExecutableInterface $migrate_execut
   /**
    * {@inheritdoc}
    */
   public function multiple() {
     return TRUE;
   }
+
 }
diff --git a/core/modules/migrate/src/Plugin/migrate/process/MachineName.php b/core/modules/migrate/src/Plugin/migrate/process/MachineName.php
index e3963e5..8f08dd6 100644
--- a/core/modules/migrate/src/Plugin/migrate/process/MachineName.php
+++ b/core/modules/migrate/src/Plugin/migrate/process/MachineName.php
@@ -26,27 +26,29 @@
  *   id = "machine_name"
  * )
  */
 class MachineName extends ProcessPluginBase implements ContainerFactoryPluginInterface {
 
   /**
+   * The transliteration service.
+   *
    * @var \Drupal\Component\Transliteration\TransliterationInterface
    */
   protected $transliteration;
 
   /**
    * Constructs a MachineName plugin.
    *
    * @param array $configuration
-   *  The plugin configuration.
+   *   The plugin configuration.
    * @param string $plugin_id
-   *  The plugin ID.
+   *   The plugin ID.
    * @param mixed $plugin_definition
-   *  The plugin definition.
+   *   The plugin definition.
    * @param \Drupal\Component\Transliteration\TransliterationInterface $transliteration
-   *  The transliteration service.
+   *   The transliteration service.
    */
   public function __construct(array $configuration, $plugin_id, $plugin_definition, TransliterationInterface $transliteration) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->transliteration = $transliteration;
   }
 
diff --git a/core/modules/migrate/src/Plugin/migrate/process/Migration.php b/core/modules/migrate/src/Plugin/migrate/process/Migration.php
index 233ad1e..5fc8b42 100644
--- a/core/modules/migrate/src/Plugin/migrate/process/Migration.php
+++ b/core/modules/migrate/src/Plugin/migrate/process/Migration.php
@@ -2,13 +2,12 @@
 
 /**
  * @file
  * Contains \Drupal\migrate\Plugin\migrate\process\Migration.
  */
 
-
 namespace Drupal\migrate\Plugin\migrate\process;
 
 use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\migrate\MigrateSkipProcessException;
 use Drupal\migrate\Plugin\MigratePluginManager;
@@ -25,17 +24,21 @@
  *   id = "migration"
  * )
  */
 class Migration extends ProcessPluginBase implements ContainerFactoryPluginInterface {
 
   /**
+   * The process plugin manager.
+   *
    * @var \Drupal\migrate\Plugin\MigratePluginManager
    */
   protected $processPluginManager;
 
   /**
+   * The entity storage manager.
+   *
    * @var \Drupal\Core\Entity\EntityStorageInterface
    */
   protected $migrationStorage;
 
   /**
    * {@inheritdoc}
@@ -145,13 +148,13 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
         return $destination_ids;
       }
     }
   }
 
   /**
-   * Skip the migration process entirely if the value is FALSE.
+   * Skips the migration process entirely if the value is FALSE.
    *
    * @param mixed $value
    *   The incoming value to transform.
    *
    * @throws \Drupal\migrate\MigrateSkipProcessException
    */
diff --git a/core/modules/migrate/src/Plugin/migrate/process/Route.php b/core/modules/migrate/src/Plugin/migrate/process/Route.php
index 7b83f21..6fd6722 100644
--- a/core/modules/migrate/src/Plugin/migrate/process/Route.php
+++ b/core/modules/migrate/src/Plugin/migrate/process/Route.php
@@ -1,7 +1,8 @@
 <?php
+
 /**
  * @file
  * Contains \Drupal\migrate\Plugin\migrate\process\Route.
  */
 
 namespace Drupal\migrate\Plugin\migrate\process;
@@ -19,23 +20,25 @@
  *   id = "route"
  * )
  */
 class Route extends ProcessPluginBase implements ContainerFactoryPluginInterface {
 
   /**
+   * The path validator service.
+   *
    * @var \Drupal\Core\Path\PathValidatorInterface
    */
   protected $pathValidator;
 
   /**
    * {@inheritdoc}
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, PathValidatorInterface $pathValidator) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, PathValidatorInterface $path_validator) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->migration = $migration;
-    $this->pathValidator = $pathValidator;
+    $this->pathValidator = $path_validator;
   }
 
   /**
    * {@inheritdoc}
    */
   public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
@@ -57,13 +60,13 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
     list($link_path, $options) = $value;
     $extracted = $this->pathValidator->getUrlIfValidWithoutAccessCheck($link_path);
     $route = array();
 
     if ($extracted) {
       if ($extracted->isExternal()) {
-        $route['route_name'] = null;
+        $route['route_name'] = NULL;
         $route['route_parameters'] = array();
         $route['options'] = $options;
         $route['url'] = $extracted->getUri();
       }
       else {
         $route['route_name'] = $extracted->getRouteName();
@@ -80,15 +83,14 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
             $old_query = $options['query'];
           }
           $options['query'] = $route['options']['query'] + $old_query;
           unset($route['options']['query']);
         }
         $route['options'] = $route['options'] + $options;
-        $route['url'] = null;
+        $route['url'] = NULL;
       }
     }
 
     return $route;
   }
 
 }
-
diff --git a/core/modules/migrate/src/Plugin/migrate/source/DummyQueryTrait.php b/core/modules/migrate/src/Plugin/migrate/source/DummyQueryTrait.php
index 91daf29..523c48e 100644
--- a/core/modules/migrate/src/Plugin/migrate/source/DummyQueryTrait.php
+++ b/core/modules/migrate/src/Plugin/migrate/source/DummyQueryTrait.php
@@ -5,24 +5,27 @@
  * Contains \Drupal\migrate\Plugin\migrate\source\DummyQueryTrait.
  */
 
 namespace Drupal\migrate\Plugin\migrate\source;
 
 /**
+ * Provides a dummy select query object for source plugins.
+ *
  * Trait providing a dummy select query object for source plugins based on
  * SqlBase which override initializeIterator() to obtain their data from other
  * SqlBase services instead of a direct query. This ensures that query() returns
- * a valid object, even though it isn't used for iteration.
+ * a valid object, even though it is not used for iteration.
  */
 trait DummyQueryTrait {
 
   /**
    * {@inheritdoc}
    */
   public function query() {
-    // Pass an arbritrary table name - the query should never be executed anyway.
+    // Pass an arbritrary table name - the query should never be executed
+    // anyway.
     $query = $this->select(uniqid(), 's')
       ->range(0, 1);
     $query->addExpression('1');
     return $query;
   }
 
diff --git a/core/modules/migrate/src/Plugin/migrate/source/EmptySource.php b/core/modules/migrate/src/Plugin/migrate/source/EmptySource.php
index 0a93cb3..93cf726 100644
--- a/core/modules/migrate/src/Plugin/migrate/source/EmptySource.php
+++ b/core/modules/migrate/src/Plugin/migrate/source/EmptySource.php
@@ -31,12 +31,15 @@ public function fields() {
    * {@inheritdoc}
    */
   public function initializeIterator() {
     return new \ArrayIterator(array(array('id' => '')));
   }
 
+  /**
+   * Allows class to decide how it will react when it is treated like a string.
+   */
   public function __toString() {
     return '';
   }
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php b/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php
index a222eee..fc63bb8 100644
--- a/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php
+++ b/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php
@@ -25,17 +25,21 @@
  *
  * @ingroup migration
  */
 abstract class SourcePluginBase extends PluginBase implements MigrateSourceInterface {
 
   /**
+   * The module handler service.
+   *
    * @var \Drupal\Core\Extension\ModuleHandlerInterface
    */
   protected $moduleHandler;
 
   /**
+   * The entity migration object.
+   *
    * @var \Drupal\migrate\Entity\MigrationInterface
    */
   protected $migration;
 
   /**
    * The name and type of the highwater property in the source.
@@ -44,20 +48,20 @@
    *
    * @see $originalHighwater
    */
   protected $highWaterProperty;
 
   /**
-   * The current row from the query
+   * The current row from the query.
    *
    * @var \Drupal\Migrate\Row
    */
   protected $currentRow;
 
   /**
-   * The primary key of the current row
+   * The primary key of the current row.
    *
    * @var array
    */
   protected $currentSourceIds;
 
   /**
@@ -89,40 +93,50 @@
    *
    * @var bool
    */
   protected $skipCount = FALSE;
 
   /**
+   * Flags whether to track changes to incloming data.
+   *
    * If TRUE, we will maintain hashed source rows to determine whether incoming
    * data has changed.
    *
    * @var bool
    */
   protected $trackChanges = FALSE;
 
   /**
+   * Flags whether source plugin will read the map row and add to data row.
+   *
    * By default, next() will directly read the map row and add it to the data
    * row. A source plugin implementation may do this itself (in particular, the
    * SQL source can incorporate the map table into the query) - if so, it should
    * set this TRUE so we don't duplicate the effort.
    *
    * @var bool
    */
   protected $mapRowAdded = FALSE;
 
   /**
+   * The backend cache.
+   *
    * @var \Drupal\Core\Cache\CacheBackendInterface
    */
   protected $cache;
 
   /**
+   * The migration ID map.
+   *
    * @var \Drupal\migrate\Plugin\MigrateIdMapInterface
    */
   protected $idMap;
 
   /**
+   * The iterator to iterate over the source rows.
+   *
    * @var \Iterator
    */
   protected $iterator;
 
   /**
    * {@inheritdoc}
@@ -147,21 +161,21 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
     if ($this->highWaterProperty && $this->trackChanges) {
       throw new MigrateException('You should either use a highwater mark or track changes not both. They are both designed to solve the same problem');
     }
   }
 
   /**
-   * Initialize the iterator with the source data.
+   * Initializes the iterator with the source data.
    *
    * @return array
    *   An array of the data for this source.
    */
   protected abstract function initializeIterator();
 
   /**
-   * Get the module handler.
+   * Gets the module handler.
    *
    * @return \Drupal\Core\Extension\ModuleHandlerInterface
    *   The module handler.
    */
   protected function getModuleHandler() {
     if (!isset($this->moduleHandler)) {
@@ -209,12 +223,13 @@ public function prepareRow(Row $row) {
   }
 
   /**
    * Returns the iterator that will yield the row arrays to be processed.
    *
    * @return \Iterator
+   *   The iterator that will yield the row arrays to be processed.
    */
   protected function getIterator() {
     if (!isset($this->iterator)) {
       $this->iterator = $this->initializeIterator();
     }
     return $this->iterator;
@@ -225,35 +240,35 @@ protected function getIterator() {
    */
   public function current() {
     return $this->currentRow;
   }
 
   /**
-   * Get the iterator key.
+   * Gets the iterator key.
    *
    * Implementation of Iterator::key - called when entering a loop iteration,
    * returning the key of the current row. It must be a scalar - we will
    * serialize to fulfill the requirement, but using getCurrentIds() is
    * preferable.
    */
   public function key() {
     return serialize($this->currentSourceIds);
   }
 
   /**
-   * Whether the iterator is currently valid.
+   * Checks whether the iterator is currently valid.
    *
    * Implementation of Iterator::valid() - called at the top of the loop,
-   * returning TRUE to process the loop and FALSE to terminate it
+   * returning TRUE to process the loop and FALSE to terminate it.
    */
   public function valid() {
     return isset($this->currentRow);
   }
 
   /**
-   * Rewind the iterator.
+   * Rewinds the iterator.
    *
    * Implementation of Iterator::rewind() - subclasses of MigrateSource should
    * implement performRewind() to do any class-specific setup for iterating
    * source records.
    */
   public function rewind() {
@@ -308,59 +323,59 @@ public function next() {
 
       // Check whether the row needs processing.
       // 1. This row has not been imported yet.
       // 2. Explicitly set to update.
       // 3. The row is newer than the current highwater mark.
       // 4. If no such property exists then try by checking the hash of the row.
-      if (!$row->getIdMap() || $row->needsUpdate() || $this->aboveHighwater($row) || $this->rowChanged($row) ) {
+      if (!$row->getIdMap() || $row->needsUpdate() || $this->aboveHighwater($row) || $this->rowChanged($row)) {
         $this->currentRow = $row->freezeSource();
       }
     }
   }
 
   /**
-   * Check if the incoming data is newer than what we've previously imported.
+   * Checks if the incoming data is newer than what we've previously imported.
    *
    * @param \Drupal\migrate\Row $row
    *   The row we're importing.
    *
    * @return bool
    *   TRUE if the highwater value in the row is greater than our current value.
    */
   protected function aboveHighwater(Row $row) {
     return $this->highWaterProperty && $row->getSourceProperty($this->highWaterProperty['name']) > $this->originalHighWater;
   }
 
   /**
-   * Check if the incoming row has changed since our last import.
+   * Checks if the incoming row has changed since our last import.
    *
    * @param \Drupal\migrate\Row $row
    *   The row we're importing.
    *
    * @return bool
    *   TRUE if the row has changed otherwise FALSE.
    */
   protected function rowChanged(Row $row) {
     return $this->trackChanges && $row->changed();
   }
 
   /**
-   * Getter for currentSourceIds data member.
+   * Gets the currentSourceIds data member.
    */
   public function getCurrentIds() {
     return $this->currentSourceIds;
   }
 
   /**
-   * Get the source count.
+   * Gets the source count.
    *
    * Return a count of available source records, from the cache if appropriate.
    * Returns -1 if the source is not countable.
    *
    * @param bool $refresh
-   *   Whether or not to refresh the count.
+   *   (optional) Whether or not to refresh the count. Defaults to FALSE.
    *
    * @return int
    *   The count.
    */
   public function count($refresh = FALSE) {
     if ($this->skipCount) {
@@ -392,13 +407,13 @@ public function count($refresh = FALSE) {
       }
     }
     return $count;
   }
 
   /**
-   * Get the cache object.
+   * Gets the cache object.
    *
    * @return \Drupal\Core\Cache\CacheBackendInterface
    *   The cache object.
    */
   protected function getCache() {
     if (!isset($this->cache)) {
diff --git a/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php b/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php
index 343e723..b29e736 100644
--- a/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php
+++ b/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php
@@ -24,17 +24,21 @@
  * is present, it is used as a database connection information array to define
  * the connection.
  */
 abstract class SqlBase extends SourcePluginBase implements ContainerFactoryPluginInterface {
 
   /**
+   * The query string.
+   *
    * @var \Drupal\Core\Database\Query\SelectInterface
    */
   protected $query;
 
   /**
+   * The database object.
+   *
    * @var \Drupal\Core\Database\Connection
    */
   protected $database;
 
   /**
    * State service for retrieving database info.
@@ -62,23 +66,23 @@ public static function create(ContainerInterface $container, array $configuratio
       $migration,
       $container->get('state')
     );
   }
 
   /**
-   * Print the query string when the object is used a string.
+   * Prints the query string when the object is used as a string.
    *
    * @return string
    *   The query string.
    */
   public function __toString() {
     return (string) $this->query;
   }
 
   /**
-   * Get the database connection object.
+   * Gets the database connection object.
    *
    * @return \Drupal\Core\Database\Connection
    *   The database connection.
    */
   public function getDatabase() {
     if (!isset($this->database)) {
@@ -92,14 +96,15 @@ public function getDatabase() {
       }
     }
     return $this->database;
   }
 
   /**
-   * Get a connection to the referenced database, adding the connection if
-   * necessary.
+   * Gets a connection to the referenced database.
+   *
+   * This method will add the database connection if necessary.
    *
    * @param array $database_info
    *   Configuration for the source database connection. The keys are:
    *    'key' - The database connection key.
    *    'target' - The database connection target.
    *    'database' - Database configuration array as accepted by
@@ -133,13 +138,13 @@ protected function setUpDatabase(array $database_info) {
   protected function select($table, $alias = NULL, array $options = array()) {
     $options['fetch'] = \PDO::FETCH_ASSOC;
     return $this->getDatabase()->select($table, $alias, $options);
   }
 
   /**
-   * A helper for adding tags and metadata to the query.
+   * Adds tags and metadata to the query.
    *
    * @return \Drupal\Core\Database\Query\SelectInterface
    *   The query with additional tags and metadata.
    */
   protected function prepareQuery() {
     $this->query = clone $this->query();
@@ -161,14 +166,13 @@ protected function initializeIterator() {
     $high_water_property = $this->migration->get('highWaterProperty');
 
     // Get the key values, for potential use in joining to the map table.
     $keys = array();
 
     // The rules for determining what conditions to add to the query are as
-    // follows (applying first applicable rule)
-
+    // follows (applying first applicable rule):
     // 1. If the map is joinable, join it. We will want to accept all rows
     //    which are either not in the map, or marked in the map as NEEDS_UPDATE.
     //    Note that if high water fields are in play, we want to accept all rows
     //    above the high water mark in addition to those selected by the map
     //    conditions, so we need to OR them together (but AND with any existing
     //    conditions in the query). So, ultimately the SQL condition will look
@@ -238,13 +242,13 @@ protected function initializeIterator() {
    */
   public function count() {
     return $this->query()->countQuery()->execute()->fetchField();
   }
 
   /**
-   * Check if we can join against the map table.
+   * Checks if we can join against the map table.
    *
    * This function specifically catches issues when we're migrating with
    * unique sets of credentials for the source and destination database.
    *
    * @return bool
    *   TRUE if we can join against the map table otherwise FALSE.
