diff -u b/core/modules/field/field.api.php b/core/modules/field/field.api.php --- b/core/modules/field/field.api.php +++ b/core/modules/field/field.api.php @@ -803,9 +803,9 @@ * of the hook involves reading from the database, it is highly recommended to * statically cache the information. * - * @param $widget_properties + * @param array $widget_properties * The instance's widget properties. - * @param $context + * @param array $context * An associative array containing: * - entity_type: The entity type; e.g., 'node' or 'user'. * - bundle: The bundle: e.g., 'page' or 'article'. @@ -814,7 +814,7 @@ * * @see hook_field_widget_properties_ENTITY_TYPE_alter() */ -function hook_field_widget_properties_alter(&$widget_properties, $context) { +function hook_field_widget_properties_alter(array &$widget_properties, array $context) { // Change a widget's type according to the time of day. $field = $context['field']; if ($context['entity_type'] == 'node' && $field['field_name'] == 'field_foo') { @@ -2202,9 +2202,9 @@ * of the hook involves reading from the database, it is highly recommended to * statically cache the information. * - * @param $widget_properties + * @param array $widget_properties * The instance's widget properties. - * @param $context + * @param array $context * An associative array containing: * - entity_type: The entity type; e.g., 'node' or 'user'. * - bundle: The bundle: e.g., 'page' or 'article'. @@ -2213,7 +2213,7 @@ * * @see hook_field_widget_properties_alter() */ -function hook_field_widget_properties_ENTITY_TYPE_alter(&$widget_properties, $context) { +function hook_field_widget_properties_ENTITY_TYPE_alter(array &$widget_properties, array $context) { // Change a widget's type according to the time of day. $field = $context['field']; if ($field['field_name'] == 'field_foo') { diff -u b/core/modules/field/field.attach.inc b/core/modules/field/field.attach.inc --- b/core/modules/field/field.attach.inc +++ b/core/modules/field/field.attach.inc @@ -126,21 +126,21 @@ * A parameter for the invoked method. Defaults to NULL. * @param array $options * An associative array of additional options, with the following keys: - * - field_name: The name of the field whose operation should be invoked. By - * default, the operation is invoked on all the fields in the entity's - * bundle. NOTE: This option is not compatible with the 'deleted' option; - * the 'field_id' option should be used instead. - * - field_id: The id of the field whose operation should be invoked. By - * default, the operation is invoked on all the fields in the entity's' - * bundles. - * - deleted: If TRUE, the function will operate on deleted fields as well - * as non-deleted fields. If unset or FALSE, only non-deleted fields are - * operated on. - * - langcode: A language code or an array of language codes keyed by field - * name. It will be used to narrow down to a single value the available - * languages to act on. + * - field_name: The name of the field whose operation should be invoked. By + * default, the operation is invoked on all the fields in the entity's + * bundle. NOTE: This option is not compatible with the 'deleted' option; + * the 'field_id' option should be used instead. + * - field_id: The id of the field whose operation should be invoked. By + * default, the operation is invoked on all the fields in the entity's' + * bundles. + * - deleted: If TRUE, the function will operate on deleted fields as well + * as non-deleted fields. If unset or FALSE, only non-deleted fields are + * operated on. + * - langcode: A language code or an array of language codes keyed by field + * name. It will be used to narrow down to a single value the available + * languages to act on. */ -function field_invoke_method($method, \Closure $target_closure, EntityInterface $entity, &$a = NULL, &$b = NULL, $options = array()) { +function field_invoke_method($method, \Closure $target_closure, EntityInterface $entity, &$a = NULL, &$b = NULL, array $options = array()) { // Merge default options. $default_options = array( 'deleted' => FALSE, diff -u b/core/modules/field/lib/Drupal/field/FieldInstance.php b/core/modules/field/lib/Drupal/field/FieldInstance.php --- b/core/modules/field/lib/Drupal/field/FieldInstance.php +++ b/core/modules/field/lib/Drupal/field/FieldInstance.php @@ -19,7 +19,13 @@ */ protected $widget; - public function __construct($definition) { + /** + * Constructs a FieldInstance object. + * + * @param array $definition + * The instance definition array, as read from configuration storage. + */ + public function __construct(array $definition) { $this->definition = $definition; } diff -u b/core/modules/field/lib/Drupal/field/Plugin/Type/LegacyDiscoveryDecorator.php b/core/modules/field/lib/Drupal/field/Plugin/Type/LegacyDiscoveryDecorator.php --- b/core/modules/field/lib/Drupal/field/Plugin/Type/LegacyDiscoveryDecorator.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/LegacyDiscoveryDecorator.php @@ -74,2 +74,3 @@ } + } diff -u b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php --- b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php @@ -45,7 +45,22 @@ */ protected $weight; - public function __construct($plugin_id, DiscoveryInterface $discovery, $instance, array $settings, $weight) { + /** + * Constructs a WidgetBase object. + * + * @param array $plugin_id + * The plugin_id for the widget.. + * @param Drupal\Component\Plugin\Discovery\DiscoveryInterface $discovery + * The Discovery class that holds access to the widget implementation + * definition. + * @param Drupal\field\FieldInstance $instance + * The field instance to which the widget is associated. + * @param array $settings + * The widget's settings. + * @param int $weight + * The widget's weight. + */ + public function __construct($plugin_id, DiscoveryInterface $discovery, FieldInstance $instance, array $settings, $weight) { parent::__construct(array(), $plugin_id, $discovery); $this->instance = $instance; @@ -430,2 +445,3 @@ } + } diff -u b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetInterface.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetInterface.php --- b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetInterface.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetInterface.php @@ -135,7 +135,7 @@ * @param array $form_state * An associative array containing the current state of the form. * - * @return + * @return array * The element on which the error should be flagged. */ public function errorElement(array $element, array $error, array $form, array &$form_state); diff -u b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php --- b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php @@ -26,6 +26,9 @@ protected $cache_key = 'field_widget_types'; protected $hook = 'field_widget_info'; + /** + * Constructs a WidgetPluginManager object. + */ public function __construct() { $this->baseDiscovery = new LegacyDiscoveryDecorator(new AnnotatedClassDiscovery('field', 'widget')); $this->discovery = new CacheDecorator($this->baseDiscovery, $this->cache_key, $this->cache_bin); diff -u b/core/modules/field/modules/number/lib/Drupal/number/Plugin/field/widget/NumberWidget.php b/core/modules/field/modules/number/lib/Drupal/number/Plugin/field/widget/NumberWidget.php --- b/core/modules/field/modules/number/lib/Drupal/number/Plugin/field/widget/NumberWidget.php +++ b/core/modules/field/modules/number/lib/Drupal/number/Plugin/field/widget/NumberWidget.php @@ -81,2 +81,3 @@ } + }