PHP code example of orklah / psalm-strict-visibility

1. Go to this page and download the library: Download orklah/psalm-strict-visibility library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

orklah / psalm-strict-visibility example snippets


class PrivateTests{
    private string $secret;

    private function privateMethod(): void {echo $this->secret;}

    public function __construct(string $secret){
        $this->secret = $secret;
    }

    public function proxyByParam(PrivateTests $a): void {
        $a->privateMethod(); //This is a call to a private method from outside the instance
    }
}

$first_secret_key = new PrivateTests('first_secret_key');
$second_secret_key = new PrivateTests('second_secret_key');

$first_secret_key->proxyByParam($second_secret_key);