Symplify/CodingStandardに追加されたFixerたちを軽く紹介する。
PrivateMethodOrderByUseFixer
v5.2.0
privateメソッドの定義の順番を、使われている順に合わせるよ。
class SomeClass
{
public function run()
{
$this->call1();
$this->call2();
}
$this->call2();
}
- private function call2()
+ private function call1()
{
}
- private function call1()
+ private function call2()
{
}
}
PropertyOrderByComplexityFixer
v5.2.0
プロパティを可視性(public
→private
)で並び替えたあとに、型の複雑さ(プリミティブ→クラス)でも並び替えするよ。
class SomeClass
{
- /** @var DateTime */
- private $date;
/** @var string */
private $name;
+ /** @var int */
+ private $price;
+ /** @var DateTime */
+ private $date;
/** @var Service */
private $service;
-
- /** @var int */
- private $price;
}
ParamReturnAndVarTagMalformsFixer
v5.2.11
phpdocの@param
、@return
、@var
の表記ゆれをなくすよ。
/**
- * @param $name string
- * @return int $value
+ * @param string $name
+ * @return int
*/
function someFunction($name)
{
}
class SomeClass
{
/**
- * @var int $property
+ * @var int
*/
private $property;
}
-/* @var int $value */
+/** @var int $value */
$value = 5;
-/** @var $value int */
+/** @var int $value */
$value = 5;