doc-en icon indicating copy to clipboard operation
doc-en copied to clipboard

Add documentation for the `Spoofchecker::setRestrictionLevel` method

Open alamirault opened this issue 2 years ago • 4 comments

Hi,

This PR try to document Spoofchecker::setRestrictionLevel

php-src commit is https://github.com/php/php-src/commit/f56ceb7f5b603768e6801a0f7471f430075015ac

It's my first contribution on this repository, tell me if something is wrong :smile:

alamirault avatar Sep 24 '23 11:09 alamirault

@TimWolla Do you know where I can found an example of a warning/mention in phpdoc ? I don't know how to add it

alamirault avatar Sep 26 '23 17:09 alamirault

@alamirault https://github.com/php/doc-en/blob/43f61d4507f516a611c05d41c4717df83ca860d8/reference/password/functions/password-hash.xml#L133-L140

https://github.com/php/doc-en/blob/43f61d4507f516a611c05d41c4717df83ca860d8/reference/password/functions/password-hash.xml#L71-L77

See: https://www.php.net/manual/en/function.password-hash.php

TimWolla avatar Sep 27 '23 18:09 TimWolla

Looks like this PR got overlooked/forgotten, but on the bright side this method was documented via https://github.com/php/doc-en/pull/2274 -- but thank you for spending time working on this PR!

philip avatar Feb 24 '25 18:02 philip

@TimWolla Regarding this:

Calling ->setChecks() after ->setRestrictionLevel() nullifies the restriction level.

(I hope to propose a cleaner API if / when PHP has tagged unions)

I was about to document this but am confused. Why does the API have such a restriction? Here's the proposed addition:

     <caution> 
      <para>
       Calling <methodname>SpoofChecker::setChecks</methodname> after <methodname>SpoofChecker::setRestrictionLevel</methodname>
       overrides the restriction level. Therefore, call <methodname>SpoofChecker::setChecks</methodname> first.
      </para> 
     </caution> 

philip avatar Feb 24 '25 21:02 philip