1. Go to this page and download the library: Download respect/fluent-analysis 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/ */
respect / fluent-analysis example snippets
$stack = Middleware::cors('*')->rateLimit(100);
// PHPStan knows:
// cors() accepts (string $origin = '*')
// rateLimit() accepts (int $maxRequests = 60)
// getNodes() returns array{Cors, RateLimit}
// $stack is Middleware<array{Cors, RateLimit}>
$stack->getNodes()[0]; // PHPStan infers: Cors
$stack->typo(); // PHPStan error: method not found
$stack->cors(42); // PHPStan error: int given, string expected
$builder = new MiddlewareStack();
$chain = $builder->cors('*')->rateLimit(100)->auth('bearer');
// PHPStan knows: array{Cors, RateLimit, Auth}
$nodes = $chain->getNodes();
// Individual elements are typed
$nodes[0]; // Cors
$nodes[1]; // RateLimit
$nodes[2]; // Auth