It is recommended not to declare more than one property per statement for the sake of code readability and maintainability. Declaring multiple properties in a single statement can make the code harder to understand and debug. It also increases the risk of introducing errors or overlooking specific property assignments.
By declaring one property per statement, developers can easily identify and modify individual properties, improving code clarity and reducing potential mistakes.
<?php
class Foo
{
private $bar = 1, $bar2 = 2;
}
<?php
class Foo
{
private $bar1 = 1;
private $bar2 = 2;
}