diff --git a/core/includes/entity.inc b/core/includes/entity.inc
index c2c16af..9dfb21c 100644
--- a/core/includes/entity.inc
+++ b/core/includes/entity.inc
@@ -549,8 +549,6 @@ function entity_view_multiple(array $entities, $view_mode, $langcode = NULL) {
  * @param $conjunction
  *   AND if all conditions in the query need to apply, OR if any of them is
  *   enough. Optional, defaults to AND.
- *
- * @return Drupal\Core\Entity\Query\QueryInterface
  */
 function entity_query($entity_type, $conjunction = 'AND') {
   return drupal_container()->get('entity.query')->get($entity_type, $conjunction);
diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php
index 8141bbf..2538e8e 100644
--- a/core/lib/Drupal/Core/Entity/Entity.php
+++ b/core/lib/Drupal/Core/Entity/Entity.php
@@ -276,8 +276,8 @@ public function getTranslation($langcode, $strict = TRUE) {
    * Returns the languages the entity is translated to.
    *
    * @todo: Remove once all entity types implement the entity field API.
-   * This is deprecated by
-   * Drupal\Core\TypedData\TranslatableInterface::getTranslationLanguages().
+   *   This is deprecated by
+   *   Drupal\Core\TypedData\TranslatableInterface::getTranslationLanguages().
    */
   public function translations() {
     return $this->getTranslationLanguages(FALSE);
diff --git a/core/lib/Drupal/Core/Entity/EntityFormController.php b/core/lib/Drupal/Core/Entity/EntityFormController.php
index a6507a1..2e9daac 100644
--- a/core/lib/Drupal/Core/Entity/EntityFormController.php
+++ b/core/lib/Drupal/Core/Entity/EntityFormController.php
@@ -243,6 +243,11 @@ public function isDefaultFormLangcode($form_state) {
 
   /**
    * Handle possible entity language changes.
+   *
+   * @param array $form
+   *   An associative array containing the structure of the form.
+   * @param array $form_state
+   *   A reference to a keyed array containing the current state of the form.
    */
   protected function submitEntityLanguage(array $form, array &$form_state) {
     // Update the form language as it might have changed.
diff --git a/core/lib/Drupal/Core/Entity/EntityFormControllerInterface.php b/core/lib/Drupal/Core/Entity/EntityFormControllerInterface.php
index 2238fc3..fecb078 100644
--- a/core/lib/Drupal/Core/Entity/EntityFormControllerInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityFormControllerInterface.php
@@ -46,6 +46,9 @@ public function getFormLangcode(array $form_state);
   /**
    * Checks whether the current form language matches the entity one.
    *
+   * @param array $form_state
+   *   A reference to a keyed array containing the current state of the form.
+   *
    * @return boolean
    *   Returns TRUE if the entity form language matches the entity one.
    */
diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index 3279ca6..f8a9e30 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -1127,12 +1127,12 @@ function comment_form_node_type_form_alter(&$form, $form_state) {
 
 /**
  * Comment translation settings submit handler.
- *
- * The comment translation settings form element is embedded into the node type
- * form. Hence we need to provide to the regular submit handler a manipulated
- * form state to make it process comment settings instead of node settings.
  */
 function comment_translation_configuration_element_submit($form, &$form_state) {
+  // The comment translation settings form element is embedded into the node
+  // type form. Hence we need to provide to the regular submit handler a
+  // manipulated form state to make it process comment settings instead of node
+  // settings.
   $key = 'language_configuration';
   $comment_form_state = array(
     'translation_entity' => array('key' => $key),
diff --git a/core/modules/field/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/Query.php b/core/modules/field/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/Query.php
index 44023ce..0abb5d9 100644
--- a/core/modules/field/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/Query.php
+++ b/core/modules/field/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/Query.php
@@ -69,7 +69,6 @@ public function execute() {
     $entity_tables[$base_table] = drupal_get_schema($base_table);
     $sqlQuery = $this->connection->select($base_table, 'base_table', array('conjunction' => $this->conjunction));
     $sqlQuery->addMetaData('configurable_fields', $configurable_fields);
-    $sqlQuery->addMetaData('entity_type', $entity_type);
     // Determines the key of the column to join on. This is either the entity
     // id key or the revision id key, depending on whether the entity type
     // supports revisions.
diff --git a/core/modules/field/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/Tables.php b/core/modules/field/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/Tables.php
index ca0d7cc..068b26c 100644
--- a/core/modules/field/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/Tables.php
+++ b/core/modules/field/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/Tables.php
@@ -129,7 +129,6 @@ protected function ensureFieldTable(&$field_name, $type, $langcode) {
       if ($field['cardinality'] != 1) {
         $this->sqlQuery->addMetaData('simple_query', FALSE);
       }
-      $this->sqlQuery->condition("$table.entity_type", $this->sqlQuery->getMetaData('entity_type'));
       $this->fieldTables[$field_name] = $this->addJoin($type, $table, "%alias.$field_id_field = base_table.$entity_id_field", $langcode);
     }
     return $this->fieldTables[$field_name];
diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationController.php b/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationController.php
index f6d81e6..ddf6589 100644
--- a/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationController.php
+++ b/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationController.php
@@ -376,6 +376,9 @@ function entityFormDeleteTranslation($form, &$form_state) {
 
   /**
    * Returns the title to be used for the entity form page.
+   *
+   * @param Drupal\Core\Entity\EntityInterface $entity
+   *   The entity whose form is being altered.
    */
   protected function entityFormTitle(EntityInterface $entity) {
     return $entity->label();
@@ -387,7 +390,7 @@ protected function entityFormTitle(EntityInterface $entity) {
    * @param $path
    *   An internal path containing the entity id wildcard.
    *
-   * @return
+   * @return string
    *   The instantiated path.
    */
   protected function getPathInstance($path, $entity_id) {
diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationControllerInterface.php b/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationControllerInterface.php
index 95b43bb..7a37a2a 100644
--- a/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationControllerInterface.php
+++ b/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationControllerInterface.php
@@ -106,7 +106,6 @@ public function getEditPath(EntityInterface $entity);
    * @param Drupal\Core\Entity\EntityInterface $entity
    *   The entity to the path should refer to.
    *
-   *
    * @return string
    *   The entity view path.
    */
diff --git a/core/modules/translation_entity/translation_entity.admin.inc b/core/modules/translation_entity/translation_entity.admin.inc
index c87a496..b4213e4 100644
--- a/core/modules/translation_entity/translation_entity.admin.inc
+++ b/core/modules/translation_entity/translation_entity.admin.inc
@@ -8,7 +8,7 @@
 /**
  * Returns the confirmation form for changing field translatability.
  */
-function translation_entity_translatable_form($form, &$form_state, $field_name) {
+function translation_entity_translatable_form(array $form, array &$form_state, $field_name) {
   $field = field_info_field($field_name);
   $t_args = array('%name' => $field_name);
 
@@ -46,7 +46,7 @@ function translation_entity_translatable_form($form, &$form_state, $field_name)
  * untranslatable will cause all of its translations to be permanently removed,
  * with the exception of the one corresponding to the entity language.
  */
-function translation_entity_translatable_form_submit($form, $form_state) {
+function translation_entity_translatable_form_submit(array $form, array $form_state) {
   // This is the current state that we want to reverse.
   $translatable = $form_state['values']['translatable'];
   $field_name = $form_state['field']['field_name'];
@@ -102,7 +102,6 @@ function translation_entity_translatable_switch($translatable, $field_name) {
   field_update_field($field);
 }
 
-
 /**
  * Converts field data to or from LANGUAGE_NOT_SPECIFIED.
  */
@@ -132,11 +131,15 @@ function translation_entity_translatable_batch($translatable, $field_name, &$con
         ->exists($field_name)
         ->count()
         ->execute();
-      $context['sandbox']['max'] += $count;
+
       $context['sandbox']['progress_entity_type'][$entity_type] = 0;
       $context['sandbox']['max_entity_type'][$entity_type] = $count;
     }
 
+    // @todo Move this into the loop above as soon as entity query correctly
+    //   handles count queries on fields shared among different entities.
+    $context['sandbox']['max'] += $count;
+
     if ($context['sandbox']['max'] === 0) {
       // Nothing to do.
       $context['finished'] = 1;
diff --git a/core/modules/translation_entity/translation_entity.module b/core/modules/translation_entity/translation_entity.module
index eb71059..9ab9cab 100644
--- a/core/modules/translation_entity/translation_entity.module
+++ b/core/modules/translation_entity/translation_entity.module
@@ -47,7 +47,7 @@ function translation_entity_language_types_info_alter(array &$language_types) {
 /**
  * Implements hook_entity_info_alter().
  */
-function translation_entity_entity_info_alter(&$entity_info) {
+function translation_entity_entity_info_alter(array &$entity_info) {
   $edit_form_info = array();
 
   // Provide defaults for translation info.
@@ -167,7 +167,7 @@ function translation_entity_menu() {
 /**
  * Implements hook_menu_alter().
  */
-function translation_entity_menu_alter(&$items) {
+function translation_entity_menu_alter(array &$items) {
   // Some menu loaders in the item paths might have been altered: we need to
   // replace any menu loader with a plain % to check if base paths are still
   // compatible.
@@ -218,7 +218,10 @@ function translation_entity_menu_alter(&$items) {
 }
 
 /**
- * Access callback.
+ * Access callback for the translation overview page.
+ *
+ * @param Drupal\Core\Entity\EntityInterface $entity
+ *   The entity whose translation overview should be displayed.
  */
 function translation_entity_translate_access(EntityInterface $entity) {
   $entity_type = $entity->entityType();
@@ -226,7 +229,14 @@ function translation_entity_translate_access(EntityInterface $entity) {
 }
 
 /**
- * Access callback.
+ * Access callback for the translation addition page.
+ *
+ * @param Drupal\Core\Entity\EntityInterface $entity
+ *   The entity being translated.
+ * @param Drupal\Core\Language\Language $source
+ *   The language of the values being translated.
+ * @param Drupal\Core\Language\Language $target
+ *   The language of the translated values.
  */
 function translation_entity_add_access(EntityInterface $entity, Language $source = NULL, Language $target = NULL) {
   $source = !empty($source) ? $source : $entity->language();
@@ -243,9 +253,9 @@ function translation_entity_add_access(EntityInterface $entity, Language $source
  * configuration will have a common root name.
  *
  * @param string $entity_type
- *   The type of the entity the setting refer to.
+ *   The type of the entity the setting refers to.
  * @param string $bundle
- *   The bundle of the entity the setting refer to.
+ *   The bundle of the entity the setting refers to.
  * @param string $setting
  *   The name of the setting.
  *
@@ -405,7 +415,7 @@ function translation_entity_permission() {
 /**
  * Implements hook_form_alter().
  */
-function translation_entity_form_alter(&$form, &$form_state) {
+function translation_entity_form_alter(array &$form, array &$form_state) {
   if (($form_controller = translation_entity_form_controller($form_state)) && ($entity = $form_controller->getEntity($form_state)) && !$entity->isNew()) {
     $controller = translation_entity_controller($entity->entityType());
     $controller->entityFormAlter($form, $form_state, $entity);
@@ -476,7 +486,7 @@ function translation_entity_load_translation_data(array $entities, $entity_type)
     // @todo Declare these as entity (translation?) properties.
     $entity->source[$record->langcode] = $record->source;
     // @todo Rename to 'translate' when the column is removed from the node
-    // schema.
+    //   schema.
     $entity->retranslate[$record->langcode] = (boolean) $record->translate;
   }
 }
@@ -543,7 +553,7 @@ function translation_entity_field_extra_fields() {
 /**
  * Implements hook_form_FORM_ID_alter().
  */
-function translation_entity_form_field_ui_field_edit_form_alter(&$form, &$form_state, $form_id) {
+function translation_entity_form_field_ui_field_edit_form_alter(array &$form, array &$form_state, $form_id) {
   $field = $form['#field'];
   $field_name = $field['field_name'];
   $translatable = $field['translatable'];
@@ -597,8 +607,17 @@ function translation_entity_element_info_alter(&$type) {
  * configuration form element.
  *
  * @todo Remove once all core entities have language configuration.
+ *
+ * @param string $entity_type
+ *   The type of the entity being configured for translation.
+ * @param string $bundle
+ *   The bundle of the entity being configured for translation.
+ * @param array $form
+ *   The configuration form array.
+ * @param array $form_state
+ *   The configuration form state array.
  */
-function translation_entity_enable_widget($entity_type, $bundle, &$form, &$form_state) {
+function translation_entity_enable_widget($entity_type, $bundle, array &$form, array &$form_state) {
   $key = $form_state['translation_entity']['key'];
   if (!isset($form_state['language'][$key])) {
     $form_state['language'][$key] = array();
@@ -612,7 +631,7 @@ function translation_entity_enable_widget($entity_type, $bundle, &$form, &$form_
 /**
  * Process handler for the language_configuration form element.
  */
-function translation_entity_language_configuration_element_process($element, &$form_state, &$form) {
+function translation_entity_language_configuration_element_process($element, array &$form_state, array &$form) {
   $form_state['translation_entity']['key'] = $element['#name'];
   $context = $form_state['language'][$element['#name']];
 
@@ -630,12 +649,13 @@ function translation_entity_language_configuration_element_process($element, &$f
 }
 
 /**
- * Checks if translation can be enabled.
+ * Configuration element validation handler.
  *
- * If language is set to one of the special languages and language selector is
- * not hidden, translation cannot be enabled.
+ * Checks whether translation can be enabled: if language is set to one of the
+ * special languages and language selector is not hidden, translation cannot be
+ * enabled.
  */
-function translation_entity_language_configuration_element_validate($element, &$form_state, $form) {
+function translation_entity_language_configuration_element_validate($element, array &$form_state, array $form) {
   $key = $form_state['translation_entity']['key'];
   $values = $form_state['values'][$key];
   if (language_is_locked($values['langcode']) && $values['language_hidden'] && $values['translation_entity']) {
@@ -650,9 +670,11 @@ function translation_entity_language_configuration_element_validate($element, &$
 }
 
 /**
+ * Configuration form submit handler.
+ *
  * Stores the entity translation settings.
  */
-function translation_entity_language_configuration_element_submit($form, &$form_state) {
+function translation_entity_language_configuration_element_submit(array $form, array &$form_state) {
   $key = $form_state['translation_entity']['key'];
   $context = $form_state['language'][$key];
   $enabled = $form_state['values'][$key]['translation_entity'];
diff --git a/core/modules/translation_entity/translation_entity.pages.inc b/core/modules/translation_entity/translation_entity.pages.inc
index 899dd65..4d92f52 100644
--- a/core/modules/translation_entity/translation_entity.pages.inc
+++ b/core/modules/translation_entity/translation_entity.pages.inc
@@ -8,10 +8,12 @@
 use Drupal\Core\Language\Language;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityNG;
-use Drupal\translation_entity\EntityTranslationController;
 
 /**
  * Translations overview page callback.
+ *
+ * @param Drupal\Core\Entity\EntityInterface $entity
+ *   The entity whose translation overview should be displayed.
  */
 function translation_entity_overview(EntityInterface $entity) {
   $controller = translation_entity_controller($entity->entityType());
@@ -143,6 +145,12 @@ function translation_entity_overview(EntityInterface $entity) {
 
 /**
  * Returns the localized links for the given path.
+ *
+ * @param string $path
+ *   The path for which language switch links should be provided.
+ *
+ * @returns
+ *   A renderable array of language switch links.
  */
 function _translation_entity_get_switch_links($path) {
   $links = language_negotiation_get_switch_links(LANGUAGE_TYPE_CONTENT, $path);
@@ -156,7 +164,19 @@ function _translation_entity_get_switch_links($path) {
 }
 
 /**
- * Page callback.
+ * Page callback for the translation addition page.
+ *
+ * @param EntityInterface $entity
+ *   The entity being translated.
+ * @param Language $source
+ *   (optional) The language of the values being translated. Defaults to the
+ *   entity language.
+ * @param Language $target
+ *   (optional) The language of the translated values. Defaults to the current
+ *   content language.
+ *
+ * @return array
+ *   A processed form array ready to be rendered.
  */
 function translation_entity_add_page(EntityInterface $entity, Language $source = NULL, Language $target = NULL) {
   $source = !empty($source) ? $source : $entity->language();
@@ -216,7 +236,7 @@ function translation_entity_prepare_translation(EntityInterface $entity, Languag
 }
 
 /**
- * Translation deletion confirmation form.
+ * Form builder for the translation deletion confirmation.
  */
 function translation_entity_delete_confirm(array $form, array $form_state, EntityInterface $entity, Language $language) {
   $langcode = $language->langcode;
@@ -235,7 +255,7 @@ function translation_entity_delete_confirm(array $form, array $form_state, Entit
 /**
  * Submit handler for the translation deletion confirmation.
  */
-function translation_entity_delete_confirm_submit($form, &$form_state) {
+function translation_entity_delete_confirm_submit(array $form, array &$form_state) {
   list($entity, $language) = $form_state['build_info']['args'];
   $controller = translation_entity_controller($entity->entityType());
 
