Commit 89773d1a authored by webchick's avatar webchick

Issue #2092265 by andypost, Xano, amateescu: Fix type-hinting for FieldInfo methods.

parent c3924101
......@@ -71,7 +71,7 @@ class FieldInfo {
/**
* List of $field structures keyed by ID. Includes deleted fields.
*
* @var array
* @var \Drupal\field\FieldInterface[]
*/
protected $fieldsById = array();
......@@ -166,7 +166,7 @@ public function flush() {
/**
* Collects a lightweight map of fields across bundles.
*
* @return
* @return array
* An array keyed by entity type. Each value is an array which keys are
* field names and value is an array with two entries:
* - type: The field type.
......@@ -218,8 +218,8 @@ public function getFieldMap() {
/**
* Returns all active fields, including deleted ones.
*
* @return
* An array of field definitions, keyed by field ID.
* @return \Drupal\field\FieldInterface[]
* An array of field entities, keyed by field ID.
*/
public function getFields() {
// Read from the "static" cache.
......@@ -256,10 +256,10 @@ public function getFields() {
/**
* Retrieves all active, non-deleted instances definitions.
*
* @param $entity_type
* @param string $entity_type
* (optional) The entity type.
*
* @return
* @return array
* If $entity_type is not set, all instances keyed by entity type and bundle
* name. If $entity_type is set, all instances for that entity type, keyed
* by bundle name.
......@@ -309,7 +309,7 @@ public function getInstances($entity_type = NULL) {
* @param string $field_name
* The field name.
*
* @return
* @return \Drupal\field\FieldInterface|null
* The field definition, or NULL if no field was found.
*/
public function getField($entity_type, $field_name) {
......@@ -340,15 +340,15 @@ public function getField($entity_type, $field_name) {
}
/**
* Returns a field definition from a field ID.
* Returns a field entity from a field ID.
*
* This method only retrieves active fields, deleted or not.
*
* @param $field_id
* @param string $field_id
* The field ID.
*
* @return
* The field definition, or NULL if no field was found.
* @return \Drupal\field\FieldInterface|null
* The field entity, or NULL if no field was found.
*/
public function getFieldById($field_id) {
// Read from the "static" cache.
......@@ -386,13 +386,13 @@ public function getFieldById($field_id) {
* The function also populates the corresponding field definitions in the
* "static" cache.
*
* @param $entity_type
* @param string $entity_type
* The entity type.
* @param $bundle
* @param string $bundle
* The bundle name.
*
* @return
* The array of instance definitions, keyed by field name.
* @return \Drupal\field\FieldInstanceInterface[]
* An array of field instance entities, keyed by field name.
*/
public function getBundleInstances($entity_type, $bundle) {
// Read from the "static" cache.
......@@ -496,7 +496,7 @@ public function getBundleInstances($entity_type, $bundle) {
}
/**
* Returns an array of instance data for a specific field and bundle.
* Returns a field instance.
*
* @param string $entity_type
* The entity type for the instance.
......@@ -505,9 +505,8 @@ public function getBundleInstances($entity_type, $bundle) {
* @param string $field_name
* The field name for the instance.
*
* @return array
* An associative array of instance data for the specific field and bundle;
* NULL if the instance does not exist.
* @return \Drupal\field\FieldInstanceInterface|null
* The field instance entity, or NULL if it does not exist.
*/
function getInstance($entity_type, $bundle, $field_name) {
$info = $this->getBundleInstances($entity_type, $bundle);
......@@ -519,12 +518,12 @@ function getInstance($entity_type, $bundle, $field_name) {
/**
* Retrieves the "extra fields" for a bundle.
*
* @param $entity_type
* @param string $entity_type
* The entity type.
* @param $bundle
* @param string $bundle
* The bundle name.
*
* @return
* @return array
* The array of extra fields.
*/
public function getBundleExtraFields($entity_type, $bundle) {
......@@ -555,13 +554,13 @@ public function getBundleExtraFields($entity_type, $bundle) {
}
/**
* Prepares a field definition for the current run-time context.
* Prepares a field for the current run-time context.
*
* @param $field
* The raw field structure as read from the database.
* @param \Drupal\field\FieldInterface $field
* The field entity to update.
*
* @return
* The field definition completed for the current runtime context.
* @return \Drupal\field\FieldInterface
* The field that was prepared.
*/
public function prepareField(FieldInterface $field) {
// Make sure all expected field settings are present.
......@@ -571,13 +570,13 @@ public function prepareField(FieldInterface $field) {
}
/**
* Prepares an instance definition for the current run-time context.
* Prepares a field instance for the current run-time context.
*
* @param \Drupal\field\FieldInstanceInterface $instance
* The instance definition.
* The field instance entity to prepare.
*
* @return
* The field instance array completed for the current runtime context.
* @return \Drupal\field\FieldInstanceInterface
* The field instance that was prepared.
*/
public function prepareInstance(FieldInstanceInterface $instance) {
// Make sure all expected instance settings are present.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment