degraciamathieu/freezemyscalar

v0.1 2019-02-05 21:50 UTC

This package is auto-updated.

Last update: 2024-11-07 00:12:44 UTC


README

Scrutinizer Code Quality Build Status Code Coverage Latest Version on Packagist

DeGraciaMathieu/FreezeMyScalar

If you can not use php7... you can still use this.

class Object {
    public function foo(FreezeString $string) {}
}

(new Object)->foo(new FreezeString('string'));

Instead of this

class Object {
    public function foo($string) {}
}

(new Object)->foo('string');

It's better than nothing ¯\(ツ)

Installation

Run in console below command to download package to your project:

composer require degraciamathieu/freezemyscalar

Usage

require 'vendor\autoload.php';

use DeGraciaMathieu\FreezeMyScalar\FreezeString;

$scalar = new FreezeString('qsdqsdq');
$scalar->content(); // 'qsdqsdq'
require 'vendor\autoload.php';

use DeGraciaMathieu\FreezeMyScalar\FreezeInteger;

$scalar = new FreezeInteger(10);
$scalar->content(); // 10
require 'vendor\autoload.php';

use DeGraciaMathieu\FreezeMyScalar\FreezeString;

new FreezeString(10); 
// throws \DeGraciaMathieu\FreezeMyScalar\Exceptions\UnexpectedValueException