PHPackages                             phpunitgoodpractices/traits - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. phpunitgoodpractices/traits

AbandonedArchivedLibrary[Testing &amp; Quality](/categories/testing)

phpunitgoodpractices/traits
===========================

Highly opinionated PHPUnit good practices enforcer.

v1.9.2(3y ago)22299.1k↑131%1[3 issues](https://github.com/PHPUnitGoodPractices/Traits/issues)[1 PRs](https://github.com/PHPUnitGoodPractices/Traits/pulls)6MITPHPPHP ^5.5 || ^7.0 || ^8.0

Since Nov 30Pushed 2y ago1 watchersCompare

[ Source](https://github.com/PHPUnitGoodPractices/Traits)[ Packagist](https://packagist.org/packages/phpunitgoodpractices/traits)[ RSS](/packages/phpunitgoodpractices-traits/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (4)Versions (19)Used By (6)

❗ THIS PACKAGE IS DEPRECATED ❗
==============================

[](#-this-package-is-deprecated-)

With great shape of PHPUnit itself and Static Code Analysers supporting it, this package is no longer needed.

PHPUnit Good Practices
======================

[](#phpunit-good-practices)

Highly opinionated PHPUnit good practices enforcer.

Available traits
----------------

[](#available-traits)

### ExpectationViaCodeOverAnnotationTrait

[](#expectationviacodeoverannotationtrait)

Expected exception shall be set up via code, not annotations.

### ExpectOverSetExceptionTrait

[](#expectoversetexceptiontrait)

Expectation shall be set directly over via setter.

### IdentityOverEqualityTrait

[](#identityoverequalitytrait)

Identity assertion (`===`) shall be used over equality ones (`==`).

### ProphecyOverMockObjectTrait

[](#prophecyovermockobjecttrait)

Prophecy shall be used over Mock Objects.

### ProphesizeOnlyInterfaceTrait

[](#prophesizeonlyinterfacetrait)

Prophecy shall be created only for (existing) interfaces.

Example usage
-------------

[](#example-usage)

```
