coding-standard
coding-standard copied to clipboard
Allow to keep attributes FQCN in SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly
/**
* Checks if current position is valid
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function valid()
{
return isset($this->dataSet[$this->position]);
}
triggers
55 | ERROR | [x] Class \ReturnTypeWillChange should not be referenced via a fully qualified name, but via a use statement. (SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName)
And we did not see a config option that allows to skip this for attributes, while keeping it for actual code.
Since our code is 7.4+, we do want this not to mess up the use statements at this point and to ignore for attributes themselves.
Did we miss sth or is that not possible currently?
I saw the SOURCE_ATTRIBUTE beside the other sources, and the others are OK, just didn't see one config to overwrite/exclude this specific one.
Thank you! The sniff itself is super helpful :)
Adding a use statement for ReturnTypeWillChange then results in:
Type ReturnTypeWillChange is not used in this file. (SlevomatCodingStandard.Namespaces.UnusedUses.UnusedUse)
Above is probably the real issue, rather than ignoring SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName for attributes?
@kukulich any suggestions on where to begin with a PR - which sniff needs fixing for starters? Something similar to https://github.com/slevomat/coding-standard/commit/1122e79f8bc6851d52b2fe4a57be5394d1da9888 so ReturnTypeWillChange is a permitted use statement?
@dereuromark did you find a solution?
Yeah we silenced that part.