Skip to content

Update tests and add PHP 8.3 to the CI matrix - #3299

Merged
l0gicgate merged 6 commits into
slimphp:4.xfrom
akrabat:update-for-php83
Dec 14, 2023
Merged

l0gicgate merged 6 commits into
slimphp:4.xfrom
akrabat:update-for-php83

Conversation

@akrabat

@akrabat akrabat commented Nov 23, 2023 •

Copy link
Copy Markdown
Member

A few things that we were doing in the tests are deprecated and so have been updated to be correct.

  • We now use setStaticPropertyValue() to set static properties on a reflected class rather than setValue() on a reflected property.
  • We no longer dynamically add a request property to the response class in BodyParsingMiddlewareTest, instead we add it to our handler class.
  • We no longer create an unused reflected property in ErrorHandlerTest.

I have also added PHP 8.3 to the CI matrix and moved our static analysis tests to PHP 8.2.

Note that we'll need to wait for phpspec/prophecy to support PHP 8.3 before we can merge.

@akrabat
akrabat requested a review from l0gicgate November 23, 2023 12:50
@coveralls

coveralls commented Nov 23, 2023 •

Copy link
Copy Markdown

Coverage Status

coverage: 99.427% (-0.002%) from 99.429%
when pulling 4bfb12a on akrabat:update-for-php83
into ca951fb on slimphp:4.x.

From PHP 8.3, calling ReflectionProperty::setValue() with a single value
is deprecated, so we use ReflectionClass::setStaticPropertyValue()
instead.
It's not used and causes a warning.
Dynamically adding a property to a class is deprecated and so rather
than adding the request to the response from the handler, we now add it
to the handler itself and test it there.
Also use 8.2 for the CS and static analysis tests.
@l0gicgate

l0gicgate commented Nov 24, 2023 •

Copy link
Copy Markdown
Member

@akrabat it appears installing the dependencies fails on PHP 8.3
CleanShot 2023-11-23 at 22 45 36@2x

@akrabat

akrabat commented Nov 24, 2023

Copy link
Copy Markdown
Member Author

@akrabat it appears installing the dependencies fails on PHP 8.3

Yes. See "note" in PR description :)

@l0gicgate

Copy link
Copy Markdown
Member

@akrabat my apologies 😅 I guess we'll just have to be patient!

@stemd

stemd commented Dec 11, 2023

Copy link
Copy Markdown

Seems that phpspec/prophecy now supports PHP 8.3 (commit 3 days ago):

phpspec/prophecy@03cfe36?diff=unified&w=0

@akrabat

akrabat commented Dec 11, 2023

Copy link
Copy Markdown
Member Author

Thanks @stemd. I have re-run the PHP 8.3 CI test and it passed. Over to @l0gicgate for review.

@l0gicgate l0gicgate added this to the 4.13.0 milestone Dec 12, 2023

@l0gicgate l0gicgate left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For cohesion, can we please import ReflectionClass in the import statements instead of using \ReflectionClass. Looks great otherwise, thank you for this contribution.

@akrabat

akrabat commented Dec 12, 2023

Copy link
Copy Markdown
Member Author

For cohesion, can we please import ReflectionClass in the import statements instead of using \ReflectionClass.

Done.

@l0gicgate
l0gicgate merged commit 56ead41 into slimphp:4.x Dec 14, 2023
@akrabat
akrabat deleted the update-for-php83 branch June 13, 2024 09:34
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.

4 participants