properties-of<T> is a Psalm-only utility typeproperties-of<T> expands to an array shape of the class's properties
(array{name: string, age: int} here). Psalm models it; other analyzers do
not recognize the keyword and either ignore it or report an unknown type.
References:
- Psalm TPropertiesOf (properties-of / public-properties-of ...)| Analyzer | Version | Result | Diagnostics |
|---|---|---|---|
| phan | 6.0.11Phan 6.0.11 php-ast version 1.1.3 PHP version used to run Phan: 8.5.11 | Unrecognized | phpdoc_advanced_psalm_properties_of.php:26: Saw possibly unextractable annotation for a fragment of comment '* @param properties-of<User> $data': after properties, did not see an element name (will guess based on comment order) [PhanUnextractableAnnotationElementName] phpdoc_advanced_psalm_properties_of.php:26: Saw a token Phan may have failed to parse after '* @param properties-of<User> $data': after properties, saw '-' [PhanUnextractableAnnotationSuffix]
|
| phpstan | 2.3.5PHPStan - PHP Static Analysis Tool 2.3.5 | Unrecognized | phpdoc_advanced_psalm_properties_of.php:28: Function Conformance\Tests\PhpdocAdvancedPsalmPropertiesOf\acceptsUserProps() has parameter $data with no value type specified in iterable type array. [reported-from-level=6] phpdoc_advanced_psalm_properties_of.php:28: PHPDoc tag @param for parameter $data contains unresolvable type. [reported-from-level=2] With strict-rulesphpdoc_advanced_psalm_properties_of.php:28: Function Conformance\Tests\PhpdocAdvancedPsalmPropertiesOf\acceptsUserProps() has parameter $data with no value type specified in iterable type array. phpdoc_advanced_psalm_properties_of.php:28: PHPDoc tag @param for parameter $data contains unresolvable type.
|
| psalm | 6.20.9Psalm 6.20.9@f67170ac3c3b931f5088681e21d6c8babc601c08 next: 7.0.4 |
Enforced | phpdoc_advanced_psalm_properties_of.php:36: Argument 1 of Conformance\Tests\PhpdocAdvancedPsalmPropertiesOf\acceptsUserProps expects array{age: int, name: string}, but array{age: 'old', name: 'Ada'} provided [InvalidScalarArgument]
|
| mago | 1.59.0mago 1.59.0 | Enforced | phpdoc_advanced_psalm_properties_of.php:36: Possible argument type mismatch for argument #1 of `Conformance\Tests\PhpdocAdvancedPsalmPropertiesOf\acceptsUserProps`: expected `array{'age': int, 'name': string}`, but possibly received `array{'age': string('old'), 'name': string('Ada')}`. [possibly-invalid-argument]
|
| mir | 0.91.0mir 0.91.0 | Not enforced | No diagnostics reported.
|
| phpantom | 0.11.1phpantom_lsp 0.11.1 | Not enforced | No diagnostics reported.
|
| intelephense | 1.18.5intelephense 1.18.5 | Not enforced | No diagnostics reported.
|
| phpactor | 2026.10.07.0Phpactor 2026.10.07.0 | Not enforced | No diagnostics reported.
|
| phpy | 1.0.19490phpy 1.0.19490 | Unrecognized | phpdoc_advanced_psalm_properties_of.php:26: Use of unknown class: 'Conformance\Tests\PhpdocAdvancedPsalmPropertiesOf\properties-of'
|
| qodana | 262.11879.104PhpStorm 262.11879.104 | Unrecognized | phpdoc_advanced_psalm_properties_of.php:26: Argument type does not match the declared [PhpDocSignatureInspection] phpdoc_advanced_psalm_properties_of.php:26: Undefined class 'properties-of' [PhpUndefinedClassInspection]
|
| noverify | 0.5.5NoVerify, version 0.5.5: built on: 2025.04.22 14:36:46 OS: r-kuchinskas arm64 Commit: 4774b82f8adc53fbef38f95e97af4b953b4d1529 | Unrecognized | phpdoc_advanced_psalm_properties_of.php:28: param $data miss matched with phpdoc type <<properties-of<User>>> [funcParamTypeMissMatch]
|
| steins | 0.1.8steins 0.1.8 (2026-09-21 revision 76306a9) | Widened to a nonexistent-class reference | No diagnostics reported.
Notes: `properties-of<User>` has no `lower_generic` entry, so it lowers through the catch-all to `ContractTy::Class("properties-of")` — Steins has no fact form for a class's declared property types, so per-key checking against them is unmodeled. |
| phpstan-strict | 2.3.5PHPStan - PHP Static Analysis Tool 2.3.5 | Unrecognized | phpdoc_advanced_psalm_properties_of.php:28: Function Conformance\Tests\PhpdocAdvancedPsalmPropertiesOf\acceptsUserProps() has parameter $data with no value type specified in iterable type array. phpdoc_advanced_psalm_properties_of.php:28: PHPDoc tag @param for parameter $data contains unresolvable type.
|
| psalm-next | 7.0.4Psalm 7.0.4@fa5b1f6e665cb743838ffd865b8fc96207f9409f | Enforced | phpdoc_advanced_psalm_properties_of.php:36: Argument 1 of Conformance\Tests\PhpdocAdvancedPsalmPropertiesOf\acceptsUserProps expects array{age: int, name: string}, but array{age: 'old', name: 'Ada'} provided [InvalidScalarArgument]
|
<?php
declare(strict_types=1);
namespace Conformance\Tests\PhpdocAdvancedPsalmPropertiesOf;
/**
* `properties-of<T>` is a Psalm-only utility type.
*
* `properties-of<T>` expands to an array shape of the class's properties
* (`array{name: string, age: int}` here). Psalm models it; other analyzers do
* not recognize the keyword and either ignore it or report an unknown type.
*
* References:
* - Psalm TPropertiesOf (properties-of / public-properties-of ...)
*/
final class User
{
public string $name = '';
public int $age = 0;
}
/**
* @param properties-of<User> $data
*/
function acceptsUserProps(array $data): void // T: properties-of<User>
{
}
// A shape matching the class properties satisfies the parameter.
acceptsUserProps(['name' => 'Ada', 'age' => 36]); // V
// A shape with a wrong property type is rejected by analyzers that model it.
acceptsUserProps(['name' => 'Ada', 'age' => 'old']); // E?: age must be int in properties-of<User>