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.11.0/php-cs-fixer.phar"
|
|
sha256 "86748747fb435f5c3fe1257a7da7ef5078382704d02717f029a2af11b516263b"
|
|
license "MIT"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, all: "b761e83a03625e19486789b24bd075ec5e6cc9284427346d385191d5bdeb75ca"
|
|
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
|