original_string: public static function nonStatic(string $source, ?string $sourceClass = null, ?string $targetClass = null): string
    {
      // Replace static fields.
      $source = preg_replace('/(public|protected|private)\s+static(\s+)\$/i', '${1}${2}$', $source);
  
      // Replace usage of static fields.
      $source = preg_replace('/self::\$/', '$this->', $source);
  
      // Replace static methods.
      $source = preg_replace('/(public|protected|private)\s+static(\s+)(function)/i', '${1}${2}${3}', $source);
  
      // Replace invocation of static methods.
      $source = preg_replace('/self::/', '$this->', $source);
  
      // Replace class name.
      if ($sourceClass!==null)
      {
        $source = preg_replace('/(class)(\s+)'.$sourceClass.'/', '${1}${2}'.$targetClass, $source);
      }
  
      return $source;
    }
code: public static function nonStatic(string $source, ?string $sourceClass = null, ?string $targetClass = null): string
    {
      // Replace static fields.
      $source = preg_replace('/(public|protected|private)\s+static(\s+)\$/i', '${1}${2}$', $source);
  
      // Replace usage of static fields.
      $source = preg_replace('/self::\$/', '$this->', $source);
  
      // Replace static methods.
      $source = preg_replace('/(public|protected|private)\s+static(\s+)(function)/i', '${1}${2}${3}', $source);
  
      // Replace invocation of static methods.
      $source = preg_replace('/self::/', '$this->', $source);
  
      // Replace class name.
      if ($sourceClass!==null)
      {
        $source = preg_replace('/(class)(\s+)'.$sourceClass.'/', '${1}${2}'.$targetClass, $source);
      }
  
      return $source;
    }
code_tokens: public static function nonStatic ( string $ source , ? string $ sourceClass = null , ? string $ targetClass = null ) : string { // Replace static fields. $ source = preg_replace ( '/(public|protected|private)\s+static(\s+)\$/i' , '${1}${2}$' , $ source ) ; // Replace usage of static fields. $ source = preg_replace ( '/self::\$/' , '$this->' , $ source ) ; // Replace static methods. $ source = preg_replace ( '/(public|protected|private)\s+static(\s+)(function)/i' , '${1}${2}${3}' , $ source ) ; // Replace invocation of static methods. $ source = preg_replace ( '/self::/' , '$this->' , $ source ) ; // Replace class name. if ( $ sourceClass !== null ) { $ source = preg_replace ( '/(class)(\s+)' . $ sourceClass . '/' , '${1}${2}' . $ targetClass , $ source ) ; } return $ source ; }
docstring: Returns the code for a non static class based on a static class.
  
  @param string      $source      The source code of the static class.
  @param string|null $sourceClass The name of the static class.
  @param string|null $targetClass The name og the non static class.
  
  @return string
docstring_tokens: Returns the code for a non static class based on a static class .