Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / symfony / dependency-injection / Compiler / CheckDefinitionValidityPass.php
index d7d44d90ce6d979a9d89200600d1a4c866a4e927..a1967802f6a30d37a8eebd2d935f8b0704822331 100644 (file)
@@ -48,6 +48,15 @@ class CheckDefinitionValidityPass implements CompilerPassInterface
                     throw new RuntimeException(sprintf('Please add the class to service "%s" even if it is constructed by a factory since we might need to add method calls based on compile-time checks.', $id));
                 }
                 if (class_exists($id) || interface_exists($id, false)) {
+                    if (0 === strpos($id, '\\') && 1 < substr_count($id, '\\')) {
+                        throw new RuntimeException(sprintf(
+                            'The definition for "%s" has no class attribute, and appears to reference a class or interface. '
+                            .'Please specify the class attribute explicitly or remove the leading backslash by renaming '
+                            .'the service to "%s" to get rid of this error.',
+                            $id, substr($id, 1)
+                        ));
+                    }
+
                     throw new RuntimeException(sprintf(
                          'The definition for "%s" has no class attribute, and appears to reference a '
                         .'class or interface in the global namespace. Leaving out the "class" attribute '
@@ -57,13 +66,7 @@ class CheckDefinitionValidityPass implements CompilerPassInterface
                     ));
                 }
 
-                throw new RuntimeException(sprintf(
-                    'The definition for "%s" has no class. If you intend to inject '
-                   .'this service dynamically at runtime, please mark it as synthetic=true. '
-                   .'If this is an abstract definition solely used by child definitions, '
-                   .'please add abstract=true, otherwise specify a class to get rid of this error.',
-                   $id
-                ));
+                throw new RuntimeException(sprintf('The definition for "%s" has no class. If you intend to inject this service dynamically at runtime, please mark it as synthetic=true. If this is an abstract definition solely used by child definitions, please add abstract=true, otherwise specify a class to get rid of this error.', $id));
             }
 
             // tag attribute values must be scalars