PHP code example of degraciamathieu / freezemyscalar

1. Go to this page and download the library: Download degraciamathieu/freezemyscalar library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

degraciamathieu / freezemyscalar example snippets


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

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

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

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



use DeGraciaMathieu\FreezeMyScalar\FreezeString;

$scalar = new FreezeString('qsdqsdq');
$scalar->content(); // 'qsdqsdq'



use DeGraciaMathieu\FreezeMyScalar\FreezeInteger;

$scalar = new FreezeInteger(10);
$scalar->content(); // 10



use DeGraciaMathieu\FreezeMyScalar\FreezeString;

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