Skip to content
This repository was archived by the owner on Nov 21, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Libero/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<property name="fixable" value="true"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
<rule ref="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming"/>
<rule ref="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming"/>
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses">
<properties>
<property name="psr12Compatible" value="true"/>
Expand Down
18 changes: 18 additions & 0 deletions tests/cases/classes/name-abstract
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---DESCRIPTION---
Forbid Abstract prefix
---FILENAME---
AbstractFoo.php
---CONTENTS---
<?php

declare(strict_types=1);

namespace Vendor;

abstract class AbstractFoo
{
}

---MESSAGES---
7:10 SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousPrefix
---
20 changes: 20 additions & 0 deletions tests/cases/classes/name-exception
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---DESCRIPTION---
Forbid Exception suffix
---FILENAME---
FooException.php
---CONTENTS---
<?php

declare(strict_types=1);

namespace Vendor;

use Exception;

class FooException extends Exception
{
}

---MESSAGES---
9:1 SlevomatCodingStandard.Classes.SuperfluousExceptionNaming.SuperfluousSuffix
---
18 changes: 18 additions & 0 deletions tests/cases/interfaces/name-interface
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---DESCRIPTION---
Forbid Interface suffix

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Interface and Abstract have been in use before and hence are worthy of forbidden. Exception is easy to forbid, but people can just name everything *Problem or *Error so doesn't necessarily have a positive effect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add more rules as we need. Naming will always require a human review.

---FILENAME---
FooInterface.php
---CONTENTS---
<?php

declare(strict_types=1);

namespace Vendor;

interface FooInterface
{
}

---MESSAGES---
7:1 SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix
---