Recommend this page to a friend!
  Classes of DeGraciaMathieu  >  Freeze My PHP Scalar Types  >  >  Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Freeze My PHP Scalar Types
Implements scalar type values that work in PHP 5
Author: By
Last change:
Date: 2 years ago
Size: 2,446 bytes


Class file image Download

<p align="center"> <img src="" width="300"> </p> <p align="center"> <a href=";utm_medium=referral&amp;utm_content=DeGraciaMathieu/FreezeMyScalar&amp;utm_campaign=Badge_Grade"><img src=""/></a> <a href=""><img src="" alt="Scrutinizer Code Quality"></a> <a href=""><img src="" alt="Build Status"></a> <a href=""><img src="" alt="Code Coverage"></a> <a href=""><img src="" alt="Latest Version on Packagist"></a> <a href=''><img src='' /></a> </p>


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 \\_(?)_/


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

composer require degraciamathieu/freezemyscalar


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

For more information send a message to info at phpclasses dot org.