homebrew-core/Formula/php-cs-fixer.rb

28 lines
787 B
Ruby

class PhpCsFixer < Formula
desc "Tool to automatically fix PHP coding standards issues"
homepage "https://cs.sensiolabs.org/"
url "https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.15.1/php-cs-fixer.phar"
version "2.15.1"
sha256 "8c56b58fd3733f08c160fe60b18536f904f93088954c518b7c0bc96de26c7861"
bottle :unneeded
depends_on "php" if MacOS.version <= :el_capitan
def install
bin.install "php-cs-fixer.phar" => "php-cs-fixer"
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