Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 recent contributor

Users who have contributed to this file recently

38 lines (32 sloc) 1.19 KB
class PhpCodeSniffer < Formula
desc "Check coding standards in PHP, JavaScript and CSS"
homepage "https://github.com/squizlabs/PHP_CodeSniffer/"
url "https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.4.2/phpcs.phar"
sha256 "6966a9d41099caab6fe63728f20ff0dba4c9c5a2b157c735ece98b6367e16942"
bottle :unneeded
resource "phpcbf.phar" do
url "https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.4.2/phpcbf.phar"
sha256 "d7b9b36e92b674ebbaceb1d80cdf1fdd190bc8cfd00e1ce68ed2b712513e4423"
end
def install
bin.install "phpcs.phar" => "phpcs"
resource("phpcbf.phar").stage { bin.install "phpcbf.phar" => "phpcbf" }
end
test do
(testpath/"test.php").write <<~EOS
<?php
/**
* PHP version 5
*
* @category Homebrew
* @package Homebrew_Test
* @author Homebrew <do.not@email.me>
* @license BSD Licence
* @link https://brew.sh/
*/
EOS
assert_match /FOUND 13 ERRORS/, shell_output("#{bin}/phpcs --runtime-set ignore_errors_on_exit true test.php")
assert_match /13 ERRORS WERE FIXED/, shell_output("#{bin}/phpcbf test.php", 1)
system "#{bin}/phpcs", "test.php"
end
end
You can’t perform that action at this time.