← All results

@param-later-invoked-callable

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

Free functions default to immediately-invoked. The tag overrides a function parameter so the callable is treated as deferred (not run before the next statement). References: - PHPStan phpdocs-basics: Callables - PHPStan 1.11 release notes

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 Recognized (no probes)
phpdoc_advanced_phpstan_param_later_invoked_callable.php:44: Argument 1 ($value) is $name of type null but \Conformance\Tests\PhpdocAdvancedPhpstanParamLaterInvokedCallable\takesString() takes string defined at /Users/megurine/repo/php/php-typing-conformance/conformance/tests/phpdoc_advanced_phpstan_param_later_invoked_callable.php:27 [PhanTypeMismatchArgument]
  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
phpstan 2.2.8PHPStan - PHP Static Analysis Tool 2.2.8 Recognized (no probes) reported Lv.8+
phpdoc_advanced_phpstan_param_later_invoked_callable.php:44: Parameter #1 $value of function Conformance\Tests\PhpdocAdvancedPhpstanParamLaterInvokedCallable\takesString expects string, string|null given. [identifier=argument.type] [reported-from-level=8]
With strict-rules
phpdoc_advanced_phpstan_param_later_invoked_callable.php:44: Parameter #1 $value of function Conformance\Tests\PhpdocAdvancedPhpstanParamLaterInvokedCallable\takesString expects string, string|null given. [identifier=argument.type]
  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
psalm 6.16.1Psalm 6.16.1@f1f5de594dc76faf8784e02d3dc4716c91c6f6ac
next: 7.0.0-beta19
Recognized (no probes)
phpdoc_advanced_phpstan_param_later_invoked_callable.php:44: Argument 1 of Conformance\Tests\PhpdocAdvancedPhpstanParamLaterInvokedCallable\takesString cannot be null, possibly null value provided [PossiblyNullArgument]
  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
mago 1.46.0mago 1.46.0 Recognized (no probes)
phpdoc_advanced_phpstan_param_later_invoked_callable.php:44: Argument #1 of function `Conformance\Tests\PhpdocAdvancedPhpstanParamLaterInvokedCallable\takesString` is possibly `null`, but parameter type `string` does not accept it. [possibly-null-argument]
  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
mir 0.70.1mir 0.70.1 Recognized (no probes)
phpdoc_advanced_phpstan_param_later_invoked_callable.php:44: NullArgument: Argument $value of takesString() cannot be null [MIR0100]
  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
phpantom 0.9.0phpantom_lsp 0.9.0 Recognized (no probes)
phpdoc_advanced_phpstan_param_later_invoked_callable.php:44: Argument 1 ($value) expects string, got null [type_mismatch_argument]
  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
intelephense 1.18.5intelephense 1.18.5 Recognized (no probes)
phpdoc_advanced_phpstan_param_later_invoked_callable.php:44: Expected type 'string'. Found 'null'. [P1006]
  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
phpy 0.2.0phpy 0.2.0 Recognized (no probes)

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
qodana 262.8665.325Qodana 262.8665.325 Recognized (no probes)

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
noverify 0.5.5NoVerify, version 0.5.5: built on: 2025.04.22 14:36:46 OS: r-kuchinskas arm64 Commit: 4774b82f8adc53fbef38f95e97af4b953b4d1529 Recognized (no probes)
phpdoc_advanced_phpstan_param_later_invoked_callable.php:44: not null safety call in function Conformance\Tests\PhpdocAdvancedPhpstanParamLaterInvokedCallable\takesString signature of param value [notNullSafetyFunctionArgumentVariable]
  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
steins 0.1.5steins 0.1.5 (2026-08-12 revision 39b4cc1) Recognized (no probes)

No diagnostics reported.

  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
phpstan-strict 2.2.8PHPStan - PHP Static Analysis Tool 2.2.8 Recognized (no probes)
phpdoc_advanced_phpstan_param_later_invoked_callable.php:44: Parameter #1 $value of function Conformance\Tests\PhpdocAdvancedPhpstanParamLaterInvokedCallable\takesString expects string, string|null given. [identifier=argument.type]
  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes
psalm-next 7.0.0-beta19Psalm 7.0.0-beta19@7e751c06a756fa64dc4c759c09fe4a173afcb433 Recognized (no probes)
phpdoc_advanced_phpstan_param_later_invoked_callable.php:44: Argument 1 of Conformance\Tests\PhpdocAdvancedPhpstanParamLaterInvokedCallable\takesString cannot be null, possibly null value provided [PossiblyNullArgument]
  • Recognition: spelling resolved
  • Enforcement: not measured — this test carries no rejection probes

Source

<?php

declare(strict_types=1);

namespace Conformance\Tests\PhpdocAdvancedPhpstanParamLaterInvokedCallable;

/**
 * Cross-tool handling of `@param-later-invoked-callable`.
 *
 * Free functions default to immediately-invoked. The tag overrides a function
 * parameter so the callable is treated as deferred (not run before the next
 * statement).
 *
 * References:
 * - PHPStan phpdocs-basics: Callables
 * - PHPStan 1.11 release notes
 */

/**
 * @param-later-invoked-callable $callback
 */
function schedule(callable $callback): void // T: @param-later-invoked-callable
{
    // Intentionally not called: models a queue/store API.
}

function takesString(string $value): void
{
}

function example(): void
{
    $name = null;
    schedule(static function () use (&$name): void {
        $name = 'Ada';
    });

    // NOTE: the invocation-timing tags govern checked-exception propagation
    // (@throws / try-catch), not by-ref narrowing. PHPStan infers `'Ada'|null`
    // for $name whether or not the callable is invoked later, so this diagnostic
    // fires independently of the tag and must not be scored as tag enforcement.
    // The checked-exceptions rule the tag actually feeds is not enabled here, so
    // there is no enforcement probe to make.
    takesString($name); // E?[noise]: string|null argument, independent of the tag
}