← All results

positive-float

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

Floats strictly greater than zero. Zero is the interesting probe: it is finite and non-negative, but not positive. +INF is greater than zero, so it satisfies this spelling; finite-float is the one that excludes infinities. Analyzers that model the range reject 0.0; others fall back to plain float and accept it. References: - https://phpstan.org/writing-php-code/phpdoc-types#float-ranges - PHPStan 2.3.6 (phpstan/phpstan-src#6937)

Analyzer results

AnalyzerVersionResultDiagnostics
phan 6.0.11Phan 6.0.11 php-ast version 1.1.3 PHP version used to run Phan: 8.5.12 Unrecognized
phpdoc_advanced_fallback_positive_float.php:22: Saw a token Phan may have failed to parse after '* @return positive-float': after positive, saw '-' [PhanUnextractableAnnotationSuffix]
phpdoc_advanced_fallback_positive_float.php:24: Return type of returnsPositiveFloat() is undeclared type \Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive [PhanUndeclaredTypeReturnType]
phpdoc_advanced_fallback_positive_float.php:26: Returning 1.5 of type float (value: 1.5) but returnsPositiveFloat() is declared to return \Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive (no real type) (the inferred real return type has nothing in common with the declared phpdoc return type) [PhanTypeMismatchReturnProbablyReal]
phpdoc_advanced_fallback_positive_float.php:34: Saw possibly unextractable annotation for a fragment of comment '* @param positive-float $value': after positive, did not see an element name (will guess based on comment order) [PhanUnextractableAnnotationElementName]
phpdoc_advanced_fallback_positive_float.php:34: Saw a token Phan may have failed to parse after '* @param positive-float $value': after positive, saw '-' [PhanUnextractableAnnotationSuffix]
phpdoc_advanced_fallback_positive_float.php:36: Parameter $value has undeclared type \Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive [PhanUndeclaredTypeParameter]
phpdoc_advanced_fallback_positive_float.php:41: Argument 1 ($value) is returnsPositiveFloat() of type \Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive but \Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsFloat() takes float defined at /Users/megurine/repo/php/php-typing-conformance/conformance/tests/phpdoc_advanced_fallback_positive_float.php:29 [PhanTypeMismatchArgument]
phpdoc_advanced_fallback_positive_float.php:44: Argument 1 ($value) is 1.5 of type float (value: 1.5) but \Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat() takes \Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive (no real type) defined at /Users/megurine/repo/php/php-typing-conformance/conformance/tests/phpdoc_advanced_fallback_positive_float.php:36 (the inferred real argument type has nothing in common with the parameter's phpdoc type) [PhanTypeMismatchArgumentProbablyReal]
phpdoc_advanced_fallback_positive_float.php:47: Argument 1 ($value) is INF of type float but \Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat() takes \Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive (no real type) defined at /Users/megurine/repo/php/php-typing-conformance/conformance/tests/phpdoc_advanced_fallback_positive_float.php:36 (the inferred real argument type has nothing in common with the parameter's phpdoc type) [PhanTypeMismatchArgumentProbablyReal]
phpdoc_advanced_fallback_positive_float.php:51: Argument 1 ($value) is 0.0 of type float (value: 0.0) but \Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat() takes \Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive (no real type) defined at /Users/megurine/repo/php/php-typing-conformance/conformance/tests/phpdoc_advanced_fallback_positive_float.php:36 (the inferred real argument type has nothing in common with the parameter's phpdoc type) [PhanTypeMismatchArgumentProbablyReal]
phpdoc_advanced_fallback_positive_float.php:54: Argument 1 ($value) is -1.0 of type float (value: -1.0) but \Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat() takes \Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive (no real type) defined at /Users/megurine/repo/php/php-typing-conformance/conformance/tests/phpdoc_advanced_fallback_positive_float.php:36 (the inferred real argument type has nothing in common with the parameter's phpdoc type) [PhanTypeMismatchArgumentProbablyReal]
  • Recognition: spelling not resolved — reported on declaration line(s) 22, 24, 34, 36
  • Enforcement: 2/2 of the expected violations reported — incidental, since the spelling was not resolved
Expectation diff
Line 26: Expected valid value to be accepted, got ["Returning 1.5 of type float (value: 1.5) but returnsPositiveFloat() is declared to return \\Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\positive (no real type) (the inferred real return type has nothing in common with the declared phpdoc return type) [PhanTypeMismatchReturnProbablyReal]"]
Line 41: Expected valid value to be accepted, got ["Argument 1 ($value) is returnsPositiveFloat() of type \\Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\positive but \\Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\acceptsFloat() takes float defined at /Users/megurine/repo/php/php-typing-conformance/conformance/tests/phpdoc_advanced_fallback_positive_float.php:29 [PhanTypeMismatchArgument]"]
Line 44: Expected valid value to be accepted, got ["Argument 1 ($value) is 1.5 of type float (value: 1.5) but \\Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\acceptsPositiveFloat() takes \\Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\positive (no real type) defined at /Users/megurine/repo/php/php-typing-conformance/conformance/tests/phpdoc_advanced_fallback_positive_float.php:36 (the inferred real argument type has nothing in common with the parameter's phpdoc type) [PhanTypeMismatchArgumentProbablyReal]"]
Line 47: Expected valid value to be accepted, got ["Argument 1 ($value) is INF of type float but \\Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\acceptsPositiveFloat() takes \\Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\positive (no real type) defined at /Users/megurine/repo/php/php-typing-conformance/conformance/tests/phpdoc_advanced_fallback_positive_float.php:36 (the inferred real argument type has nothing in common with the parameter's phpdoc type) [PhanTypeMismatchArgumentProbablyReal]"]
phpstan 2.3.7PHPStan - PHP Static Analysis Tool 2.3.7 Enforced reported Lv.5+
phpdoc_advanced_fallback_positive_float.php:51: Parameter #1 $value of function Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat expects float<5.0E-324, max>, 0.0 given. [reported-from-level=5]
phpdoc_advanced_fallback_positive_float.php:54: Parameter #1 $value of function Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat expects float<5.0E-324, max>, -1.0 given. [reported-from-level=5]
With strict-rules
phpdoc_advanced_fallback_positive_float.php:51: Parameter #1 $value of function Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat expects float<5.0E-324, max>, 0.0 given.
phpdoc_advanced_fallback_positive_float.php:54: Parameter #1 $value of function Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat expects float<5.0E-324, max>, -1.0 given.
  • Recognition: spelling resolved
  • Enforcement: 2/2 of the expected violations reported
phpstan-strict 2.3.7PHPStan - PHP Static Analysis Tool 2.3.7 Enforced
phpdoc_advanced_fallback_positive_float.php:51: Parameter #1 $value of function Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat expects float<5.0E-324, max>, 0.0 given.
phpdoc_advanced_fallback_positive_float.php:54: Parameter #1 $value of function Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat expects float<5.0E-324, max>, -1.0 given.
  • Recognition: spelling resolved
  • Enforcement: 2/2 of the expected violations reported
psalm 6.21.4Psalm 6.21.4@72023213487628df0bc5b2e02d68cbac614b7ef5 Unrecognized (pzoom≠)
phpdoc_advanced_fallback_positive_float.php:24: Unrecognized type Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float in docblock for Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\returnsPositiveFloat [InvalidDocblock]
phpdoc_advanced_fallback_positive_float.php:24: Method Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\returnsPositiveFloat does not have a return type, expecting float(1.5) [MissingReturnType]
phpdoc_advanced_fallback_positive_float.php:34: Unrecognized type Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float in docblock for Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat [InvalidDocblock]
phpdoc_advanced_fallback_positive_float.php:36: Parameter $value has no provided type [MissingParamType]
phpdoc_advanced_fallback_positive_float.php:41: Argument 1 of Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsFloat cannot be mixed, expecting float [MixedArgument]
pzoom (Psalm port)
phpdoc_advanced_fallback_positive_float.php:24: Invalid return docblock type [InvalidDocblock]
phpdoc_advanced_fallback_positive_float.php:24: Function Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\returnsPositiveFloat does not have a return type [MissingReturnType]
phpdoc_advanced_fallback_positive_float.php:36: Invalid docblock type [InvalidDocblock]
phpdoc_advanced_fallback_positive_float.php:36: Argument $value of Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat does not have a type [MissingParamType]
phpdoc_advanced_fallback_positive_float.php:41: Argument 1 of acceptsFloat cannot be mixed, expecting float [MixedArgument]
  • Recognition: spelling not resolved — reported on declaration line(s) 24, 34, 36
  • Enforcement: 0/2 of the expected violations reported — incidental, since the spelling was not resolved
Expectation diff
Line 41: Expected valid value to be accepted, got ["Argument 1 of Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\acceptsFloat cannot be mixed, expecting float [MixedArgument]"]
psalm 7 7.21.0Psalm 7.21.0@1a665f0114bd40cf12ad57a1a82066549d92f1b6 Unrecognized
phpdoc_advanced_fallback_positive_float.php:24: Unrecognized type Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float in docblock for Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\returnsPositiveFloat [InvalidDocblock]
phpdoc_advanced_fallback_positive_float.php:24: Method Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\returnsPositiveFloat does not have a return type, expecting float(1.5) [MissingReturnType]
phpdoc_advanced_fallback_positive_float.php:34: Unrecognized type Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float in docblock for Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat [InvalidDocblock]
phpdoc_advanced_fallback_positive_float.php:36: Parameter $value has no provided type [MissingParamType]
phpdoc_advanced_fallback_positive_float.php:41: Argument 1 of Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsFloat cannot be mixed, expecting float [MixedArgument]
  • Recognition: spelling not resolved — reported on declaration line(s) 24, 34, 36
  • Enforcement: 0/2 of the expected violations reported — incidental, since the spelling was not resolved
Expectation diff
Line 41: Expected valid value to be accepted, got ["Argument 1 of Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\acceptsFloat cannot be mixed, expecting float [MixedArgument]"]
mago 1.61.0mago 1.61.0 Unrecognized ⚠ 6 false positives
phpdoc_advanced_fallback_positive_float.php:23: Cannot find class, interface, enum, or type alias `Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float`. [non-existent-class-like]
phpdoc_advanced_fallback_positive_float.php:27: Invalid return type for function `Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\returnsPositiveFloat`: expected `unknown-ref(Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float)`, but found `float(1.5)`. [invalid-return-statement]
phpdoc_advanced_fallback_positive_float.php:35: Cannot find class, interface, enum, or type alias `Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float`. [non-existent-class-like]
phpdoc_advanced_fallback_positive_float.php:42: Invalid argument type for argument #1 of `Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsFloat`: expected `float`, but found `unknown-ref(Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float)`. [invalid-argument]
phpdoc_advanced_fallback_positive_float.php:45: Invalid argument type for argument #1 of `Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat`: expected `unknown-ref(Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float)`, but found `float(1.5)`. [invalid-argument]
phpdoc_advanced_fallback_positive_float.php:48: Invalid argument type for argument #1 of `Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat`: expected `unknown-ref(Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float)`, but found `float`. [invalid-argument]
phpdoc_advanced_fallback_positive_float.php:52: Invalid argument type for argument #1 of `Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat`: expected `unknown-ref(Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float)`, but found `float(0.0)`. [invalid-argument]
phpdoc_advanced_fallback_positive_float.php:55: Invalid argument type for argument #1 of `Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat`: expected `unknown-ref(Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float)`, but found `float(-1.0)`. [invalid-argument]
  • Recognition: spelling not resolved — reported on declaration line(s) 23, 35
  • Enforcement: 0/2 of the expected violations reported — incidental, since the spelling was not resolved
  • False positives: line(s) 27, 42, 45, 48, 52, 55
Expectation diff
Line 27: Unexpected errors ["Invalid return type for function `Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\returnsPositiveFloat`: expected `unknown-ref(Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\positive-float)`, but found `float(1.5)`. [invalid-return-statement]"]
Line 42: Unexpected errors ["Invalid argument type for argument #1 of `Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\acceptsFloat`: expected `float`, but found `unknown-ref(Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\positive-float)`. [invalid-argument]"]
Line 45: Unexpected errors ["Invalid argument type for argument #1 of `Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\acceptsPositiveFloat`: expected `unknown-ref(Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\positive-float)`, but found `float(1.5)`. [invalid-argument]"]
Line 48: Unexpected errors ["Invalid argument type for argument #1 of `Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\acceptsPositiveFloat`: expected `unknown-ref(Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\positive-float)`, but found `float`. [invalid-argument]"]
Line 52: Unexpected errors ["Invalid argument type for argument #1 of `Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\acceptsPositiveFloat`: expected `unknown-ref(Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\positive-float)`, but found `float(0.0)`. [invalid-argument]"]
Line 55: Unexpected errors ["Invalid argument type for argument #1 of `Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\acceptsPositiveFloat`: expected `unknown-ref(Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\positive-float)`, but found `float(-1.0)`. [invalid-argument]"]
mir 0.101.0mir 0.101.0 Unrecognized
phpdoc_advanced_fallback_positive_float.php:24: UndefinedDocblockClass: Docblock type 'Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float' does not exist [MIR1505]
phpdoc_advanced_fallback_positive_float.php:44: InvalidArgument: Argument $value of acceptsPositiveFloat() expects 'Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float', got '1.5' [MIR0201]
phpdoc_advanced_fallback_positive_float.php:47: MixedArgument: Argument $value of acceptsPositiveFloat() is mixed [MIR1200]
phpdoc_advanced_fallback_positive_float.php:51: InvalidArgument: Argument $value of acceptsPositiveFloat() expects 'Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float', got '0' [MIR0201]
phpdoc_advanced_fallback_positive_float.php:54: InvalidArgument: Argument $value of acceptsPositiveFloat() expects 'Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float', got 'float' [MIR0201]
  • Recognition: spelling not resolved — reported on declaration line(s) 24
  • Enforcement: 2/2 of the expected violations reported — incidental, since the spelling was not resolved
Expectation diff
Line 44: Expected valid value to be accepted, got ["InvalidArgument: Argument $value of acceptsPositiveFloat() expects 'Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\positive-float', got '1.5' [MIR0201]"]
Line 47: Expected valid value to be accepted, got ["MixedArgument: Argument $value of acceptsPositiveFloat() is mixed [MIR1200]"]
phpantom 1.1.0phpantom_lsp 1.1.0 Widened to float

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: 0/2 of the expected violations reported
pun 0.4.3pun 0.4.3 Unrecognized
phpdoc_advanced_fallback_positive_float.php:24: Function Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\returnsPositiveFloat() has no return type specified. [missingType.return]
phpdoc_advanced_fallback_positive_float.php:24: PHPDoc tag @return contains unresolvable type. [return.unresolvableType]
phpdoc_advanced_fallback_positive_float.php:36: Function Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat() has parameter $value with no type specified. [missingType.parameter]
phpdoc_advanced_fallback_positive_float.php:36: PHPDoc tag @param for parameter $value contains unresolvable type. [parameter.unresolvableType]
phpdoc_advanced_fallback_positive_float.php:41: Parameter #1 $value of function Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsFloat expects float, Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float given. [argument.type]
  • Recognition: spelling not resolved — reported on declaration line(s) 24, 36
  • Enforcement: 0/2 of the expected violations reported — incidental, since the spelling was not resolved
Expectation diff
Line 41: Expected valid value to be accepted, got ["Parameter #1 $value of function Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\acceptsFloat expects float, Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\positive-float given. [argument.type]"]
intelephense 1.18.5intelephense 1.18.5 Incidental (0/2)
phpdoc_advanced_fallback_positive_float.php:41: Expected type 'float'. Found 'Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float'. [P1006]
  • Recognition: spelling resolved
  • Enforcement: 0/2 of the expected violations reported — incidental, since values the type admits were also rejected on line(s) 41
Expectation diff
Line 41: Expected valid value to be accepted, got ["Expected type 'float'. Found 'Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\positive-float'. [P1006]"]
phpactor 2026.11.22.0Phpactor 2026.11.22.0 Widened to float

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: 0/2 of the expected violations reported
phpy 1.0.19566phpy 1.0.19566 Unrecognized
phpdoc_advanced_fallback_positive_float.php:22: Use of unknown class: 'Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float'
phpdoc_advanced_fallback_positive_float.php:26: Return value of Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\returnsPositiveFloat() is expected to be of type Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float, float returned
phpdoc_advanced_fallback_positive_float.php:34: Use of unknown class: 'Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float'
phpdoc_advanced_fallback_positive_float.php:41: Argument '1' passed to Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsFloat() is expected to be of type float, Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float given
phpdoc_advanced_fallback_positive_float.php:44: Argument '1' passed to Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat() is expected to be of type Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float, float given
phpdoc_advanced_fallback_positive_float.php:47: Argument '1' passed to Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat() is expected to be of type Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float, float given
phpdoc_advanced_fallback_positive_float.php:51: Argument '1' passed to Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat() is expected to be of type Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float, float given
phpdoc_advanced_fallback_positive_float.php:54: Argument '1' passed to Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\acceptsPositiveFloat() is expected to be of type Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float, float given
  • Recognition: spelling not resolved — reported on declaration line(s) 22, 34
  • Enforcement: 2/2 of the expected violations reported — incidental, since the spelling was not resolved
Expectation diff
Line 26: Expected valid value to be accepted, got ["Return value of Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\returnsPositiveFloat() is expected to be of type Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\positive-float, float returned"]
Line 41: Expected valid value to be accepted, got ["Argument '1' passed to Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\acceptsFloat() is expected to be of type float, Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\positive-float given"]
Line 44: Expected valid value to be accepted, got ["Argument '1' passed to Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\acceptsPositiveFloat() is expected to be of type Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\positive-float, float given"]
Line 47: Expected valid value to be accepted, got ["Argument '1' passed to Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\acceptsPositiveFloat() is expected to be of type Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\positive-float, float given"]
qodana 263.7307.215PhpStorm 263.7307.215 Unrecognized
phpdoc_advanced_fallback_positive_float.php:22: Return type in PHPDoc does not match the actual return type [PhpReturnDocTypeMismatchInspection]
phpdoc_advanced_fallback_positive_float.php:22: Undefined class 'positive-float' [PhpUndefinedClassInspection]
phpdoc_advanced_fallback_positive_float.php:26: Return value type is not compatible with declared [PhpIncompatibleReturnTypeInspection]
phpdoc_advanced_fallback_positive_float.php:34: Undefined class 'positive-float' [PhpUndefinedClassInspection]
phpdoc_advanced_fallback_positive_float.php:44: Parameter '1.5' type is not compatible with declaration [PhpParamsInspection]
phpdoc_advanced_fallback_positive_float.php:47: Parameter 'INF' type is not compatible with declaration [PhpParamsInspection]
phpdoc_advanced_fallback_positive_float.php:51: Parameter '0.0' type is not compatible with declaration [PhpParamsInspection]
phpdoc_advanced_fallback_positive_float.php:54: Parameter '-1.0' type is not compatible with declaration [PhpParamsInspection]
  • Recognition: spelling not resolved — reported on declaration line(s) 22, 34
  • Enforcement: 2/2 of the expected violations reported — incidental, since the spelling was not resolved
Expectation diff
Line 26: Expected valid value to be accepted, got ["Return value type is not compatible with declared [PhpIncompatibleReturnTypeInspection]"]
Line 44: Expected valid value to be accepted, got ["Parameter '1.5' type is not compatible with declaration [PhpParamsInspection]"]
Line 47: Expected valid value to be accepted, got ["Parameter 'INF' 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 Unrecognized ⚠ 1 false positive
phpdoc_advanced_fallback_positive_float.php:12: Class or interface named \Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float does not exist [undefinedClass]
phpdoc_advanced_fallback_positive_float.php:34: Class or interface named \Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat\positive-float does not exist [undefinedClass]
  • Recognition: spelling not resolved — reported on declaration line(s) 34
  • Enforcement: 0/2 of the expected violations reported — incidental, since the spelling was not resolved
  • False positives: line(s) 12
Expectation diff
Line 12: Unexpected errors ["Class or interface named \\Conformance\\Tests\\PhpdocAdvancedFallbackPositiveFloat\\positive-float does not exist [undefinedClass]"]
steins 0.1.8steins 0.1.8 (2026-09-21 revision 76306a9) Unrecognized
phpdoc_advanced_fallback_positive_float.php:22: `positive-float` is not type vocabulary — a class name cannot contain `-`, so the name denotes nothing [phpdoc.unknown-vocabulary]
phpdoc_advanced_fallback_positive_float.php:34: `positive-float` is not type vocabulary — a class name cannot contain `-`, so the name denotes nothing [phpdoc.unknown-vocabulary]
  • Recognition: spelling not resolved — reported on declaration line(s) 22, 34
  • Enforcement: 0/2 of the expected violations reported — incidental, since the spelling was not resolved

Source

<?php

declare(strict_types=1);

namespace Conformance\Tests\PhpdocAdvancedFallbackPositiveFloat;

/**
 * `positive-float`
 *
 * Floats strictly greater than zero. Zero is the interesting probe: it is
 * finite and non-negative, but not positive. `+INF` is greater than zero, so
 * it satisfies this spelling; `finite-float` is the one that excludes
 * infinities. Analyzers that model the range reject `0.0`; others fall back
 * to plain `float` and accept it.
 *
 * References:
 * - https://phpstan.org/writing-php-code/phpdoc-types#float-ranges
 * - PHPStan 2.3.6 (phpstan/phpstan-src#6937)
 */

/**
 * @return positive-float
 */
function returnsPositiveFloat() // T: positive-float
{
    return 1.5; // V
}

function acceptsFloat(float $value): void
{
}

/**
 * @param positive-float $value
 */
function acceptsPositiveFloat($value): void // T: positive-float
{
}

// A `positive-float` value always satisfies a native `float` parameter.
acceptsFloat(returnsPositiveFloat()); // V

// A literal greater than zero satisfies the refined parameter.
acceptsPositiveFloat(1.5); // V

// +INF is greater than zero.
acceptsPositiveFloat(INF); // V

// Zero sits just outside the range — this is what separates the spelling from
// `non-negative-float`.
acceptsPositiveFloat(0.0); // E?: 0.0 is not a positive-float

// A negative literal is plainly outside it.
acceptsPositiveFloat(-1.0); // E?: -1.0 is not a positive-float