Witam serdecznie,
Mam taki kod:
declare(strict_types=1);
class TextModifications
{
static public function readValue(string $string): string
{
return $purifier->purify($string);
}
static public function saveValue(string $string): string
{
return $string;
}
}
$TextModifications = new TextModifications();
$TextModifications->saveValue($_POST["login"])
I otrzymuję błąd:
Fatal error: Uncaught TypeError: Argument 1 passed to TextModifications::saveValue() must be of the type string, null given, called in /Applications/XAMPP/xamppfiles/htdocs/1.php on line 21 and defined in /Applications/XAMPP/xamppfiles/htdocs/1.php:11 Stack trace: #0 /Applications/XAMPP/xamppfiles/htdocs/1.php(21): TextModifications::saveValue(NULL) #1 {main} thrown in /Applications/XAMPP/xamppfiles/htdocs/1.php on line 11
Mam PHP 7.2.
Wie ktoś może jak naprawić taki problem?