diff --git a/app/views/web_migrate/index.php b/app/views/web_migrate/index.php
index b26b90c5981876bf6362cc2f7070cfa55ea9db61..589d50af8cc55a0c12188303a77d02dc768e0f0f 100644
--- a/app/views/web_migrate/index.php
+++ b/app/views/web_migrate/index.php
@@ -51,7 +51,7 @@
                     <?= htmlReady($number) ?>
                 </td>
                 <td>
-                    <?= htmlReady(get_class($migration)) ?>
+                    <?= htmlReady($migration->getName()) ?>
                 </td>
                 <td>
                 <? if ($migration->description()): ?>
diff --git a/lib/migrations/Migration.php b/lib/migrations/Migration.php
index abaf7476605871b3c18c0d642b57ff1ca01fc7ee..92f73c77d885a9fa9d8de50703c732d2c062b5e6 100644
--- a/lib/migrations/Migration.php
+++ b/lib/migrations/Migration.php
@@ -48,6 +48,24 @@ abstract class Migration
         return '';
     }
 
+    /**
+     * Returns the name of the migration. If the migration is an anonymous
+     * class, the the name is created from the filename. Otherwise, it's the
+     * class name of the migration.
+     *
+     * @return string
+     */
+    public function getName(): string
+    {
+        $reflection = new ReflectionClass($this);
+        if ($reflection->isAnonymous()) {
+            $filename = basename($reflection->getFileName(), '.php');
+            $name = implode(' ', array_slice(explode('_', $filename), 1));
+            return ucfirst($name);
+        }
+        return static::class;
+    }
+
     /**
      * Abstract method performing this migration step.
      * This method should be implemented in a migration subclass.
@@ -67,12 +85,12 @@ abstract class Migration
     /**
      * Perform or revert this migration, depending on the indicated direction.
      *
-     * @param string $direction migration direction (either 'up' or 'down')
+     * @param ?string $direction migration direction (either 'up' or 'down')
      */
     public function migrate($direction)
     {
         if (!in_array($direction, ['up', 'down'])) {
-            return;
+            return null;
         }
 
         $result = $this->$direction();
@@ -107,7 +125,7 @@ abstract class Migration
         $args = func_get_args();
         $message = vsprintf(array_shift($args), $args);
 
-        return $this->write($this->mark($message));
+        $this->write($this->mark($message));
     }
 
     /**