Skip to content

Conversation

@gsteel
Copy link
Member

@gsteel gsteel commented Oct 9, 2025

  • Adds Support for PHP 8.5 in Composer
  • Upgrades Psalm to latest, fixing or baselining where appropriate
  • Psalm upgrade necessitates soft or hard final throughout, but a number of shipped classes have been baselined for this as they are likely extension points.

@gsteel gsteel added this to the 3.21.0 milestone Oct 9, 2025
@gsteel gsteel added Enhancement Dependencies Updates and changes to dependencies QA Quality assurance tasks such as static analysis improvements labels Oct 9, 2025
gsteel added 2 commits October 9, 2025 17:15
Signed-off-by: George Steel <[email protected]>
@Xerkus
Copy link
Member

Xerkus commented Oct 9, 2025

class must be final should be disabled for src imo.

    <issueHandlers>
        <ClassMustBeFinal>
            <errorLevel type="suppress">
                <directory name="src" />
            </errorLevel>
        </ClassMustBeFinal>
    </issueHandlers>

@gsteel
Copy link
Member Author

gsteel commented Oct 9, 2025

class must be final should be disabled for src imo.

For this lib, perhaps, because it contains quite a few extension points - but even then, it forces us to explicitly state which shipped classes are fit for user inheritance. I'd argue that there are several non-final classes here that could/should be final.

Generally speaking, I prefer final by default and this issue helps with that…

@gsteel gsteel marked this pull request as ready for review October 9, 2025 16:44
@gsteel gsteel requested a review from a team October 9, 2025 16:44
Signed-off-by: George Steel <[email protected]>
@Ocramius
Copy link
Member

Ocramius commented Oct 10, 2025

So... how do we deal with the failures? They are, pretty much:

1) LaminasTest\Stdlib\StringWrapper\IntlTest::testStrlen with data set #0 ('ascii', 'abcdefghijklmnopqrstuvwxyz', 26)
Encoding ascii not supported

58) LaminasTest\Stdlib\StringWrapper\NativeTest::testStrPad with data set "negative-pad-length" ('utf-8', 'äääöö', -2, 'ö', 1, 'äääöö')
Encoding utf-8 not supported

1) /github/workspace/test/ArrayObjectTest.php:171
ArrayObject::exchangeArray(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants

@gsteel
Copy link
Member Author

gsteel commented Oct 10, 2025

The only failure is Using an object as a backing array for ArrayObject is deprecated from a test context.

We have Laminas\ArrayObject::exchangeArray($whatever) where whatever can be any iterable, whereas PHP is now deprecating \ArrayObject::exchangeArray(iterable $a), so I haven't figured out whether I should just fix the test, or, also deprecate iterables to the Laminas equivalent and writes tests to cover the deprecation.

@gsteel
Copy link
Member Author

gsteel commented Oct 10, 2025

For my reference: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_arrayobject_and_arrayiterator_with_objects

Obviously you already know about this @Ocramius considering you voted on it 😁

…l with the PHP deprecation in 8.5 of the same nature.

Signed-off-by: George Steel <[email protected]>
@gsteel
Copy link
Member Author

gsteel commented Oct 10, 2025

I've deprecated passing non-array values to Laminas\ArrayObject::exchangeArray() to more closely match the deprecation in regular \ArrayObject.

Why does this re-implementation of ArrayObject even exist?

Also, rather than fixing the actual PHP deprecation in the test, I'm effecitively silencing it.

@Xerkus
Copy link
Member

Xerkus commented Oct 10, 2025

Why does this re-implementation of ArrayObject even exist?

IIRC it was needed to better mimic array behavior with nested values. This one returns by reference so the code below works:

$arrayObject['nested_array']['foo'] = 'bar';

Array access has many other quirks so we no longer use it anywhere. zend-config was the biggest consumer I think.

@Ocramius
Copy link
Member

Obviously you already know about this @Ocramius considering you voted on it 😁

Yeah, it was more about what we do about it. I'm fine with deprecating our behavior 👍

Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@Ocramius Ocramius self-assigned this Oct 11, 2025
@Ocramius Ocramius merged commit b1c8151 into laminas:3.21.x Oct 11, 2025
17 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in PHP 8.5 Oct 11, 2025
@Ocramius
Copy link
Member

Thanks @gsteel!

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

Labels

Dependencies Updates and changes to dependencies Enhancement QA Quality assurance tasks such as static analysis improvements

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

PHP 8.5: PHP Deprecated: Return type of Laminas\Stdlib\SplPriorityQueue::__unserialize($data)

3 participants