37 lines
991 B
Ruby
37 lines
991 B
Ruby
class PhpCsFixer < Formula
|
|
desc "Tool to automatically fix PHP coding standards issues"
|
|
homepage "https://cs.symfony.com/"
|
|
url "https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v3.12.0/php-cs-fixer.phar"
|
|
sha256 "9f8682a9bb592bf6d6c54f57fe3906db7f139c20c400024dd4bf8d57194854ae"
|
|
license "MIT"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, all: "62a2f073e1c5b69d83041a3a4f2d4e7e2ddf08f10a1d7c22c495f5ab11465fc9"
|
|
end
|
|
|
|
depends_on "php"
|
|
|
|
def install
|
|
libexec.install "php-cs-fixer.phar"
|
|
|
|
(bin/"php-cs-fixer").write <<~EOS
|
|
#!#{Formula["php"].opt_bin}/php
|
|
<?php require '#{libexec}/php-cs-fixer.phar';
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.php").write <<~EOS
|
|
<?php $this->foo( 'homebrew rox' );
|
|
EOS
|
|
(testpath/"correct_test.php").write <<~EOS
|
|
<?php
|
|
|
|
$this->foo('homebrew rox');
|
|
EOS
|
|
|
|
system "#{bin}/php-cs-fixer", "fix", "test.php"
|
|
assert compare_file("test.php", "correct_test.php")
|
|
end
|
|
end
|