php DOMImplementation自闭标签

I need to create self closing tags using php DOMImplementation , but I dont know how. I have this peace of code

$doc = new DOMImplementation();
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;


//create and set doctype for html5
$doctype = $doc->createDocumentType('html', '', '');
$doc = $doc->createDocument("", "", $doctype);

//here elements are created
$html = $doc->createElement("html");
$head = $doc->createElement("head");
$body = $doc->createElement("body");

$css = $doc->createElement("link",'');
$css->setAttribute("rel", "stylesheet");
$css->setAttribute("href", "code.css");
$css->setAttribute("type", "text/css");

$head->appendChild( $css );

$html->appendChild( $head );

$html->appendChild( $body );

$doc->appendChild( $html );
$xml_string = $doc->saveHTML() ;
echo $xml_string;

but when I create the link element I get

<link rel="stylesheet" href="code.css" type="text/css"></link>

how will I get

<link rel="stylesheet" href="code.css" type="text/css">