Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/Doctrine/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,19 @@
/>
</properties>
</rule>
<!-- Forbid useless comments -->
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenComments">
<properties>
<property
name="forbiddenCommentPatterns"
type="array"
value="
~^(?:(?!private|protected|static)\S+ )?(?:con|de)structor\.\z~i,
~^Created by \S+\.\z~i,
~^\S+ [gs]etter\.\z~i,
" />
</properties>
</rule>
<!-- report invalid format of inline phpDocs with @var -->
<rule ref="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration"/>
<!-- Forbid assignments in conditions -->
Expand Down
5 changes: 3 additions & 2 deletions tests/expected_report.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ FILE ERRORS WARNINGS
----------------------------------------------------------------------
tests/input/concatenation_spacing.php 24 0
tests/input/example-class.php 19 0
tests/input/forbidden-comments.php 4 0
tests/input/not_spacing.php 7 0
tests/input/return_type_on_closures.php 21 0
tests/input/return_type_on_methods.php 17 0
tests/input/test-case.php 6 0
----------------------------------------------------------------------
A TOTAL OF 94 ERRORS AND 0 WARNINGS WERE FOUND IN 6 FILES
A TOTAL OF 98 ERRORS AND 0 WARNINGS WERE FOUND IN 7 FILES
----------------------------------------------------------------------
PHPCBF CAN FIX 83 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
PHPCBF CAN FIX 86 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


26 changes: 26 additions & 0 deletions tests/fixed/forbidden-comments.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

namespace Test;

class Foo
{
public function __construct()
{
echo 'Hello';
}

public function getBar() : int
{
return 123;
}

/**
* Very important getter.
*/
public function getBaz() : int
{
return 456;
}
}
34 changes: 34 additions & 0 deletions tests/input/forbidden-comments.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

/** Created by PhpStorm. */

declare(strict_types=1);

namespace Test;

class Foo
{
/**
* Constructor.
*/
public function __construct()
{
echo 'Hello';
}

/**
* Bar getter.
*/
public function getBar() : int
{
return 123;
}

/**
* Very important getter.
*/
public function getBaz() : int
{
return 456;
}
}