PHP code example of orklah / psalm-strict-numeric-cast
1. Go to this page and download the library: Download orklah/psalm-strict-numeric-cast 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/ */
orklah / psalm-strict-numeric-cast example snippets
function a(string $potential_int){
$int = (int) $potential_int;
//...
}
function a(string $potential_int){
if(is_numeric($potential_int)){
$int = (int) $potential_int;
}
else{
//throw
}
//...
}
function a(string $potential_int){
Assert::numeric($potential_int);
$int = (int) $potential_int;
//...
}
/** @psalm-param numeric-string $potential_int */
function a(string $potential_int){
$int = (int) $potential_int;
//...
}