1.2.519. Has Virtual Property

Virtual properties are properties with hooks, which do not rely on storage, but process values stored somewhere else.

Virtual proeprties are akin to view, in SQL, where columns are calculated on the fly.

<?php

class x {
     // This property doesn't store any data
     private $random {
             get { return rand(0, 10); }
             set { }
     }

     // This property rely on another property
     // here for history reasons
     private $legacy {
             get { return $this->random; }
             set { }
     }

}

?>

1.2.519.1. Connex PHP features

1.2.519.1.1. Specs

Short name

Php/HasVirtualProperty

Rulesets

All

Exakat since

2.6.8

PHP Version

With PHP 8.4 and more recent

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

Very high

Available in

Entreprise Edition, Exakat Cloud