-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
Fix php comments #22515
Fix php comments #22515
Conversation
(Standard links)
|
@@ -815,7 +815,7 @@ public static function isOrQuery() { | |||
* | |||
* @param int $cid | |||
* @param int $oid | |||
* @param "dupe-nondupe|nondupe-dupe" $oper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@param dupenondupe|nondupedupe $oper
is defining that the param should be either a dupenondupe
or nondupedupe
class - not quite what was expected.
Currently the de-facto standards (https://docs.phpdoc.org/guide/references/phpdoc/types.html and https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc-tags.md only allow for @param string @oper
which the available strings documented as a comment.
If prefered, we could do 'dupenondupe'|'nondupedupe'
which whilst non-standard, is a format supported by at least one tool (https://psalm.dev/docs/annotating_code/typing_in_psalm/). There is also discussion of other syntaxes here, but unfortunately without much consensus phpDocumentor/phpDocumentor#557.
So probably sticking with @param string @oper
for now is best.
(note this applies to the change in CRM/Core/BAO/CustomField.php
too)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@braders yep that definiely seems to be the easier approach. I had it in mind that there was a way to list available strings that is agreed - I think the definitive place for standards is psr5 now - https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc.md - but I haven't read it through
+1 on enforcing capitalisation. That looks good. |
c0791ca
to
b873d6d
Compare
This commit contains 14 files worth of changes from the following steps 1) install https://github.com/civicrm/coder.git 2) comment out <rule ref=Drupal.Commenting.FunctionComment.IncorrectParamVarName><severity>0</severity></rule> 3) run phpcbf --standard=Drupal This follows on from efforts from @braders - there are not many instances (although I kept the comment small) and we could fairly easily get rid of them all and enable that rule in CI - which would lift the bar a little
b873d6d
to
aec7c57
Compare
thanks @braders @demeritcowboy |
As per civicrm#22515
Per civicrm/civicrm-core#22515 there are a handful of these- we can fix the bulk of them pretty easily
This commit contains 14 files worth of changes from the following steps
<rule ref=Drupal.Commenting.FunctionComment.IncorrectParamVarName><severity>0</severity></rule>
This follows on from efforts from @braders - there are not many
instances (although I kept the comment small) and we could fairly easily get rid of them
all and enable that rule in CI - which would lift the bar a little