diff --git a/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityNormalizer.php b/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityNormalizer.php index d84a446..c0d06aa 100644 --- a/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityNormalizer.php +++ b/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityNormalizer.php @@ -59,7 +59,8 @@ public function denormalize($data, $class, $format = null) { // @todo The @types might be CURIEs or aliases. Expand before trying to map. try { $typedDataIds = $this->rdfMappingManager->getTypedDataIdsFromTypeUris($typeUris); - } catch (RdfMappingException $e) { + } + catch (RdfMappingException $e) { throw new UnexpectedValueException($e->getMessage(), 0, $e); } diff --git a/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityWrapper.php b/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityWrapper.php index 4a5864a..19c7514 100644 --- a/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityWrapper.php +++ b/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityWrapper.php @@ -27,7 +27,7 @@ class JsonldEntityWrapper { /** * The entity that this object wraps. * - * @var Drupal\Core\Entity\EntityNG + * @var \Drupal\Core\Entity\EntityNG */ protected $entity; @@ -55,7 +55,7 @@ class JsonldEntityWrapper { /** * Constructor. * - * @param string $entity + * @param \Drupal\Core\Entity\EntityNG $entity * The Entity API entity * @param string $format. * The format. diff --git a/core/modules/jsonld/lib/Drupal/jsonld/JsonldRdfSchemaNormalizer.php b/core/modules/jsonld/lib/Drupal/jsonld/JsonldRdfSchemaNormalizer.php index 3505fc0..0196dcf 100644 --- a/core/modules/jsonld/lib/Drupal/jsonld/JsonldRdfSchemaNormalizer.php +++ b/core/modules/jsonld/lib/Drupal/jsonld/JsonldRdfSchemaNormalizer.php @@ -23,8 +23,8 @@ class JsonldRdfSchemaNormalizer extends JsonldNormalizerBase { protected static $supportedInterfaceOrClass = 'Drupal\rdf\SiteSchema\SchemaTermBase'; /** - * Implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize() - */ + * Implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize() + */ public function normalize($data, $format = NULL) { $normalized = array(); $graph = $data->getGraph(); diff --git a/core/modules/jsonld/lib/Drupal/jsonld/Tests/NormalizeDenormalizeTest.php b/core/modules/jsonld/lib/Drupal/jsonld/Tests/NormalizeDenormalizeTest.php index 7a6fff2..44bd3173 100644 --- a/core/modules/jsonld/lib/Drupal/jsonld/Tests/NormalizeDenormalizeTest.php +++ b/core/modules/jsonld/lib/Drupal/jsonld/Tests/NormalizeDenormalizeTest.php @@ -25,7 +25,7 @@ class NormalizeDenormalizeTest extends WebTestBase { * * @var array */ - public static $modules = array('language', 'entity_test', 'rdf'); + public static $modules = array('entity_test', 'jsonld', 'language', 'rdf'); /** * The format being tested. @@ -179,7 +179,8 @@ function testDenormalize() { try { $this->normalizers['entity']->denormalize($incomingData, 'Drupal\Core\Entity\EntityNG', static::$format); $this->fail('Trying to denormalize entity data without @type results in exception.'); - } catch (UnexpectedValueException $e) { + } + catch (UnexpectedValueException $e) { $this->pass('Trying to denormalize entity data without @type results in exception.'); } @@ -188,7 +189,8 @@ function testDenormalize() { try { $this->normalizers['entity']->denormalize($incomingData, 'Drupal\Core\Entity\EntityNG', static::$format); $this->fail('Trying to denormalize entity data with unrecognized @type results in exception.'); - } catch (UnexpectedValueException $e) { + } + catch (UnexpectedValueException $e) { $this->pass('Trying to denormalize entity data with unrecognized @type results in exception.'); } } diff --git a/core/modules/jsonld/lib/Drupal/jsonld/Tests/SupportsSerializationTest.php b/core/modules/jsonld/lib/Drupal/jsonld/Tests/SupportsSerializationTest.php index 301e851..f4ac546 100644 --- a/core/modules/jsonld/lib/Drupal/jsonld/Tests/SupportsSerializationTest.php +++ b/core/modules/jsonld/lib/Drupal/jsonld/Tests/SupportsSerializationTest.php @@ -20,7 +20,7 @@ class SupportsSerializationTest extends WebTestBase { * * @var array */ - public static $modules = array('entity_test'); + public static $modules = array('entity_test', 'jsonld'); /** * The format being tested. diff --git a/core/modules/rdf/lib/Drupal/rdf/EventSubscriber/MappingSubscriber.php b/core/modules/rdf/lib/Drupal/rdf/EventSubscriber/MappingSubscriber.php index 6f663b5..5c83c0a 100644 --- a/core/modules/rdf/lib/Drupal/rdf/EventSubscriber/MappingSubscriber.php +++ b/core/modules/rdf/lib/Drupal/rdf/EventSubscriber/MappingSubscriber.php @@ -22,6 +22,7 @@ class MappingSubscriber implements EventSubscriberInterface { * is from an external vocabulary. * * @param \Drupal\rdf\MapTypesFromInputEvent $event + * The mapping event. */ public function mapTypesFromInput(\Drupal\rdf\MapTypesFromInputEvent $event) { $inputUris = $event->getInputUris(); @@ -34,7 +35,7 @@ public function mapTypesFromInput(\Drupal\rdf\MapTypesFromInputEvent $event) { } } - /** + /** \ * Implements EventSubscriberInterface::getSubscribedEvents(). */ static function getSubscribedEvents() { diff --git a/core/modules/rdf/lib/Drupal/rdf/SiteSchema/SiteSchema.php b/core/modules/rdf/lib/Drupal/rdf/SiteSchema/SiteSchema.php index 0bdf5d9..c393b26 100644 --- a/core/modules/rdf/lib/Drupal/rdf/SiteSchema/SiteSchema.php +++ b/core/modules/rdf/lib/Drupal/rdf/SiteSchema/SiteSchema.php @@ -33,8 +33,15 @@ class SiteSchema { * Constructor. * * @param string $schemaPath + * The schema path constant, used to determine which schema to instantiate. + * + * @throws \UnexpectedValueException */ public function __construct($schemaPath) { + $valid_paths = array(self::CONTENT_DEPLOYMENT, self::SYNDICATION); + if (!in_array($schemaPath, $valid_paths)) { + throw new \UnexpectedValueException(sprintf('%s is not a valid site schema path. Schema path must be one of %s.'), $schemaPath, implode(', ', $valid_paths)); + } $this->schemaPath = $schemaPath; } diff --git a/core/modules/rdf/tests/rdf_test_mapping/lib/Drupal/rdf_test_mapping/EventSubscriber/TestMappingSubscriber.php b/core/modules/rdf/tests/rdf_test_mapping/lib/Drupal/rdf_test_mapping/EventSubscriber/TestMappingSubscriber.php index 1646ef5..1141615 100644 --- a/core/modules/rdf/tests/rdf_test_mapping/lib/Drupal/rdf_test_mapping/EventSubscriber/TestMappingSubscriber.php +++ b/core/modules/rdf/tests/rdf_test_mapping/lib/Drupal/rdf_test_mapping/EventSubscriber/TestMappingSubscriber.php @@ -20,6 +20,7 @@ class TestMappingSubscriber implements EventSubscriberInterface { * Demonstrate mapping between external type and site schema type. * * @param \Drupal\rdf\MapTypesFromInputEvent $event + * The mapping event. */ public function mapTypesFromInput($event) { $inputUris = $event->getInputUris();