non-null-mixed is a Phan-only refinement of mixednon-null-mixed is mixed with null excluded. Phan models it; other
analyzers do not recognize the keyword and fall back to plain mixed, so
they accept a null argument that Phan rejects.
References:
- Phan Type/NonNullMixedType.php (non-null-mixed)| Analyzer | Version | Result | Diagnostics |
|---|---|---|---|
| phan | 6.0.7Phan 6.0.7 php-ast version 1.1.3 PHP version used to run Phan: 8.5.9 | Enforced | phpdoc_advanced_phan_non_null_mixed.php:29: Argument 1 ($value) is null of type null but \Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\acceptsNonNull() takes non-null-mixed (no real type) defined at /Users/megurine/repo/php/php-typing-conformance/conformance/tests/phpdoc_advanced_phan_non_null_mixed.php:21 (the inferred real argument type has nothing in common with the parameter's phpdoc type) [PhanTypeMismatchArgumentProbablyReal]
|
| phpstan | 2.2.8PHPStan - PHP Static Analysis Tool 2.2.8 | Unrecognized | phpdoc_advanced_phan_non_null_mixed.php:21: Function Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\acceptsNonNull() has parameter $value with no type specified. [identifier=missingType.parameter] [reported-from-level=6] phpdoc_advanced_phan_non_null_mixed.php:21: PHPDoc tag @param for parameter $value contains unresolvable type. [identifier=parameter.unresolvableType] [reported-from-level=2] With strict-rulesphpdoc_advanced_phan_non_null_mixed.php:21: Function Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\acceptsNonNull() has parameter $value with no type specified. [identifier=missingType.parameter] phpdoc_advanced_phan_non_null_mixed.php:21: PHPDoc tag @param for parameter $value contains unresolvable type. [identifier=parameter.unresolvableType]
|
| psalm | 6.16.1Psalm 6.16.1@f1f5de594dc76faf8784e02d3dc4716c91c6f6ac next: 7.0.0-beta19 |
Unrecognized (pzoom≠) | phpdoc_advanced_phan_non_null_mixed.php:19: Unrecognized type Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\non-null-mixed in docblock for Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\acceptsNonNull [InvalidDocblock] phpdoc_advanced_phan_non_null_mixed.php:21: Parameter $value has no provided type [MissingParamType] pzoom (Psalm port)phpdoc_advanced_phan_non_null_mixed.php:21: Invalid docblock type [InvalidDocblock] phpdoc_advanced_phan_non_null_mixed.php:21: Argument $value of Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\acceptsNonNull does not have a type [MissingParamType]
|
| mago | 1.46.0mago 1.46.0 | Unrecognized | phpdoc_advanced_phan_non_null_mixed.php:19: Cannot find class, interface, enum, or type alias `Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\non-null-mixed`. [non-existent-class-like] phpdoc_advanced_phan_non_null_mixed.php:26: Invalid argument type for argument #1 of `Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\acceptsNonNull`: expected `unknown-ref(Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\non-null-mixed)`, but found `int(5)`. [invalid-argument] phpdoc_advanced_phan_non_null_mixed.php:29: Argument #1 of function `Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\acceptsNonNull` is `null`, but parameter type `unknown-ref(Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\non-null-mixed)` does not accept it. [null-argument]
Expectation diffLine 26: Expected valid value to be accepted, got ["Invalid argument type for argument #1 of `Conformance\\Tests\\PhpdocAdvancedPhanNonNullMixed\\acceptsNonNull`: expected `unknown-ref(Conformance\\Tests\\PhpdocAdvancedPhanNonNullMixed\\non-null-mixed)`, but found `int(5)`. [invalid-argument]"] |
| mir | 0.70.1mir 0.70.1 | Incidental (1/1) | phpdoc_advanced_phan_non_null_mixed.php:26: InvalidArgument: Argument $value of acceptsNonNull() expects 'Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\non-null-mixed', got '5' [MIR0201] phpdoc_advanced_phan_non_null_mixed.php:29: NullArgument: Argument $value of acceptsNonNull() cannot be null [MIR0100]
Expectation diffLine 26: Expected valid value to be accepted, got ["InvalidArgument: Argument $value of acceptsNonNull() expects 'Conformance\\Tests\\PhpdocAdvancedPhanNonNullMixed\\non-null-mixed', got '5' [MIR0201]"] |
| phpantom | 0.9.0phpantom_lsp 0.9.0 | Unrecognized | phpdoc_advanced_phan_non_null_mixed.php:19: Class 'Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\non-null-mixed' not found [unknown_class]
|
| intelephense | 1.18.5intelephense 1.18.5 | Not enforced | No diagnostics reported.
|
| phpy | 0.2.0phpy 0.2.0 | Unrecognized | phpdoc_advanced_phan_non_null_mixed.php:19: Use of unknown class: 'Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\non-null-mixed' phpdoc_advanced_phan_non_null_mixed.php:26: Argument '1' passed to Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\acceptsNonNull() is expected to be of type Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\non-null-mixed, int given phpdoc_advanced_phan_non_null_mixed.php:29: Argument '1' passed to Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\acceptsNonNull() is expected to be of type Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\non-null-mixed, null given
Expectation diffLine 26: Expected valid value to be accepted, got ["Argument '1' passed to Conformance\\Tests\\PhpdocAdvancedPhanNonNullMixed\\acceptsNonNull() is expected to be of type Conformance\\Tests\\PhpdocAdvancedPhanNonNullMixed\\non-null-mixed, int given"] |
| qodana | 262.8665.325Qodana 262.8665.325 | Unrecognized | phpdoc_advanced_phan_non_null_mixed.php:19: Undefined class 'non-null-mixed' [PhpUndefinedClassInspection] phpdoc_advanced_phan_non_null_mixed.php:26: Parameter '5' type is not compatible with declaration [PhpParamsInspection] phpdoc_advanced_phan_non_null_mixed.php:29: Parameter 'null' type is not compatible with declaration [PhpParamsInspection]
Expectation diffLine 26: Expected valid value to be accepted, got ["Parameter '5' type is not compatible with declaration [PhpParamsInspection]"] |
| noverify | 0.5.5NoVerify, version 0.5.5: built on: 2025.04.22 14:36:46 OS: r-kuchinskas arm64 Commit: 4774b82f8adc53fbef38f95e97af4b953b4d1529 | Not enforced ⚠ 1 false positive | phpdoc_advanced_phan_non_null_mixed.php:12: Class or interface named \Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\non-null-mixed does not exist [undefinedClass]
Expectation diffLine 12: Unexpected errors ["Class or interface named \\Conformance\\Tests\\PhpdocAdvancedPhanNonNullMixed\\non-null-mixed does not exist [undefinedClass]"] |
| steins | 0.1.5steins 0.1.5 (2026-08-12 revision 39b4cc1) | Enforced | phpdoc_advanced_phan_non_null_mixed.php:29: argument null to acceptsNonNull() violates declared @param non-null-mixed $value — declared contract violation [phpdoc.param-mismatch]
|
| phpstan-strict | 2.2.8PHPStan - PHP Static Analysis Tool 2.2.8 | Unrecognized | phpdoc_advanced_phan_non_null_mixed.php:21: Function Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\acceptsNonNull() has parameter $value with no type specified. [identifier=missingType.parameter] phpdoc_advanced_phan_non_null_mixed.php:21: PHPDoc tag @param for parameter $value contains unresolvable type. [identifier=parameter.unresolvableType]
|
| psalm-next | 7.0.0-beta19Psalm 7.0.0-beta19@7e751c06a756fa64dc4c759c09fe4a173afcb433 | Unrecognized | phpdoc_advanced_phan_non_null_mixed.php:19: Unrecognized type Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\non-null-mixed in docblock for Conformance\Tests\PhpdocAdvancedPhanNonNullMixed\acceptsNonNull [InvalidDocblock] phpdoc_advanced_phan_non_null_mixed.php:21: Parameter $value has no provided type [MissingParamType]
|
<?php
declare(strict_types=1);
namespace Conformance\Tests\PhpdocAdvancedPhanNonNullMixed;
/**
* `non-null-mixed` is a Phan-only refinement of `mixed`.
*
* `non-null-mixed` is `mixed` with `null` excluded. Phan models it; other
* analyzers do not recognize the keyword and fall back to plain `mixed`, so
* they accept a null argument that Phan rejects.
*
* References:
* - Phan Type/NonNullMixedType.php (`non-null-mixed`)
*/
/**
* @param non-null-mixed $value
*/
function acceptsNonNull($value): void // T: non-null-mixed
{
}
// Any non-null value satisfies the parameter.
acceptsNonNull(5); // V
// Null is excluded for analyzers that model it; others fall back to `mixed`.
acceptsNonNull(null); // E?: null is excluded from non-null-mixed