Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: bad octal number representation #10369

Closed
hiqsol opened this issue Dec 10, 2015 · 11 comments
Closed

docs: bad octal number representation #10369

hiqsol opened this issue Dec 10, 2015 · 11 comments
Assignees

Comments

@hiqsol
Copy link
Member

hiqsol commented Dec 10, 2015

That's what we see in docs:

public static boolean createDirectory ( $path, $mode = 509, $recursive = true )

And in the source:

public static function createDirectory($path, $mode = 0775, $recursive = true)
@samdark
Copy link
Member

samdark commented Dec 10, 2015

Nice catch.

@cebe
Copy link
Member

cebe commented Dec 11, 2015

I do not think apidoc has any chance to detect that the original representation was not decimal but octal...

@cebe cebe closed this as completed Dec 11, 2015
@samdark
Copy link
Member

samdark commented Dec 11, 2015

If it's mode it's usually octal, isn't it?

@samdark
Copy link
Member

samdark commented Dec 11, 2015

We can make an exception...

@cebe
Copy link
Member

cebe commented Dec 12, 2015

mode can mean anything depended on the context :) Of course we could hardcode all the places we know in Yii but that could mess up the apidoc generator a bit.

@samdark
Copy link
Member

samdark commented Dec 12, 2015

Could it be exposed in config?

@cebe
Copy link
Member

cebe commented Dec 13, 2015

I am open for ideas on how to solve this, I do not see a good way right now, may reopen it, maybe someone has an idea about it.

@cebe cebe reopened this Dec 13, 2015
@SilverFire
Copy link
Member

Maybe we can handle it with a special PHPDoc comment?

@hiqsol
Copy link
Member Author

hiqsol commented Dec 13, 2015

This is rough, but it's enough for the problem and suitable for similar situations when you can be sure that this const is used only in special representation.

protected static $_specialConsts = [
  '509' => '0775',
  ...
] ;

public function renderConst ($value) 
{
  if (isset(static::$_specialConsts[(string) $value]) {
    return static::$_specialConsts[(string) $value] ;
  } 
  return somedefaultrenderconst($value);
} 

@yii-bot
Copy link

yii-bot commented Jan 24, 2016

Issue moved to yiisoft/yii2-apidoc#38

@yii-bot yii-bot closed this as completed Jan 24, 2016
@cebe
Copy link
Member

cebe commented Nov 22, 2016

@hiqsol want to send a PR to apidoc extension?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants