diff --git a/core/includes/config.inc b/core/includes/config.inc index 616a65f..c7fca03 100644 --- a/core/includes/config.inc +++ b/core/includes/config.inc @@ -7,6 +7,7 @@ use Drupal\Core\Config\Context\FreeConfigContext; use Drupal\Core\Config\FileStorage; use Drupal\Core\Config\StorageInterface; +use Drupal\Core\Entity\EntityTypeInterface; use Symfony\Component\Yaml\Dumper; /** @@ -202,8 +203,7 @@ function config_context_leave() { * Either the entity type name, or NULL if none match. */ function config_get_entity_type_by_name($name) { - $entities = array_filter(\Drupal::entityManager()->getDefinitions(), function($entity_info) use ($name) { - /** @var $entity_info \Drupal\Core\Entity\EntityTypeInterface */ + $entities = array_filter(\Drupal::entityManager()->getDefinitions(), function (EntityTypeInterface $entity_info) use ($name) { return ($config_prefix = $entity_info->getConfigPrefix()) && strpos($name, $config_prefix . '.') === 0; }); return key($entities); diff --git a/core/lib/Drupal/Component/Annotation/AnnotationBase.php b/core/lib/Drupal/Component/Annotation/AnnotationBase.php index 08fdff1..83e8539 100644 --- a/core/lib/Drupal/Component/Annotation/AnnotationBase.php +++ b/core/lib/Drupal/Component/Annotation/AnnotationBase.php @@ -8,7 +8,7 @@ namespace Drupal\Component\Annotation; /** - * @todo. + * Provides a base class for classed annotations. */ abstract class AnnotationBase implements AnnotationInterface { @@ -18,25 +18,52 @@ * @var string */ public $id; + + /** + * The class used for this plugin. + * + * @var string + */ protected $class; + + /** + * The provider of the plugin. + * + * @var string + */ protected $provider; + /** + * {@inheritdoc} + */ public function getProvider() { return $this->provider; } + /** + * {@inheritdoc} + */ public function setProvider($provider) { $this->provider = $provider; } + /** + * {@inheritdoc} + */ public function getId() { return $this->id; } + /** + * {@inheritdoc} + */ public function getClass() { return $this->class; } + /** + * {@inheritdoc} + */ public function setClass($class) { $this->class = $class; } diff --git a/core/lib/Drupal/Component/Annotation/AnnotationInterface.php b/core/lib/Drupal/Component/Annotation/AnnotationInterface.php index c75f223..6e577c2 100644 --- a/core/lib/Drupal/Component/Annotation/AnnotationInterface.php +++ b/core/lib/Drupal/Component/Annotation/AnnotationInterface.php @@ -16,10 +16,40 @@ * Returns the value of an annotation. */ public function get(); + + /** + * @todo. + * + * @return string + */ public function getProvider(); + + /** + * @todo. + * + * @param string $provider + */ public function setProvider($provider); + + /** + * @todo. + * + * @return string + */ public function getId(); + + /** + * @todo. + * + * @return string + */ public function getClass(); + + /** + * @todo. + * + * @param string $class + */ public function setClass($class); } diff --git a/core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php b/core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php index 76ddf4e..b04e39d 100644 --- a/core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php +++ b/core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php @@ -134,6 +134,15 @@ public function getDefinitions() { return $definitions; } + + /** + * Prepares the annotation definition. + * + * @param \Drupal\Component\Annotation\AnnotationInterface $annotation + * The annotation derived from the plugin. + * @param string $class + * The class used for the plugin. + */ protected function prepareAnnotationDefinition(AnnotationInterface $annotation, $class) { $annotation->setClass($class); } diff --git a/core/lib/Drupal/Component/Annotation/PluginID.php b/core/lib/Drupal/Component/Annotation/PluginID.php index 24dd619..fe8e599 100644 --- a/core/lib/Drupal/Component/Annotation/PluginID.php +++ b/core/lib/Drupal/Component/Annotation/PluginID.php @@ -34,7 +34,11 @@ public function get() { ); } + /** + * {@inheritdoc} + */ public function getId() { return $this->value; } + } diff --git a/core/lib/Drupal/Core/Annotation/Translation.php b/core/lib/Drupal/Core/Annotation/Translation.php index 03dc6e2..ebb2655 100644 --- a/core/lib/Drupal/Core/Annotation/Translation.php +++ b/core/lib/Drupal/Core/Annotation/Translation.php @@ -8,7 +8,6 @@ namespace Drupal\Core\Annotation; use Drupal\Component\Annotation\AnnotationBase; -use Drupal\Component\Annotation\AnnotationInterface; /** * @defgroup plugin_translatable Translatable plugin metadata diff --git a/core/modules/config/lib/Drupal/config/Form/ConfigSingleExportForm.php b/core/modules/config/lib/Drupal/config/Form/ConfigSingleExportForm.php index 533a002..2f146c6 100644 --- a/core/modules/config/lib/Drupal/config/Form/ConfigSingleExportForm.php +++ b/core/modules/config/lib/Drupal/config/Form/ConfigSingleExportForm.php @@ -10,6 +10,7 @@ use Drupal\Component\Utility\MapArray; use Drupal\Core\Config\StorageInterface; use Drupal\Core\Entity\EntityManagerInterface; +use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Form\FormBase; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -78,8 +79,7 @@ public function buildForm(array $form, array &$form_state, $config_type = NULL, $this->definitions[$entity_type] = $definition; } } - $entity_types = array_map(function ($definition) { - /** @var $definition \Drupal\Core\Entity\EntityTypeInterface */ + $entity_types = array_map(function (EntityTypeInterface $definition) { return $definition->getLabel(); }, $this->definitions); // Sort the entity types by label, then add the simple config to the top. @@ -177,8 +177,7 @@ protected function findConfiguration($config_type) { // Handle simple configuration. else { // Gather the config entity prefixes. - $config_prefixes = array_map(function ($definition) { - /** @var $definition \Drupal\Core\Entity\EntityTypeInterface */ + $config_prefixes = array_map(function (EntityTypeInterface $definition) { return $definition->getConfigPrefix() . '.'; }, $this->definitions); diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaEntityTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaEntityTest.php index 98b5bfc..528bcda 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaEntityTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaEntityTest.php @@ -7,6 +7,7 @@ namespace Drupal\views\Tests\Handler; +use Drupal\Core\Entity\EntityTypeInterface; use Drupal\views\Tests\ViewTestBase; use Drupal\views\Views; @@ -52,8 +53,7 @@ public function testEntityAreaData() { $data = $this->container->get('views.views_data')->get('views'); $entity_info = $this->container->get('entity.manager')->getDefinitions(); - $expected_entities = array_filter($entity_info, function($info) { - /** @var $info \Drupal\Core\Entity\EntityTypeInterface */ + $expected_entities = array_filter($entity_info, function (EntityTypeInterface $info) { return $info->hasController('view_builder'); }); @@ -64,8 +64,7 @@ public function testEntityAreaData() { $this->assertEqual($entity, $data['entity_' . $entity]['area']['entity_type'], format_string('Correct entity_type set for @entity', array('@entity' => $entity))); } - $expected_entities = array_filter($entity_info, function($info) { - /** @var $info \Drupal\Core\Entity\EntityTypeInterface */ + $expected_entities = array_filter($entity_info, function (EntityTypeInterface $info) { return !$info->hasController('view_builder'); });