Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support PHP 8.1, 8.2 and 8.3 #31

Merged
merged 14 commits into from
Jun 9, 2024
Merged

Support PHP 8.1, 8.2 and 8.3 #31

merged 14 commits into from
Jun 9, 2024

Conversation

koriym
Copy link
Owner

@koriym koriym commented Jan 5, 2024

Summary by CodeRabbit

  • Chores

    • Updated PHP version to 8.3 in coding standards, continuous integration, and static analysis workflows.
    • Updated phpunit/phpunit dev dependency and added a new script for cleaning cache in composer.json.
    • Added a new exclusion rule in phpcs.xml.
    • Adjusted settings in psalm.xml to manage unused code and baseline entries.
  • Refactor

    • Refined method signatures, exception handling, and annotations in Dii.php.
    • Updated createController method in DiiWebApplication.php to improve type handling and documentation.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 54be58a and 4819dad.

Files selected for processing (14)
  • .github/workflows/coding-standards.yml (1 hunks)
  • .github/workflows/continuous-integration.yml (2 hunks)
  • .github/workflows/static-analysis.yml (1 hunks)
  • composer.json (2 hunks)
  • phpcs.xml (1 hunks)
  • psalm.xml (1 hunks)
  • rector.php (1 hunks)
  • src/Dii.php (5 hunks)
  • src/DiiConsoleApplication.php (1 hunks)
  • src/DiiConsoleCommandRunner.php (2 hunks)
  • src/DiiWebApplication.php (2 hunks)
  • src/SilentAutoload.php (1 hunks)
  • tests/UnitTest/DiiTest.php (2 hunks)
  • tests/UnitTest/DiiWebApplicationTest.php (2 hunks)
Files skipped from review due to trivial changes (6)
  • .github/workflows/coding-standards.yml
  • .github/workflows/continuous-integration.yml
  • psalm.xml
  • src/DiiConsoleApplication.php
  • src/SilentAutoload.php
  • tests/UnitTest/DiiWebApplicationTest.php
Additional comments not posted (13)
rector.php (3)

10-12: Paths configuration correctly targets the src directory for refactoring.


14-15: Rule configuration for InlineConstructorDefaultToPropertyRector is appropriate for code quality improvements.


18-20: Rule sets configuration is correctly set to UP_TO_PHP_81, aligning with the PHP version upgrade.

.github/workflows/static-analysis.yml (1)

17-17: PHP version updated to 8.3 in the workflow, aligning with the project's upgrade to support newer PHP versions.

composer.json (1)

19-19: Updated PHP and package versions to support newer PHP versions and modern libraries.

Also applies to: 25-26, 71-71

tests/UnitTest/DiiTest.php (1)

20-20: Proper use of parent::setUp(); ensures that the parent class setup is also executed, maintaining test integrity.

phpcs.xml (1)

41-41: Addition of the exclusion rule SlevomatCodingStandard.PHP.RequireExplicitAssertion.RequiredExplicitAssertion addresses specific coding standards or false positives.

src/DiiWebApplication.php (2)

33-34: Adding return type declaration array|null enhances method signature clarity and robustness.


87-87: Proper namespacing of the class name ensures correct autoloading and instance creation.

src/Dii.php (4)

46-46: Adding type hinting for the $context parameter improves type safety and clarity.


77-77: Handling of the Unbound exception with a catch block improves robustness by ensuring that unbound dependencies are handled gracefully.


118-119: Addition of method documentation improves code readability and maintainability.


144-144: Adding type hinting for the $config parameter improves type safety and clarity.

src/DiiConsoleCommandRunner.php Outdated Show resolved Hide resolved
@koriym koriym marked this pull request as draft June 8, 2024 09:20
@koriym koriym force-pushed the php-8.3 branch 3 times, most recently from bf62aa0 to 906d7de Compare June 8, 2024 13:24
koriym added 8 commits June 8, 2024 22:28
Add return type for createController method

The createController method in DiiWebApplication.php now has a return type specified. This clarifies what type of data is expected to be returned, improving readability and maintainability of the code.
Updated the Psalm configuration file to suppress warnings for unused code and unused baseline entries. This change aids in reducing noise in the Psalm report output, improving readability and focus on significant issues.
An "Undefined Method" warning from Psalm was being triggered in Dii.php. To remedy this occurrence, a @psalm-suppress annotation has been included above the line of code that was causing it. This silences the "Undefined Method" warning.
A new "clean" script has been added to composer.json, allowing you to clear the Psalm cache. The "tests" script has also been updated to include this new "clean" operation.
This commit repositions the "@return array|null" documentation comment to be above the "@throws" comments for correct ordering. Strives for consistency in how the documentation comments are ordered through the codebase.
Repository owner deleted a comment from coderabbitai bot Jun 8, 2024
Copy link

coderabbitai bot commented Jun 8, 2024

Walkthrough

The updates mainly focus on upgrading PHP versions across various GitHub workflow files and refining configurations and dependencies in composer.json. Additionally, changes in source files involve method signature adjustments, exception handling, and type hints. These modifications enhance compatibility with newer PHP versions and improve code quality and maintainability.

Changes

File Change Summary
.github/workflows/coding-standards.yml Updated PHP version from 8.0 to 8.3.
.github/workflows/continuous-integration.yml Updated PHP versions for testing from 7.3, 7.4, 8.0 to 8.1, 8.2, 8.3.
.github/workflows/static-analysis.yml Updated PHP version from 8.0 to 8.3.
composer.json Updated phpunit/phpunit dev dependency, added clean script, and configured phpcodesniffer plugin.
phpcs.xml Added exclusion rule SlevomatCodingStandard.PHP.RequireExplicitAssertion.RequiredExplicitAssertion.
psalm.xml Added findUnusedBaselineEntry and findUnusedCode attributes in <projectFiles>.
src/Dii.php Adjusted method signatures, exception handling, type hints, and annotations.
src/DiiWebApplication.php Updated createController method to cast $controllerID to string and added return type declaration.

Poem

In the code where PHP thrives,
New versions keep it all alive.
Tests and checks, now up to date,
Ensuring quality, never late.
With scripts and rules both fresh and clean,
Our codebase shines with a brighter sheen.
🌟🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

koriym added 2 commits June 8, 2024 23:03
The "vimeo/psalm" package was removed from the development dependencies in composer.json. This change is likely due to the decision
The version requirement for PHPUnit has been expanded to support both 8.5 and 9.5 versions. This change allows for greater flexibility and compatibility with different setups.
The triggers for the Static Analysis GitHub Action workflow have been updated. As a result of this change, the workflow will no longer run automatically when a push or pull request event occurs. Now, the workflow will only be dispatched manually.
@koriym koriym marked this pull request as ready for review June 8, 2024 14:33
@koriym
Copy link
Owner Author

koriym commented Jun 8, 2024

@coderabbitai review

Copy link

coderabbitai bot commented Jun 8, 2024

Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

The composer.json file has been updated, specifically the PHPUnit version in the "require-dev" section. Upgraded from version "^8.5 || ^9.5" to "^8.5 || ^9.6.19".
@koriym
Copy link
Owner Author

koriym commented Jun 9, 2024

@coderabbitai review

Copy link

coderabbitai bot commented Jun 9, 2024

Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 54be58a and a7a6a9b.

Files selected for processing (8)
  • .github/workflows/coding-standards.yml (1 hunks)
  • .github/workflows/continuous-integration.yml (2 hunks)
  • .github/workflows/static-analysis.yml (2 hunks)
  • composer.json (3 hunks)
  • phpcs.xml (1 hunks)
  • psalm.xml (1 hunks)
  • src/Dii.php (2 hunks)
  • src/DiiWebApplication.php (1 hunks)
Files skipped from review due to trivial changes (1)
  • src/DiiWebApplication.php
Files skipped from review as they are similar to previous changes (7)
  • .github/workflows/coding-standards.yml
  • .github/workflows/continuous-integration.yml
  • .github/workflows/static-analysis.yml
  • composer.json
  • phpcs.xml
  • psalm.xml
  • src/Dii.php

@koriym
Copy link
Owner Author

koriym commented Jun 9, 2024

@coderabbitai Could you approve?

Copy link

coderabbitai bot commented Jun 9, 2024

@koriym, I've reviewed the changes and everything appears to be in order with the updates for PHP versions 8.1, 8.2, and 8.3. I'm approving the pull request now.

Actions performed

Comments resolved.

@koriym koriym merged commit 6cde86f into master Jun 9, 2024
14 checks passed
@koriym koriym deleted the php-8.3 branch June 9, 2024 00:30
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants