PHP code example of ghostwriter / psalm-plugin-tester
1. Go to this page and download the library: Download ghostwriter/psalm-plugin-tester 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/ */
ghostwriter / psalm-plugin-tester example snippets
declare(strict_types=1);
namespace Vendor\PackageTests\Unit;
use Ghostwriter\PsalmSandbox\AbstractPsalmSandboxTestCase;
use Psalm\Issue\CodeIssue;
use Psalm\Issue\MissingReturnType;
use Psalm\Plugin\PluginEntryPointInterface;
use Vendor\Package\ExamplePlugin;
final class ExamplePluginTest extends AbstractPsalmSandboxTestCase
{
/**
* @var class-string<PluginEntryPointInterface>
*/
public const PLUGINS = [ExamplePlugin::class];
/**
* @var array<class-string<CodeIssue>>
*/
public const ISSUES = [MissingReturnType::class];
}
declare(strict_types=1);
namespace Vendor\PackageTests\Fixture\MissingReturnType;
final class FixMissingReturnType
{
public function fixMissingReturnType()
{
}
}
declare(strict_types=1);
namespace Vendor\PackageTests\Fixture\MissingReturnType;
final class ReportMissingReturnType
{
public function reportMissingReturnType()
{
}
}
declare(strict_types=1);
namespace Vendor\PackageTests\Fixture\MissingReturnType;
final class SuppressMissingReturnType
{
/**
* @psalm-suppress MissingReturnType
*/
public function suppressMissingReturnType()
{
}
}