Closed soullivaneuh closed 7 years ago
bump.
Is that project still maintained?
Hi @Soullivaneuh,
this project is still maintained, however: it's pretty much on the backburner. Do submit a PR if you want the issue to get fixed sooner, otherwise it will be down to our availability - which is quite low due to other projects recently...
Hope this helps!
Kind regards, David
Please have a look: https://github.com/squizlabs/PHP_CodeSniffer/issues/751#issuecomment-151803697
Apparently, we have to override the sniffer.
:+1:
I encounter the same issue.
@Soullivaneuh Did you find a solution ?
+1
+1
Same here!
@djoos I am trying to dig into the project. Please advice how you run tests locally.
I've installed ant
and running through it, but it gives a bunch of errors like shown below.
Please advice what I am missing.
phpcs:
[exec]
[exec] FILE: ...-standard/Symfony2/Tests/Objects/ObjectInstantiationUnitTest.php
[exec] ----------------------------------------------------------------------
[exec] FOUND 2 ERRORS AFFECTING 1 LINE
[exec] ----------------------------------------------------------------------
[exec] 28 | ERROR | Each class must be in a namespace of at least one level
[exec] | | (a top-level vendor name)
[exec] 28 | ERROR | Class name
[exec] | | "Symfony2_Tests_Objects_ObjectInstantiationUnitTest" is
[exec] | | not in camel caps format
[exec] ----------------------------------------------------------------------
[exec]
[exec]
[exec] FILE: ...-standard/Symfony2/Tests/Objects/ObjectInstantiationUnitTest.inc
[exec] ----------------------------------------------------------------------
[exec] FOUND 9 ERRORS AFFECTING 7 LINES
[exec] ----------------------------------------------------------------------
[exec] 4 | ERROR | [ ] Use parentheses when instantiating classes
[exec] 5 | ERROR | [ ] Use parentheses when instantiating classes
[exec] 6 | ERROR | [ ] Use parentheses when instantiating classes
[exec] 7 | ERROR | [ ] Use parentheses when instantiating classes
[exec] 8 | ERROR | [ ] Use parentheses when instantiating classes
[exec] 8 | ERROR | [x] Space before opening parenthesis of function call
[exec] | | prohibited
[exec] 8 | ERROR | [x] Space before opening parenthesis of function call
[exec] | | prohibited
[exec] 9 | ERROR | [ ] Use parentheses when instantiating classes
[exec] 10 | ERROR | [ ] Use parentheses when instantiating classes
[exec] ----------------------------------------------------------------------
[exec] PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
[exec] ----------------------------------------------------------------------
@geekdevs it looks like you're running phpcs correctly. the errors you're seeing are the actual code style violations. for instance
Each class must be in a namespace of at least one level (a top-level vendor name)
means that you probably have a class in your project which looks like
<?php
namespace Foo;
while the correct way contains a top level name like
<?php
namespace Foo/Bar;
and
Use parentheses when instantiating classes
probably means you got a
$foo = new Bar;
rather than a
$foo = new Bar();
etc. please have a look at the code sniffer end user documentation on how to use phpcs. hope this helps…
@wickedOne well the problem is that I am not testing my own project, but this one (escapestudios/Symfony2-coding-standard) with unit tests it has in the project. So either this project has a lot of violations or it runs tests somehow specifically, that's why I ask.
usually the sniffs themself have to comply to the PEAR coding standard as defined over here (not sure thought whether they actually do).
Hi @geekdevs,
the coding standard was not complying with the PEAR coding standard - I've fixed that now. Could you give master another go? Give me a shout if you experience any further issues.
Hope this helps! David
Back on topic: multiple array arguments!
Hi guys,
are you still experiencing this issue? Looking into it (squiz/labs_phpcodesniffer 931223073e116381e7d2e701ce31dfd59a2ec226) I can't replicate this issue at all...
Is this related to this fix https://github.com/squizlabs/PHP_CodeSniffer/issues/698#issuecomment-180609565?
I'll close the issue for now, but please don't hesitate to reopen if you are still experiencing it...
Kind regards, David
I confirm I don't encounter the error anymore.
I don't think it's fixed. The following gives error:
$resolver->setDefaults([
'attr' => [
'novalidate' => 'novalidate',
],
]);
Multi-line function call not indented correctly; expected 12 spaces but found 16 (PEAR.Functions.FunctionCallSignature.Indent)
i think this one can be closed as
<?php
$resolver->setDefaults([
'attr' => [
'novalidate' => 'novalidate',
],
]);
doesn't raise an error anymore...
Sorry but this issue is not fixed @djoos
This:
public function lintReport(): LintReport
{
/** @var \Traversable $lintServices */
$lintServices = $this->lintServiceManager->getServices();
$lintServiceCodes = \array_map(static function (ServiceInterface $service) {
return $service->getCodeName();
}, \array_filter(\iterator_to_array(
$lintServices
), static function (ServiceInterface $service) {
return $service instanceof LintServiceInterface;
}));
$report = new LintReport();
Is transformed to this:
public function lintReport(): LintReport
{
/** @var \Traversable $lintServices */
$lintServices = $this->lintServiceManager->getServices();
$lintServiceCodes = \array_map(static function (ServiceInterface $service) {
return $service->getCodeName();
}, \array_filter(\iterator_to_array(
$lintServices
), static function (ServiceInterface $service) {
return $service instanceof LintServiceInterface;
}));
$report = new LintReport();
And this cause conflicts with php-cs-fixer.
With this code:
CS found an error on line with
], [
:But I think this is wrong.
The only way to make phpcs happy is to make this following "correction":
But that makes no sense IMO.