35

GitHub - Roave/Dont: Small set of defensive programming utilities/traits for PHP

 5 years ago
source link: https://github.com/Roave/Dont
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

README.md

Don't

roave/dont is a small PHP package aimed at enforcing good practices when it comes to designing defensive code.

Build Status Scrutinizer Code Quality Code Coverage Packagist Packagist

Installation

composer require roave/dont

Usage

The package currently provides seven traits:

  • Dont\DontDeserialise
  • Dont\DontSerialize
  • Dont\DontClone
  • Dont\DontGet
  • Dont\DontSet
  • Dont\DontCall
  • Dont\DontCallStatic

Usage is straightforward:

use Dont\DontSerialise;

class MyClass
{
    use DontSerialise;
}

serialize(new MyClass); // will throw an exception

The same applies to DontDeserialise, but this time with unserialize().


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK