92acf560c2
Closes #45437. Signed-off-by: FX Coudert <fxcoudert@gmail.com>
37 lines
1.2 KiB
Ruby
37 lines
1.2 KiB
Ruby
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.5.1/phpcs.phar"
|
|
sha256 "c7d6fb8fe15602700ccfb4ec6f2e3ed65895ce7dba1c0bb4ec26c894dafb1218"
|
|
|
|
bottle :unneeded
|
|
|
|
resource "phpcbf.phar" do
|
|
url "https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.5.1/phpcbf.phar"
|
|
sha256 "19487d15889c900474d989b2754f3eeaffa8d19c12e032b7d0a68cb75b65c8ac"
|
|
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
|