X Tutup
Skip to content

Fix PHP 8.5 issues, drop PHP 8.1 support#2996

Open
przepompownia wants to merge 1 commit intophpactor:masterfrom
przepompownia:follow-deps
Open

Fix PHP 8.5 issues, drop PHP 8.1 support#2996
przepompownia wants to merge 1 commit intophpactor:masterfrom
przepompownia:follow-deps

Conversation

@przepompownia
Copy link
Contributor

@przepompownia przepompownia commented Dec 21, 2025

Problem: some phpunit tests fail on PHP 8.5

Solution:

  • upgrade Psalm version (implies dropped support for PHP 8.1)
  • increase test Psalm process timeout to 15 s
  • fix new deprecations
  • add 8.5 to CI matrix, bump minimal version to 8.2 there

@przepompownia
Copy link
Contributor Author

przepompownia commented Dec 21, 2025

Phpactor\WorseReflection\Tests\Inference\SelfTest::testSelf#php-8.4.0-asym-prop-hooks asym-prop-hooks.test reveals null array key, which is an empty parameter name. $parameter->__toString() in that case shows "protected private(get)" (no name) from lib/WorseReflection/Tests/Inference/php-8.4.0-asym-prop-hooks/asym-prop-hooks.test

<?php

class Book
{
    public function __construct(
        public private(set) string $title,
        public protected(set) string $author,
        protected private(get) int $pubYear,
        public string $bar,
    ) {}

    public function methodThatNowWontParse(): void
    {}
}

$book = new Book();
wrAssertType('string',$book->bar);

@dantleech probably I need your help here - feel free to modify this PR if you want. I'm not sure if it can reveal some bug, maybe worth a separate fix.

I didn't analyze two other remaining deprecations yet.

@przepompownia przepompownia force-pushed the follow-deps branch 5 times, most recently from 894b70d to 2df0f42 Compare December 21, 2025 20:36
@przepompownia przepompownia changed the title Fix PHP 8.5 issues Fix PHP 8.5 issues, drop PHP 8.1 support Dec 21, 2025
@przepompownia przepompownia force-pushed the follow-deps branch 2 times, most recently from 125dfca to 395076b Compare December 26, 2025 20:48
@przepompownia przepompownia force-pushed the follow-deps branch 2 times, most recently from 9cc0792 to bf23869 Compare December 27, 2025 22:26
@dantleech
Copy link
Collaborator

I'm OK with bumping to 8.2

probably I need your help here

I'm not sure what the issue is - that's a test file? but the tests are passing. It seems the only issue is PHPStan?

@przepompownia
Copy link
Contributor Author

2 tests triggered 1 PHP deprecation:

1) .../lib/WorseReflection/Core/Reflection/Collection/ReflectionParameterCollection.php:42
Using null as an array offset is deprecated, use an empty string instead

Triggered by:

* Phpactor\WorseReflection\Tests\Inference\SelfTest::testSelf#php-8.4.0-asym-prop-hooks asym-prop-hooks.test (4 times)
  .../lib/WorseReflection/Tests/Inference/SelfTest.php:19

* Phpactor\WorseReflection\Tests\Integration\Bridge\TolerantParser\Reflection\ReflectionMethodTest::testReflectMethod#It tolerantes and logs method parameters with missing variables parameter
  .../lib/WorseReflection/Tests/Integration/Bridge/TolerantParser/Reflection/ReflectionMethodTest.php:26

Problem: some phpunit tests fail on PHP 8.5

Solution:
- upgrade Psalm version (implies dropped support for PHP 8.1)
- upgrade Monolog (avoid: deprecation on the one side, dependency conflicts on the other side)
- increase test Psalm process timeout to 15 s
- fix new deprecations
- add 8.5 to CI matrix, bump minimal version to 8.2
@przepompownia przepompownia marked this pull request as ready for review December 28, 2025 11:58
@przepompownia
Copy link
Contributor Author

przepompownia commented Dec 28, 2025

Perhaps enumerated values ​​(here for Monolog logging levels) would avoid silencing phpstan reports, but I'm not sure it's worth changing now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

X Tutup