title: How to convert nullable variable to non nullable type?
body: <p>I have function which will receive parameter <code>?string</code></p>
  
  <pre><code>public function func(?string $x): string
  {
      $x = trim(strtolower($x));
      $x = preg_replace('/\s+/', ' ', $x);
      $x = str_replace(' ', '-', $x);
      return $x;
  }
  </code></pre>
  
  <p>running <code>./vendor/bin/phpstan analyse</code> give those errors:</p>
  
  <pre><code>Parameter #1 $str of function strtolower expects string, string|null given.              
  Parameter #3 $subject of function preg_replace expects array|string, string|null given.  
  Parameter #3 $subject of function str_replace expects array|string, string|null given.   
  </code></pre>
  
  <p><code>strtolower</code> needs <code>string</code> and <code>preg_replace</code>&amp;<code>str_replace</code> need <code>array|string</code> <br><br>what is the best way to solve this without changing param from <code>?string $x</code> to <code>string $x</code>?<br>
  in otherwords how to change var type from <code>string|null</code> to <code>string</code> ?</p>