@@ -247,7 +247,7 @@ public function renderPropertySignature($property, $context = null)
247247 return '<span class="signature-defs"> ' . implode (' ' , $ definition ) . '</span> '
248248 . '<span class="signature-type"> ' . $ this ->createTypeLink ($ property ->types , $ context ) . '</span> '
249249 . ' ' . $ this ->createSubjectLink ($ property , $ property ->name ) . ' '
250- . ApiMarkdown::highlight ('= ' . ( $ property -> defaultValue === null ? ' null ' : $ property ->defaultValue ), 'php ' );
250+ . ApiMarkdown::highlight ('= ' . $ this -> renderDefaultValue ( $ property ->defaultValue ), 'php ' );
251251 }
252252
253253 /**
@@ -262,7 +262,7 @@ public function renderMethodSignature($method, $context = null)
262262 . ($ param ->isPassedByReference ? '<b>&</b> ' : '' )
263263 . ApiMarkdown::highlight (
264264 $ param ->name
265- . ($ param ->isOptional ? ' = ' . $ param ->defaultValue : '' ),
265+ . ($ param ->isOptional ? ' = ' . $ this -> renderDefaultValue ( $ param ->defaultValue ) : '' ),
266266 'php '
267267 );
268268 }
@@ -283,6 +283,38 @@ public function renderMethodSignature($method, $context = null)
283283 . str_replace (' ' , ' ' , ' ( ' . implode (', ' , $ params ) . ' ) ' );
284284 }
285285
286+ /**
287+ * Renders the default value.
288+ * @param mixed $value
289+ * @return string
290+ * @since 2.1.1
291+ */
292+ public function renderDefaultValue ($ value )
293+ {
294+ if ($ value === null ) {
295+ return 'null ' ;
296+ }
297+
298+ // special numbers which are usually used in octal or hex notation
299+ static $ specials = [
300+ // file permissions
301+ '420 ' => '0644 ' ,
302+ '436 ' => '0664 ' ,
303+ '438 ' => '0666 ' ,
304+ '493 ' => '0755 ' ,
305+ '509 ' => '0775 ' ,
306+ '511 ' => '0777 ' ,
307+ // colors used in yii\captcha\CaptchaAction
308+ '2113696 ' => '0x2040A0 ' ,
309+ '16777215 ' => '0xFFFFFF ' ,
310+ ];
311+ if (isset ($ specials [$ value ])) {
312+ return $ specials [$ value ];
313+ }
314+
315+ return $ value ;
316+ }
317+
286318 /**
287319 * @inheritdoc
288320 */
0 commit comments