ghostwriter/phormat

PHP代码格式化工具

dev-main 2024-09-16 21:36 UTC

This package is auto-updated.

Last update: 2024-09-16 23:40:37 UTC


README

Compliance Supported PHP Version GitHub Sponsors Code Coverage Type Coverage Psalm Level Latest Version on Packagist Downloads

PHP代码格式化工具。

警告

该项目尚未完成,仍在进行中。

安装

您可以通过composer安装此包

composer require ghostwriter/phormat

如果您觉得这个仓库有用,请给它加星标⭐️

您也可以给这个仓库加星标(🌟),以便以后更容易找到。

使用方法

vendor/bin/phormat <path> --dry-run

配置

<?php

declare(strict_types=1);

use Ghostwriter\Phormat\NodeVisitor\PERCSNodeVisitor;
use Ghostwriter\Phormat\PhormatConfig;

/** @var non-empty-string $workingDirectory */
$workingDirectory = \getcwd() ?: __DIR__;

/** @psalm-suppress UncaughtThrowInGlobalScope */
return PhormatConfig::new()
    ->paths($workingDirectory . '/bin', $workingDirectory . '/src', $workingDirectory . '/tests')
    ->skip($workingDirectory . '/.cache', $workingDirectory . '/docs', $workingDirectory . '/vendor')
    ->skipVisitors([
        PERCSNodeVisitor::class => [$workingDirectory . '/tests/Fixture'],
    ]);

致谢

变更日志

请参阅CHANGELOG.md以获取最近更改的更多信息。

许可证

请参阅LICENSE以获取适用于此项目的许可证的更多信息。

安全

请参阅SECURITY.md以获取有关安全披露过程的更多信息。