PHP Static Analyzer Comparison

wip

Comparison #0004

Source Document

<?php

class A {
    private function __construct()
    {
    }
}

$a = new A();

Analyses

phan-strict

Line Column Details
9 [error] PhanAccessMethodPrivate
Cannot access private method \A::__construct defined at samples/0004.php:4

phan-loose

Line Column Details
9 [error] PhanAccessMethodPrivate
Cannot access private method \A::__construct defined at samples/0004.php:4

phpstan-strict

Line Column Details
9 1 [error] new.privateConstructor
Cannot instantiate class A via private constructor A::__construct().

phpstan-loose

Line Column Details
9 1 [error] new.privateConstructor
Cannot instantiate class A via private constructor A::__construct().

psalm-strict

Line Column Details
3 7 [error] n/a
ClassMustBeFinal: Class A is never extended and is not part of the public API, and thus must be made final.
9 1 [error] n/a
UnusedVariable: $a is never referenced or the value is not used
9 6 [error] n/a
InaccessibleMethod: Cannot access private method A::__construct from context

psalm-loose

Line Column Details
9 1 [error] n/a
UnusedVariable: $a is never referenced or the value is not used
9 6 [error] n/a
InaccessibleMethod: Cannot access private method A::__construct from context