-
Notifications
You must be signed in to change notification settings - Fork 20
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
PHPCS & Doctrine annotations #453
Comments
What version? |
You're right, the constructor is probably doing too much here and should be refactored. |
However, you lost me on the main problem here. I am confused. |
yeah, I guess it's not clear what the main problem here is. I'll look into this further so I can give you more definitive answer, but at the moment it looks like the library you used (annotations) does not agree with code sniffer. It's not exactly the problem of the library but given the wide use of cs, breaking compatibility with it is rather significant. |
Okay I understand the problem now, how annoying. I am not sure if there is a way to exclude certain annotations with https://github.com/webmozart/doctrine-common/blob/master/lib/Doctrine/Common/Annotations/AnnotationReader.php, but I bet some try/catch blocks could perhaps handle this in here: https://github.com/cnizzardini/cakephp-swagger-bake/blob/1.next/src/Lib/Utility/AnnotationUtility.php I'd imagine if the exception message doesn't contain SwaggerBake in the namespace then the exception can be ignored. A bit brittle, but I think it would be fine. |
Eh, not possible, but I did find this: https://stackoverflow.com/questions/41496487/how-to-tell-symfony-3-to-ignore-certain-annotations This worked for me, but I have no idea if it will suppress phpcs internals or not. /**
* @IgnoreAnnotation("phpcs:disable")
*/
class OperationsController extends AppController
{
/**
* @Swag\SwagOperation(isVisible=false)
* @phpcs:disable testing
*/
public function isVisible()
{
}
} This also worked if I placed it in my Doctrine\Common\Annotations\AnnotationReader::addGlobalIgnoredName('phpcs:disable'); |
Not sure what we can do about this, but PHPCS clearly allows
(this is from CS unit tests)
use of
/** @phpcs:disable Something */
while Doctrine Annotation module treats it as missing class. This becomes a problem when you disableGeneric.Files.LineLength.TooLong
within a doc block of a class.The above results in
even if
Hot Reload
is disabled asalways calls
In my view, all the data should be already written to
swagger.json
whenswagger bake
command runs. Why is there still any code analysis?The text was updated successfully, but these errors were encountered: