← All results

int-range<0, 255> (Phan spelling)

Group: Advanced PHPDoc types · Category: ecosystem · File: phpdoc_advanced_int_range_keyword.php

Phan writes integer ranges as int-range<min, max>, while PHPStan, Psalm and Mago use int<min, max>. Each side enforces its own spelling and does not recognize the other, so this records who models the hyphenated keyword. References: - Phan Type.php int-range<min, max> resolves to IntRangeType

Analyzer results

AnalyzerVersionResultDiagnostics
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_int_range_keyword.php:30: Argument 1 ($value) is 256 of type int (value: 256) but \Conformance\Tests\PhpdocAdvancedIntRangeKeyword\acceptsByte() takes int-range<0, 255> defined at /Users/megurine/repo/php/php-typing-conformance/conformance/tests/phpdoc_advanced_int_range_keyword.php:21 [PhanTypeMismatchArgument]
  • Recognition: spelling resolved
  • Enforcement: 1/1 of the expected violations reported
phpstan 2.2.8PHPStan - PHP Static Analysis Tool 2.2.8 Unrecognized
phpdoc_advanced_int_range_keyword.php:21: Function Conformance\Tests\PhpdocAdvancedIntRangeKeyword\acceptsByte() has parameter $value with no type specified. [identifier=missingType.parameter] [reported-from-level=6]
phpdoc_advanced_int_range_keyword.php:21: PHPDoc tag @param for parameter $value contains unresolvable type. [identifier=parameter.unresolvableType] [reported-from-level=2]
With strict-rules
phpdoc_advanced_int_range_keyword.php:21: Function Conformance\Tests\PhpdocAdvancedIntRangeKeyword\acceptsByte() has parameter $value with no type specified. [identifier=missingType.parameter]
phpdoc_advanced_int_range_keyword.php:21: PHPDoc tag @param for parameter $value contains unresolvable type. [identifier=parameter.unresolvableType]
  • Recognition: spelling not resolved — reported on declaration line(s) 21
  • Enforcement: 0/1 of the expected violations reported — incidental, since the spelling was not resolved

Notes: `int-range<min,max>` is Phan's spelling; PHPStan, Psalm and Mago write the same range as `int<min,max>`. Not recognizing the other tool's spelling is expected, not a defect. Only Phan models `int-range`.

psalm 6.16.1Psalm 6.16.1@f1f5de594dc76faf8784e02d3dc4716c91c6f6ac
next: 7.0.0-beta19
Unrecognized (pzoom≠)
phpdoc_advanced_int_range_keyword.php:19: Docblock-defined class, interface or enum named Conformance\Tests\PhpdocAdvancedIntRangeKeyword\int-range does not exist [UndefinedDocblockClass]
phpdoc_advanced_int_range_keyword.php:26: Argument 1 of Conformance\Tests\PhpdocAdvancedIntRangeKeyword\acceptsByte expects Conformance\Tests\PhpdocAdvancedIntRangeKeyword\int-range<0, 255>, but 200 provided [InvalidArgument]
phpdoc_advanced_int_range_keyword.php:30: Argument 1 of Conformance\Tests\PhpdocAdvancedIntRangeKeyword\acceptsByte expects Conformance\Tests\PhpdocAdvancedIntRangeKeyword\int-range<0, 255>, but 256 provided [InvalidArgument]
pzoom (Psalm port)
phpdoc_advanced_int_range_keyword.php:21: Invalid docblock type [InvalidDocblock]
phpdoc_advanced_int_range_keyword.php:21: Argument $value of Conformance\Tests\PhpdocAdvancedIntRangeKeyword\acceptsByte does not have a type [MissingParamType]
  • Recognition: spelling not resolved — reported on declaration line(s) 19
  • Enforcement: 1/1 of the expected violations reported — incidental, since the spelling was not resolved
Expectation diff
Line 26: Expected valid value to be accepted, got ["Argument 1 of Conformance\\Tests\\PhpdocAdvancedIntRangeKeyword\\acceptsByte expects Conformance\\Tests\\PhpdocAdvancedIntRangeKeyword\\int-range<0, 255>, but 200 provided [InvalidArgument]"]

Notes: `int-range<min,max>` is Phan's spelling; PHPStan, Psalm and Mago write the same range as `int<min,max>`. Not recognizing the other tool's spelling is expected, not a defect. Only Phan models `int-range`.

mago 1.46.0mago 1.46.0 Unrecognized
phpdoc_advanced_int_range_keyword.php:19: Cannot find class, interface, enum, or type alias `Conformance\Tests\PhpdocAdvancedIntRangeKeyword\int-range`. [non-existent-class-like]
phpdoc_advanced_int_range_keyword.php:26: Invalid argument type for argument #1 of `Conformance\Tests\PhpdocAdvancedIntRangeKeyword\acceptsByte`: expected `unknown-ref(Conformance\Tests\PhpdocAdvancedIntRangeKeyword\int-range)`, but found `int(200)`. [invalid-argument]
phpdoc_advanced_int_range_keyword.php:30: Invalid argument type for argument #1 of `Conformance\Tests\PhpdocAdvancedIntRangeKeyword\acceptsByte`: expected `unknown-ref(Conformance\Tests\PhpdocAdvancedIntRangeKeyword\int-range)`, but found `int(256)`. [invalid-argument]
  • Recognition: spelling not resolved — reported on declaration line(s) 19
  • Enforcement: 1/1 of the expected violations reported — incidental, since the spelling was not resolved
Expectation diff
Line 26: Expected valid value to be accepted, got ["Invalid argument type for argument #1 of `Conformance\\Tests\\PhpdocAdvancedIntRangeKeyword\\acceptsByte`: expected `unknown-ref(Conformance\\Tests\\PhpdocAdvancedIntRangeKeyword\\int-range)`, but found `int(200)`. [invalid-argument]"]

Notes: `int-range<min,max>` is Phan's spelling; PHPStan, Psalm and Mago write the same range as `int<min,max>`. Not recognizing the other tool's spelling is expected, not a defect. Only Phan models `int-range`.

mir 0.70.1mir 0.70.1 Incidental (1/1)
phpdoc_advanced_int_range_keyword.php:26: InvalidArgument: Argument $value of acceptsByte() expects 'Conformance\Tests\PhpdocAdvancedIntRangeKeyword\int-range<0, 255>', got '200' [MIR0201]
phpdoc_advanced_int_range_keyword.php:30: InvalidArgument: Argument $value of acceptsByte() expects 'Conformance\Tests\PhpdocAdvancedIntRangeKeyword\int-range<0, 255>', got '256' [MIR0201]
  • Recognition: spelling resolved
  • Enforcement: 1/1 of the expected violations reported — incidental, since values the type admits were also rejected on line(s) 26
Expectation diff
Line 26: Expected valid value to be accepted, got ["InvalidArgument: Argument $value of acceptsByte() expects 'Conformance\\Tests\\PhpdocAdvancedIntRangeKeyword\\int-range<0, 255>', got '200' [MIR0201]"]

Notes: `int-range<min,max>` is Phan's spelling; PHPStan, Psalm and Mago write the same range as `int<min,max>`. Not recognizing the other tool's spelling is expected, not a defect. Only Phan models `int-range`.

phpantom 0.9.0phpantom_lsp 0.9.0 Unrecognized
phpdoc_advanced_int_range_keyword.php:19: Class 'Conformance\Tests\PhpdocAdvancedIntRangeKeyword\int-range<0, 255>' not found [unknown_class]
  • Recognition: spelling not resolved — reported on declaration line(s) 19
  • Enforcement: 0/1 of the expected violations reported — incidental, since the spelling was not resolved
intelephense 1.18.5intelephense 1.18.5 Widened to int

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: 0/1 of the expected violations reported
phpy 0.2.0phpy 0.2.0 Unrecognized
phpdoc_advanced_int_range_keyword.php:19: Use of unknown class: 'Conformance\Tests\PhpdocAdvancedIntRangeKeyword\int-range'
phpdoc_advanced_int_range_keyword.php:26: Argument '1' passed to Conformance\Tests\PhpdocAdvancedIntRangeKeyword\acceptsByte() is expected to be of type Conformance\Tests\PhpdocAdvancedIntRangeKeyword\int-range, int given
phpdoc_advanced_int_range_keyword.php:30: Argument '1' passed to Conformance\Tests\PhpdocAdvancedIntRangeKeyword\acceptsByte() is expected to be of type Conformance\Tests\PhpdocAdvancedIntRangeKeyword\int-range, int given
  • Recognition: spelling not resolved — reported on declaration line(s) 19
  • Enforcement: 1/1 of the expected violations reported — incidental, since the spelling was not resolved
Expectation diff
Line 26: Expected valid value to be accepted, got ["Argument '1' passed to Conformance\\Tests\\PhpdocAdvancedIntRangeKeyword\\acceptsByte() is expected to be of type Conformance\\Tests\\PhpdocAdvancedIntRangeKeyword\\int-range, int given"]
qodana 262.8665.325Qodana 262.8665.325 Unrecognized
phpdoc_advanced_int_range_keyword.php:19: Undefined class 'int-range' [PhpUndefinedClassInspection]
phpdoc_advanced_int_range_keyword.php:26: Parameter '200' type is not compatible with declaration [PhpParamsInspection]
phpdoc_advanced_int_range_keyword.php:30: Parameter '256' type is not compatible with declaration [PhpParamsInspection]
  • Recognition: spelling not resolved — reported on declaration line(s) 19
  • Enforcement: 1/1 of the expected violations reported — incidental, since the spelling was not resolved
Expectation diff
Line 26: Expected valid value to be accepted, got ["Parameter '200' 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 Widened to int

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: 0/1 of the expected violations reported
steins 0.1.5steins 0.1.5 (2026-08-12 revision 39b4cc1) Enforced
phpdoc_advanced_int_range_keyword.php:30: argument 256 to acceptsByte() violates declared @param int-range<0, 255> $value — declared contract violation [phpdoc.param-mismatch]
  • Recognition: spelling resolved
  • Enforcement: 1/1 of the expected violations reported
phpstan-strict 2.2.8PHPStan - PHP Static Analysis Tool 2.2.8 Unrecognized
phpdoc_advanced_int_range_keyword.php:21: Function Conformance\Tests\PhpdocAdvancedIntRangeKeyword\acceptsByte() has parameter $value with no type specified. [identifier=missingType.parameter]
phpdoc_advanced_int_range_keyword.php:21: PHPDoc tag @param for parameter $value contains unresolvable type. [identifier=parameter.unresolvableType]
  • Recognition: spelling not resolved — reported on declaration line(s) 21
  • Enforcement: 0/1 of the expected violations reported — incidental, since the spelling was not resolved
psalm-next 7.0.0-beta19Psalm 7.0.0-beta19@7e751c06a756fa64dc4c759c09fe4a173afcb433 Unrecognized
phpdoc_advanced_int_range_keyword.php:19: Docblock-defined class, interface or enum named Conformance\Tests\PhpdocAdvancedIntRangeKeyword\int-range does not exist [UndefinedDocblockClass]
phpdoc_advanced_int_range_keyword.php:26: Argument 1 of Conformance\Tests\PhpdocAdvancedIntRangeKeyword\acceptsByte expects Conformance\Tests\PhpdocAdvancedIntRangeKeyword\int-range<0, 255>, but 200 provided [InvalidArgument]
phpdoc_advanced_int_range_keyword.php:30: Argument 1 of Conformance\Tests\PhpdocAdvancedIntRangeKeyword\acceptsByte expects Conformance\Tests\PhpdocAdvancedIntRangeKeyword\int-range<0, 255>, but 256 provided [InvalidArgument]
  • Recognition: spelling not resolved — reported on declaration line(s) 19
  • Enforcement: 1/1 of the expected violations reported — incidental, since the spelling was not resolved
Expectation diff
Line 26: Expected valid value to be accepted, got ["Argument 1 of Conformance\\Tests\\PhpdocAdvancedIntRangeKeyword\\acceptsByte expects Conformance\\Tests\\PhpdocAdvancedIntRangeKeyword\\int-range<0, 255>, but 200 provided [InvalidArgument]"]

Notes: `int-range<min,max>` is Phan's spelling; PHPStan, Psalm and Mago write the same range as `int<min,max>`. Not recognizing the other tool's spelling is expected, not a defect. Only Phan models `int-range`.

Source

<?php

declare(strict_types=1);

namespace Conformance\Tests\PhpdocAdvancedIntRangeKeyword;

/**
 * `int-range<0, 255>` (Phan spelling)
 *
 * Phan writes integer ranges as `int-range<min, max>`, while PHPStan, Psalm and
 * Mago use `int<min, max>`. Each side enforces its own spelling and does not
 * recognize the other, so this records who models the hyphenated keyword.
 *
 * References:
 * - Phan Type.php `int-range<min, max>` resolves to IntRangeType
 */

/**
 * @param int-range<0, 255> $value
 */
function acceptsByte($value): void // T: int-range<0, 255>
{
}

// An in-range literal satisfies the parameter for analyzers that model it.
acceptsByte(200); // V

// An out-of-range literal: analyzers that model `int-range` reject it, others
// do not recognize the keyword.
acceptsByte(256); // E?: 256 is above the int-range<0, 255> bounds