Skip to content

Commit a3a1240

Browse files
authored
Merge pull request #279 from phpeek/ignore-phpcs-supress
Backporting ignoring phpcsSuppress annotation to 1.8.
2 parents fa4c4e8 + 3337577 commit a3a1240

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

lib/Doctrine/Common/Annotations/AnnotationReader.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ class AnnotationReader implements Reader
101101
// PlantUML
102102
'startuml' => true, 'enduml' => true,
103103
// Symfony 3.3 Cache Adapter
104-
'experimental' => true
104+
'experimental' => true,
105+
// Slevomat Coding Standard
106+
'phpcsSuppress' => true,
105107
];
106108

107109
/**

tests/Doctrine/Tests/Common/Annotations/AnnotationReaderTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Doctrine\Common\Annotations\DocParser;
88
use Doctrine\Tests\Common\Annotations\Fixtures\Annotation\SingleUseAnnotation;
99
use Doctrine\Tests\Common\Annotations\Fixtures\ClassWithFullPathUseStatement;
10+
use Doctrine\Tests\Common\Annotations\Fixtures\ClassWithPhpCsSuppressAnnotation;
1011
use Doctrine\Tests\Common\Annotations\Fixtures\IgnoredNamespaces\AnnotatedAtClassLevel;
1112
use Doctrine\Tests\Common\Annotations\Fixtures\IgnoredNamespaces\AnnotatedAtMethodLevel;
1213
use Doctrine\Tests\Common\Annotations\Fixtures\IgnoredNamespaces\AnnotatedAtPropertyLevel;
@@ -129,4 +130,12 @@ public function testClassWithFullPathUseStatement()
129130

130131
self::assertInstanceOf(SingleUseAnnotation::class,$annotations[0]);
131132
}
133+
134+
public function testPhpCsSuppressAnnotationIsIgnored()
135+
{
136+
$reader = $this->getReader();
137+
$ref = new \ReflectionClass(ClassWithPhpCsSuppressAnnotation::class);
138+
139+
self::assertEmpty($reader->getMethodAnnotations($ref->getMethod('foo')));
140+
}
132141
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace Doctrine\Tests\Common\Annotations\Fixtures;
4+
5+
class ClassWithPhpCsSuppressAnnotation
6+
{
7+
/**
8+
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
9+
*/
10+
public function foo($parameterWithoutTypehint) {
11+
}
12+
}

0 commit comments

Comments
 (0)