b82a744157
Closes #41850. Signed-off-by: Chongyu Zhu <i@lembacon.com>
26 lines
736 B
Ruby
26 lines
736 B
Ruby
class Phpmd < Formula
|
|
desc "PHP Mess Detector"
|
|
homepage "https://phpmd.org"
|
|
url "https://github.com/phpmd/phpmd/releases/download/2.6.1/phpmd.phar"
|
|
sha256 "c09b188a7b0a86b42ddc11bd73292ba5aafd4ffbc868466dba325acae3e58b2a"
|
|
|
|
bottle :unneeded
|
|
|
|
def install
|
|
bin.install "phpmd.phar" => "phpmd"
|
|
end
|
|
|
|
test do
|
|
(testpath/"src/HelloWorld/Greetings.php").write <<~EOS
|
|
<?php
|
|
namespace HelloWorld;
|
|
class Greetings {
|
|
public static function sayHelloWorld($name) {
|
|
return 'HelloHomebrew';
|
|
}
|
|
}
|
|
EOS
|
|
|
|
assert_match /Avoid unused parameters such as '\$name'\.$/, shell_output("#{bin}/phpmd --ignore-violations-on-exit src/HelloWorld/Greetings.php text unusedcode")
|
|
end
|
|
end
|