Closed (fixed)
Project:
Coder
Version:
8.x-3.x-dev
Component:
Coder Sniffer
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
5 Jun 2019 at 17:04 UTC
Updated:
26 Jun 2019 at 15:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
pwolanin commentedHere's a first pass at a patch
Comment #3
klausiThanks for reporting and the patch!
I think we should not check the current PHP version and simply allow object also as type hint.
Can you file a pull request against https://github.com/pfrenssen/coder and add a test case?
Comment #4
pwolanin commentedI couldn’t find easily the api within phpcs to determine the targeted php version - it would likely be better to use that than the actual current version. There is a flag:
--config-set php_versionSince object as a type hint would fail in php < 7.2 I'm not sure I agree it should be supported unconditionally. I guess the code would fail, so maybe it's fine?
Comment #5
klausiYep, Coder is only a coding standards checker and does not support valid PHP checks in different versions :)
Comment #6
pwolanin commentedThere is some related code already in squizlabs:
squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Commenting/FunctionCommentSniff.php
Comment #7
pwolanin commentedPR: https://github.com/pfrenssen/coder/pull/47
Comment #8
pwolanin commentedHere's a patch from the PR. It does have an added test case
Comment #10
klausiCommitted a simpler version, thanks!
Comment #11
klausi