PHPackages                             orklah/psalm-strict-visibility - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. orklah/psalm-strict-visibility

ActivePsalm-plugin[Testing &amp; Quality](/categories/testing)

orklah/psalm-strict-visibility
==============================

A Psalm plugin to detect calling private or protected method via proxy

v3.0.0(5y ago)8101.8k↓38.8%[1 issues](https://github.com/orklah/psalm-strict-visibility/issues)2MITPHPPHP ^7.1|^8.0

Since Mar 8Pushed 4y ago2 watchersCompare

[ Source](https://github.com/orklah/psalm-strict-visibility)[ Packagist](https://packagist.org/packages/orklah/psalm-strict-visibility)[ RSS](/packages/orklah-psalm-strict-visibility/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (6)Used By (2)

psalm-strict-visibility
=======================

[](#psalm-strict-visibility)

A [Psalm](https://github.com/vimeo/psalm) plugin to detect calling private or protected method via proxy

Installation:

```
$ composer require --dev orklah/psalm-strict-visibility
$ vendor/bin/psalm-plugin enable orklah/psalm-strict-visibility
```

Usage:

Run your usual Psalm command:

```
$ vendor/bin/psalm
```

Explanation:

Visibilities in PHP are not strongly enforced. According to [php.net](https://www.php.net/manual/en/language.oop5.visibility.php):

> Objects of the same type will have access to each others private and protected members even though they are not the same instances. This is because the implementation specific details are already known when inside those objects.

This means that a private method is not actually private when called from another instance of the same object. This sort of behavior is possible:

```
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);
```

This call to $first\_secret\_key instance will actually call a private method on $second\_secret\_key and display the value of the private attribute of $second\_secret\_key

This plugins intends to fill those holes in PHP visibility checks

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~91 days

Total

5

Last Release

1898d ago

Major Versions

v1.0.0 → v2.0.02020-11-23

v2.0.2 → v3.0.02021-03-08

PHP version history (2 changes)v1.0.0PHP ^7.1

v2.0.2PHP ^7.1|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/e260f2252ede6d70aea471f0c0e0b0cf81f48c2edc3b22ff08abe1a74316fcca?d=identicon)[orklah](/maintainers/orklah)

---

Top Contributors

[![orklah](https://avatars.githubusercontent.com/u/9605520?v=4)](https://github.com/orklah "orklah (31 commits)")

###  Code Quality

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/orklah-psalm-strict-visibility/health.svg)

```
[![Health](https://phpackages.com/badges/orklah-psalm-strict-visibility/health.svg)](https://phpackages.com/packages/orklah-psalm-strict-visibility)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[phpspec/phpspec

Specification-oriented BDD framework for PHP 7.1+

1.9k36.7M3.1k](/packages/phpspec-phpspec)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
