for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Solidifier\Defects;
use Solidifier\Defect;
use PhpParser\PrettyPrinter\Standard;
use PhpParser\Node\Stmt\Property;
class EncapsulationViolation extends Defect
{
private
$propertyName;
$propertyName
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using
class A { var $property; }
the property is implicitly global.
To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.
public function __construct($propertyName, Property $node)
parent::__construct($node);
$this->propertyName = $propertyName;
}
public function getMessage()
return sprintf(
'Both public getter and setter on private property <id>%s</id> is discouraged (encapsulation violation) ',
$this->propertyName
);
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using
the property is implicitly global.
To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.