laminas-code icon indicating copy to clipboard operation
laminas-code copied to clipboard

Add Support for PHP 8.4

Open nishant04412 opened this issue 1 year ago • 2 comments

Q A
Documentation yes/no
Bugfix yes/no
BC Break yes/no
New Feature yes/no
RFC yes/no
QA yes/no

Description

nishant04412 avatar Oct 01 '24 05:10 nishant04412

Seems like the PHP 8.4 pipeline is blocked by https://github.com/laminas/laminas-stdlib/pull/118

W0rma avatar Oct 03 '24 07:10 W0rma

Yes and https://github.com/laminas/laminas-stdlib/pull/118 looks to be blocked due to https://github.com/vimeo/psalm/pull/10928

I added a comment https://github.com/laminas/laminas-stdlib/pull/118#issuecomment-2384861365 to confirm same. Lets hope dependent PRs get merged soon to unblock this.

nishant04412 avatar Oct 03 '24 07:10 nishant04412

@gsteel I am facing some issues while resolving one of the issue in https://github.com/laminas/laminas-code/blob/562e02b7d85cb9142b5116cc76c4c7c162a11a1c/test/Generator/TestAsset/ParameterClass.php#L78

Here, if we add ? before \stdClass $a = null then it'll resolve PHP 8.4 related issue but then test is giving deprecation Optional parameter $a declared before required parameter $b is implicitly treated as a required parameter.

Please suggest if we can keep mandatory parameter $b before optional parameter $a in this ? Or any other advise if not.

nishant04412 avatar Oct 24 '24 13:10 nishant04412

Please suggest if we can keep mandatory parameter $b before optional parameter $a in this ? Or any other advise if not.

$a is effectively mandatory because $b is and we don't support BC on named parameters, so the signature can be changed to fn(stdClass|null $a, $b) without breaking BC AFAIC. Alternatively, retain the = null and just suppress the CS issue.

Also, this is a Test asset - BC is not a concern.

gsteel avatar Oct 24 '24 13:10 gsteel

default null value can be removed if next parameter is required, see

https://3v4l.org/4pQLN

that safe even extended, also, named argument is not used in the test :)

samsonasik avatar Oct 24 '24 13:10 samsonasik

@samsonasik Please review and let me know if clarification or code modification required.

nishant04412 avatar Oct 24 '24 17:10 nishant04412

Sign off is needed, read https://github.com/laminas/laminas-code/pull/201/checks?check_run_id=32024385175

samsonasik avatar Oct 24 '24 17:10 samsonasik

@gsteel PR changes are approved. Can you please check and merge this PR ?

nishant04412 avatar Oct 24 '24 18:10 nishant04412