degraciamathieu / freezemyscalar
v0.1
2019-02-05 21:50 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- mockery/mockery: ^0.9.9
- phpunit/phpunit: ^5.7
This package is auto-updated.
Last update: 2024-11-07 00:12:44 UTC
README
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