1.2.647. Lowered Access Level

A visibility was lowered. While this is a PHP feature, lowering visibility means that the data is now available to more actors than previously set up, and it might yield surprises to part of the code that still rely on the previous visibility.

This applies to all visibility’s structures : class constant, properties and methods.

<?php

class Foo {
    public $publicProperty;
    protected $protectedProperty;
    private $privateProperty;
}

class Bar extends Foo {
    private $publicProperty;
    private $protectedProperty;
    private $privateProperty;   // This one is OK
}
?>

See also Visibility and Understanding the concept of visibility in object oriented php.

1.2.647.1. Suggestions

  • Sync the visibility between the classes

  • Use a different name for the public properties

1.2.647.2. Specs

Short name

Classes/LoweredAccessLevel

Rulesets

All, Class Review, IsExt, IsPHP, IsStub, Suggestions

Exakat since

2.4.2

PHP Version

All

Severity

Critical

Time To Fix

Quick (30 mins)

Precision

Very high

Features

visibility

Available in

Entreprise Edition, Exakat Cloud