PHP code example of klimick / psalm-show-type

1. Go to this page and download the library: Download klimick/psalm-show-type 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/ */

    

klimick / psalm-show-type example snippets




// With assignment:
/** @show-type */
$a = 42;

// With return statement (not supported by @psalm-trace):
$fn = function(): array {
    /** @show-type */
    return [
        'value' => 42,
    ];
};

// Type from arrow fn expression (not supported by @psalm-trace):
$arrowFn = fn() => /** @show-type */ str_contains('psalm-show-type', 'show-type');

@show-type: array{
    prop1: Str,
    prop2: SplDoublyLinkedList<TKey: int, TValue: Str>,
}

@show-type: callable(Num): array{
    prop1: Str,
    prop2: SplDoublyLinkedList<TKey: int, TValue: Str>,
}