1. Go to this page and download the library: Download aicrion/container-phpstan 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/ */
aicrion / container-phpstan example snippets
$logger = $container->make(LoggerInterface::class);
$logger->nonExistentMethod(); // PHPStan: no error, because $logger is `mixed`
$logger = $container->make(LoggerInterface::class);
// PHPStan now knows $logger is LoggerInterface
$logger->nonExistentMethod(); // PHPStan: Call to undefined method LoggerInterface::nonExistentMethod()
// Class constant -- fully supported
$service = $container->make(PaymentService::class);
// String literal -- fully supported
$service = $container->make('App\PaymentService');
// Dynamic string (variable, concatenation, etc.) -- falls back to the
// declared `mixed` return type, since PHPStan cannot know the value
// at analysis time.
$id = $this->resolveServiceId();
$service = $container->make($id);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.