Skip to main content

Error after upgrade Magento into version 2.4.4 with PHP 8.1

After upgrading Magento to version 2.4.4 and PHP 8.1, you might have this error 

Type Error occurred when creating object: Magento\Framework\Communication\Config\Data, Magento\Framework\Reflection\TypeProcessor::resolveFullyQualifiedClassName(): Argument #2 ($typeName) must be of type string, null given, called in /{magento_root}/vendor/magento/framework/Reflection/TypeProcessor.php on line 550
 

the first thing you can do is to find what is the class name and even the function name inside that class, please add this line before line 550 in TypeProcessor class

 

if($type==null || empty($type)){
    print_r($type);
    echo PHP_EOL;
    print($param->getDeclaringClass()->name ." -> ".$param->getDeclaringFunction()->name);
    echo PHP_EOL;
    exit;
}

that will display the class name and the function name, you have to check the function and solve it 

 

some reasons

 

  •  a "." dot exists in the end of the parameter Doc, example 
     
/**
 *
 * @api
 * @param string $invoice.
 * @param string $fileName
 * @return bool
 */
public function saveFile($invoice, $fileName);

solution remove the last dot {$invoice.} with {$invoice}

  •  a different parameter name in Doc, example 
     
/**
 *
 * @api
 * @param string $entity
 * @param string $fileName
 * @return bool
 */
public function saveFile($invoice, $fileName);

solution remove the last dot {$entity.} with {$invoice}

 

Error 2: Cannot instantiate interface Magento\Framework\Jwt\JwtManagerInterface: this can be any interface and the solution is to see if there are any disabled modules that might be needed-> enable them and try them again, in this example, this module was needed 

'Magento_JwtFrameworkAdapter' => 1,