Uncaught PHP Exception Error: “Typed property PimcoreModelDocumentDocType::$name must not be accessed before initialization” at DocType.php

I’ve been using Pimcore for a month, working on my localhost machine. Yesterday, I uploaded my Pimcore project to my server. I copied all the files and added the necessary permissions to the folders, but I keep getting the following error when I log in or refresh the page.

Would anyone be able to help?

request.CRITICAL: Uncaught PHP Exception Error: “Typed property PimcoreModelDocumentDocType::$name must not be accessed before initialization” at DocType.php line 134 {“exception”:”[object] (Error(code: 0): Typed property PimcoreModelDocumentDocType::$name must not be accessed before initialization at httpdocs/vendor/pimcore/pimcore/models/Document/DocType.php:134)”} []

I have tried looking inside every single file mention in the error log (If anybody needs the error log screenshot I will send it to you).
The only temporary solution is editing the following file:

httpdocs/vendor/pimcore/pimcore/models/Document/DocType/Listing/Dao.php
on line 60

    public static function sortByPriority(DocType $a, DocType $b): int
    {
        $a->getPriority();
        if ($a->getPriority() === $b->getPriority()) {
            return strcasecmp($a->getGroup() . $a->getName(), $b->getGroup() . $b-      >getName());
        }

        return $a->getPriority() <=> $b->getPriority();
    }

Overriding the following code by commenting the code and returning 0 the error doesn’t take place.
This doesn’t make sense for two main reasons:

  1. Is in the vendor folder so it gets frequently updated;
  2. In my local machine this error is not present, and I copied every folder 1to1 on my server.