? ? Pending

User tests: Successful: Unsuccessful:

avatar photodude
photodude
21 May 2018

Pull Request for Issue code style corrections for doc comment types.

Summary of Changes

PHPCS2 manual fixes

  • Variables passed by reference should not have the & prefixed in the doc comment
    • Joomla.Commenting.FunctionComment.MissingParamTag
    • Joomla.Commenting.FunctionComment.ParamNameNoMatch
  • Correct return statement

Found using the Joomla code standards 2.0.0 PHPCS2-RC

Testing Instructions

Merge by code review

Expected result

code style has been applied as listed above, old code style testing on drone does not error.

Actual result

code style had not been applied. Found using the Joomla code standards 2.0.0 PHPCS2-RC

Documentation Changes Required

none

avatar photodude photodude - open - 21 May 2018
avatar photodude photodude - change - 21 May 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 21 May 2018
Category Administration com_banners com_categories com_contact com_content com_contenthistory com_fields
avatar zero-24
zero-24 - comment - 21 May 2018

Can be merged when 3.8.8 is released. Thanks @photodude

avatar zero-24 zero-24 - change - 21 May 2018
Status Pending Ready to Commit
avatar photodude
photodude - comment - 21 May 2018

@zero-24 Looks like the PHPCS 1.5.x code standards on Drone does not like these changes...

I'm not sure which way is the correct way. I'm guessing we need to fix something in PHPCS 2.x sniffs

avatar mbabker
mbabker - comment - 21 May 2018

You might need a custom exemption for the CMS for now to ignore that case. Because the PHPCS 1.5 sniffs enforce the reference operator being in the doc block and 2.0+ enforce it not being there.

avatar photodude
photodude - comment - 21 May 2018

@mbabker Is it correct in our code style to enforce the reference operator being in the doc block or to enforce it not being there? Reading over the docs I can't find any reference indicating which way is correct.

avatar mbabker
mbabker - comment - 21 May 2018

I don't think we ever decided one way or the other, I've just went with what the tooling told me to do. Arguably it's more correct to not have it, it's not necessary to describe in the doc block that something is passed by reference (that should be used in a code parser).

avatar photodude
photodude - comment - 21 May 2018

Doing some reading in other places I came across this comment in a phpDocumentor issue: "Having a "&" in the docblock (whether it's in front of the type or name) is not valid. References are to be expressed solely by the function/method declaration."

So it seems our PHPCS 1.5 sniffs are wrong and our PHPCS 2.x+ sniffs are correct.

I'll look at adding the exceptions here

avatar photodude photodude - change - 21 May 2018
Labels Added: ? ?
avatar joomla-cms-bot joomla-cms-bot - change - 21 May 2018
Category Administration com_banners com_categories com_contact com_content com_contenthistory com_fields Administration com_banners com_categories com_contact com_content com_contenthistory com_fields Repository
avatar carlitorweb
carlitorweb - comment - 22 May 2018

This warning is only for me, or the phpcs have a problem too in this. Almost all files I open, have it
screenshot_20180522082902

avatar photodude
photodude - comment - 23 May 2018

@carlitorweb please file that with PHPCS that error comes from the core PHPCS generic sniffs. I have seen it on some files when running PHPCS on win10 but I have not looking into it nor tried fixing files automatically that report it.

avatar carlitorweb
carlitorweb - comment - 23 May 2018

Ok sorry then, and thank you @photodude

avatar photodude
photodude - comment - 23 May 2018

No problem @carlitorweb, If you find any issues with the Joomla custom sniffs for PHPCS2.x+ we also have a repo specific to those sniffs where they can be reported. https://github.com/joomla/coding-standards

avatar mbabker mbabker - change - 24 May 2018
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-05-24 00:03:44
Closed_By mbabker
avatar mbabker mbabker - close - 24 May 2018
avatar mbabker mbabker - merge - 24 May 2018

Add a Comment

Login with GitHub to post a comment