Reputation: 28742
I have a code sample like this:
$this->someConfig['settingname'] = [
'model' => 'foo\bar\baz',
'columns' => ['bla','blo','bleh'],
'sortorder'=> 'asc',
'defaultsort' => 'bla',
];
If I add it to the php doc it turns into this:
$this->someConfig['settingname'] = [ 'model' => 'foo\bar\baz', 'columns' => ['bla','blo','bleh'], 'sortorder'=> 'asc', 'defaultsort' => 'bla', ];
if I surround it by pre tags I get this
$this->someConfig['settingname'] = [
'model' => 'foo\bar\baz',
'columns' => ['bla','blo','bleh'],
'sortorder'=> 'asc',
'defaultsort' => 'bla',
];
which is closer but still not what I want.
I want the whitespacing formatting to stay preserved.
How do I achieve this?
Upvotes: 1
Views: 277
Reputation: 28742
You can achieve this by by instead of using an asterisk in front of the commented code a
character. Also wrap your code in <pre>
tags to make sure newlines are preserved, or use <BR>
tags after every line.
It will translate into a whitespace character, and all whitespace characters after the initial
character will be included.
Using the character will have the added benefit your sample code can be copied and pasted without any weird things showing up or having to be cleaned up
/**
* My code sample
* <pre>
$this->someConfig['settingname'] = [
'model' => 'foo\bar\baz',
'columns' => ['bla','blo','bleh'],
'sortorder'=> 'asc',
'defaultsort' => 'bla',
];
* </pre>
* bla bla bla
*/
Upvotes: 1