This repository is used to demonstrate a small difference between running vimeo/psalm:5.12.0
against a codebase that contains PHP 8.2 #[AllowDynamicProperties]
declarations.
When running against PHP 8.1 and PHP 8.2, the error output is different, making it impossible to work with a Psalm baseline on both versions at the same time.
docker run --rm -ti -v $(pwd):/app -w /app php:8.1 vendor/bin/psalm --no-cache
Produces:
demo on master [+] via 🐘 v8.1.19 via ❄️ impure (nix-shell)
❯ docker run --rm -ti -v $(pwd):/app -w /app php:8.1 vendor/bin/psalm --no-cache
Install the opcache extension to make use of JIT on PHP 8.0+ for a 20%+ performance boost!
Target PHP version: 8.1 (set by config file).
Scanning files...
Analyzing files...
E
ERROR: UndefinedAttributeClass - demo.php:3:3 - Attribute class AllowDynamicProperties does not exist (see https://psalm.dev/241)
#[AllowDynamicProperties]
------------------------------
1 errors found
------------------------------
Checks took 0.54 seconds and used 71.557MB of memory
Psalm was unable to infer types in the codebase
docker run --rm -ti -v $(pwd):/app -w /app php:8.2 vendor/bin/psalm --no-cache
Produces
demo on master [+] via 🐘 v8.1.19 via ❄️ impure (nix-shell)
❯ docker run --rm -ti -v $(pwd):/app -w /app php:8.2 vendor/bin/psalm --no-cache
Install the opcache extension to make use of JIT on PHP 8.0+ for a 20%+ performance boost!
Target PHP version: 8.1 (set by config file).
Scanning files...
Analyzing files...
E
ERROR: InvalidAttribute - demo.php:3:3 - The class AllowDynamicProperties doesn't have the Attribute attribute (see https://psalm.dev/242)
#[AllowDynamicProperties]
------------------------------
1 errors found
------------------------------
Checks took 0.55 seconds and used 68.053MB of memory
Psalm was unable to infer types in the codebase
The most relevant difference:
-ERROR: UndefinedAttributeClass - demo.php:3:3 - Attribute class AllowDynamicProperties does not exist (see https://psalm.dev/241)
+ERROR: InvalidAttribute - demo.php:3:3 - The class AllowDynamicProperties doesn't have the Attribute attribute (see https://psalm.dev/242)
#[AllowDynamicProperties]