1b68077748
Closes #44312. Signed-off-by: FX Coudert <fxcoudert@gmail.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.7.0/phpmd.phar"
|
|
sha256 "06dca1d8d77eadde31ddb3e60299a1e53363039e94bd691c3e23639f5f4730b0"
|
|
|
|
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
|