Pārlūkot izejas kodu

Implement deprecation notice

shalvah 4 gadi atpakaļ
vecāks
revīzija
afdca2bb44

+ 1 - 1
src/Commands/GenerateDocumentation.php

@@ -87,7 +87,7 @@ class GenerateDocumentation extends Command
      * @param Match[] $matches
      *
      * @return array
-     *@throws \ReflectionException
+     * @throws \ReflectionException
      *
      */
     private function processRoutes(array $matches)

+ 17 - 0
src/Tools/ConsoleOutputUtils.php

@@ -21,6 +21,23 @@ class ConsoleOutputUtils
             ->only();
     }
 
+    public static function deprecated($feature, $shouldUse = null, $link = null)
+    {
+        if (!self::$clara) {
+            self::bootstrapOutput(new ConsoleOutput);
+        }
+
+        $message = "You're using $feature. This is deprecated and will be removed in the next major version.";
+        if ($shouldUse) {
+            $message .= "\nYou should use $shouldUse instead.";
+        }
+        if ($link) {
+            $message .= " See $link for details";
+        }
+
+        self::$clara->warn($message);
+    }
+
     public static function warn($message)
     {
         if (!self::$clara) {