Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / symfony / class-loader / ClassCollectionLoader.php
index 0ea9cef66064eb9ae8ffd07c7943e94e8d5910dd..3fd75c24544dbe266e4737403a4412190e19ef65 100644 (file)
@@ -56,7 +56,7 @@ class ClassCollectionLoader
             $classes = array_diff($classes, $declared);
 
             // the cache is different depending on which classes are already declared
-            $name = $name.'-'.substr(hash('sha256', implode('|', $classes)), 0, 5);
+            $name .= '-'.substr(hash('sha256', implode('|', $classes)), 0, 5);
         }
 
         $classes = array_unique($classes);
@@ -65,7 +65,7 @@ class ClassCollectionLoader
         if (!is_dir($cacheDir) && !@mkdir($cacheDir, 0777, true) && !is_dir($cacheDir)) {
             throw new \RuntimeException(sprintf('Class Collection Loader was not able to create directory "%s"', $cacheDir));
         }
-        $cacheDir = rtrim(realpath($cacheDir) ?: $cacheDir, '/'.DIRECTORY_SEPARATOR);
+        $cacheDir = rtrim(realpath($cacheDir) ?: $cacheDir, '/'.\DIRECTORY_SEPARATOR);
         $cache = $cacheDir.'/'.$name.$extension;
 
         // auto-reload
@@ -131,7 +131,7 @@ class ClassCollectionLoader
         }
 
         // cache the core classes
-        $cacheDir = dirname($cache);
+        $cacheDir = \dirname($cache);
         if (!is_dir($cacheDir) && !@mkdir($cacheDir, 0777, true) && !is_dir($cacheDir)) {
             throw new \RuntimeException(sprintf('Class Collection Loader was not able to create directory "%s"', $cacheDir));
         }
@@ -146,7 +146,7 @@ class ClassCollectionLoader
 REGEX;
         $dontInlineRegex = str_replace('.', $spacesRegex, $dontInlineRegex);
 
-        $cacheDir = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $cacheDir));
+        $cacheDir = explode('/', str_replace(\DIRECTORY_SEPARATOR, '/', $cacheDir));
         $files = array();
         $content = '';
         foreach (self::getOrderedClasses($classes) as $class) {
@@ -159,7 +159,7 @@ REGEX;
             $c = file_get_contents($file);
 
             if (preg_match($dontInlineRegex, $c)) {
-                $file = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $file));
+                $file = explode('/', str_replace(\DIRECTORY_SEPARATOR, '/', $file));
 
                 for ($i = 0; isset($file[$i], $cacheDir[$i]); ++$i) {
                     if ($file[$i] !== $cacheDir[$i]) {
@@ -169,8 +169,8 @@ REGEX;
                 if (1 >= $i) {
                     $file = var_export(implode('/', $file), true);
                 } else {
-                    $file = array_slice($file, $i);
-                    $file = str_repeat('../', count($cacheDir) - $i).implode('/', $file);
+                    $file = \array_slice($file, $i);
+                    $file = str_repeat('../', \count($cacheDir) - $i).implode('/', $file);
                     $file = '__DIR__.'.var_export('/'.$file, true);
                 }
 
@@ -203,7 +203,7 @@ REGEX;
      */
     public static function fixNamespaceDeclarations($source)
     {
-        if (!function_exists('token_get_all') || !self::$useTokenizer) {
+        if (!\function_exists('token_get_all') || !self::$useTokenizer) {
             if (preg_match('/(^|\s)namespace(.*?)\s*;/', $source)) {
                 $source = preg_replace('/(^|\s)namespace(.*?)\s*;/', "$1namespace$2\n{", $source)."}\n";
             }
@@ -220,7 +220,7 @@ REGEX;
             $token = $tokens[$i];
             if (!isset($token[1]) || 'b"' === $token) {
                 $rawChunk .= $token;
-            } elseif (in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) {
+            } elseif (\in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) {
                 // strip comments
                 continue;
             } elseif (T_NAMESPACE === $token[0]) {
@@ -230,7 +230,7 @@ REGEX;
                 $rawChunk .= $token[1];
 
                 // namespace name and whitespaces
-                while (isset($tokens[++$i][1]) && in_array($tokens[$i][0], array(T_WHITESPACE, T_NS_SEPARATOR, T_STRING))) {
+                while (isset($tokens[++$i][1]) && \in_array($tokens[$i][0], array(T_WHITESPACE, T_NS_SEPARATOR, T_STRING))) {
                     $rawChunk .= $tokens[$i][1];
                 }
                 if ('{' === $tokens[$i]) {
@@ -305,7 +305,7 @@ REGEX;
      */
     private static function writeCacheFile($file, $content)
     {
-        $dir = dirname($file);
+        $dir = \dirname($file);
         if (!is_writable($dir)) {
             throw new \RuntimeException(sprintf('Cache directory "%s" is not writable.', $dir));
         }