Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

chore: static type fixes #214

Merged
merged 1 commit into from
Jul 1, 2024
Merged

chore: static type fixes #214

merged 1 commit into from
Jul 1, 2024

Conversation

lotyp
Copy link
Member

@lotyp lotyp commented Jul 1, 2024

Summary by CodeRabbit

  • Enhancements
    • Improved configuration flexibility by allowing null values for normalizerRegistrationStrategy and encoderRegistrationStrategy properties.

Copy link

coderabbitai bot commented Jul 1, 2024

Walkthrough

In the Config.php file, the Config class has been modified to allow null values for the properties normalizerRegistrationStrategy and encoderRegistrationStrategy. Additionally, contradictions and invalid parameter defaults have been removed from the file, streamlining its configuration process.

Changes

File Path Change Summary
src/Config.php Updated Config class properties normalizerRegistrationStrategy and encoderRegistrationStrategy to allow null values. Removed contradictions and invalid parameter defaults.

Poem

In the land where code doth fly,
null values now pass by.
Config's harmony, so clear and bright,
No more defaults to cause a fright.
A strategy untold, yet still we trod,
Through bytes and bits, we’ve cleaned the sod.
🌟🐇✨


Tip

Early access features: enabled

We are currently testing the following features in early access:

  • OpenAI gpt-4o model for code reviews and chat: OpenAI claims that this model is better at understanding and generating code than the previous models. We seek your feedback over the next few weeks before making it generally available.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues.
  • OSS projects are currently opted into early access features by default.

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.

Copy link

codecov bot commented Jul 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.43%. Comparing base (1f19892) to head (d3acc11).

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #214   +/-   ##
=========================================
  Coverage     98.43%   98.43%           
  Complexity       74       74           
=========================================
  Files            15       15           
  Lines           255      255           
=========================================
  Hits            251      251           
  Misses            4        4           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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 1f19892 and 0461c6c.

Files ignored due to path filters (1)
  • composer.lock is excluded by !**/*.lock
Files selected for processing (1)
  • src/Config.php (1 hunks)
Additional context used
GitHub Check: mutation-testing (ubuntu-latest, 8.2, locked)
src/Config.php

[warning] 30-30:
Escaped Mutant for Mutator "FalseValue":

--- Original
+++ New
@@ @@
private const REQUIRED_FIELDS = ['default', 'debug', 'normalizerRegistrationStrategy', 'encoderRegistrationStrategy', 'metadataLoader'];
public function __construct(
private readonly string $defaultSerializer = 'symfony-json',

  •    private readonly bool $debug = false,
    
  •    private readonly bool $debug = true,
       /** @var class-string<NormalizerRegistrationStrategy>|null */
       private readonly ?string $normalizerRegistrationStrategy = null,
       /** @var class-string<EncoderRegistrationStrategy>|null */
    
GitHub Check: psalm (ubuntu-latest, 8.2, locked)
src/Config.php

[failure] 1-1: UnusedBaselineEntry
src/Config.php:0:0: UnusedBaselineEntry: Baseline for issue "DocblockTypeContradiction" has 2 extra entries. (see https://psalm.dev/316)


[failure] 1-1: UnusedBaselineEntry
src/Config.php:0:0: UnusedBaselineEntry: Baseline for issue "InvalidParamDefault" has 2 extra entries. (see https://psalm.dev/316)

Additional comments not posted (2)
src/Config.php (2)

31-31: LGTM! The property normalizerRegistrationStrategy is updated to allow null values.

This change aligns with the objective of allowing null values and initializing them to null.


33-33: LGTM! The property encoderRegistrationStrategy is updated to allow null values.

This change aligns with the objective of allowing null values and initializing them to null.

@lotyp lotyp merged commit 141ffaf into master Jul 1, 2024
26 checks passed
@lotyp lotyp deleted the chore/exp branch July 1, 2024 15:48
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 0461c6c and d3acc11.

Files ignored due to path filters (1)
  • composer.lock is excluded by !**/*.lock
Files selected for processing (2)
  • psalm-baseline.xml (1 hunks)
  • src/Config.php (1 hunks)
Additional context used
GitHub Check: mutation-testing (ubuntu-latest, 8.2, locked)
src/Config.php

[warning] 30-30:
Escaped Mutant for Mutator "FalseValue":

--- Original
+++ New
@@ @@
private const REQUIRED_FIELDS = ['default', 'debug', 'normalizerRegistrationStrategy', 'encoderRegistrationStrategy', 'metadataLoader'];
public function __construct(
private readonly string $defaultSerializer = 'symfony-json',

  •    private readonly bool $debug = false,
    
  •    private readonly bool $debug = true,
       /** @var class-string<NormalizerRegistrationStrategy>|null */
       private readonly ?string $normalizerRegistrationStrategy = null,
       /** @var class-string<EncoderRegistrationStrategy>|null */
    
Additional comments not posted (6)
src/Config.php (5)

Line range hint 39-57: LGTM!

The code changes are approved.

Tools
GitHub Check: mutation-testing (ubuntu-latest, 8.2, locked)

[warning] 30-30:
Escaped Mutant for Mutator "FalseValue":

--- Original
+++ New
@@ @@
private const REQUIRED_FIELDS = ['default', 'debug', 'normalizerRegistrationStrategy', 'encoderRegistrationStrategy', 'metadataLoader'];
public function __construct(
private readonly string $defaultSerializer = 'symfony-json',

  •    private readonly bool $debug = false,
    
  •    private readonly bool $debug = true,
       /** @var class-string<NormalizerRegistrationStrategy>|null */
       private readonly ?string $normalizerRegistrationStrategy = null,
       /** @var class-string<EncoderRegistrationStrategy>|null */
    

Line range hint 67-74: LGTM!

The code changes are approved.

Tools
GitHub Check: mutation-testing (ubuntu-latest, 8.2, locked)

[warning] 30-30:
Escaped Mutant for Mutator "FalseValue":

--- Original
+++ New
@@ @@
private const REQUIRED_FIELDS = ['default', 'debug', 'normalizerRegistrationStrategy', 'encoderRegistrationStrategy', 'metadataLoader'];
public function __construct(
private readonly string $defaultSerializer = 'symfony-json',

  •    private readonly bool $debug = false,
    
  •    private readonly bool $debug = true,
       /** @var class-string<NormalizerRegistrationStrategy>|null */
       private readonly ?string $normalizerRegistrationStrategy = null,
       /** @var class-string<EncoderRegistrationStrategy>|null */
    

Line range hint 76-83: LGTM!

The code changes are approved.

Tools
GitHub Check: mutation-testing (ubuntu-latest, 8.2, locked)

[warning] 30-30:
Escaped Mutant for Mutator "FalseValue":

--- Original
+++ New
@@ @@
private const REQUIRED_FIELDS = ['default', 'debug', 'normalizerRegistrationStrategy', 'encoderRegistrationStrategy', 'metadataLoader'];
public function __construct(
private readonly string $defaultSerializer = 'symfony-json',

  •    private readonly bool $debug = false,
    
  •    private readonly bool $debug = true,
       /** @var class-string<NormalizerRegistrationStrategy>|null */
       private readonly ?string $normalizerRegistrationStrategy = null,
       /** @var class-string<EncoderRegistrationStrategy>|null */
    

Line range hint 85-92: LGTM!

The code changes are approved.

Tools
GitHub Check: mutation-testing (ubuntu-latest, 8.2, locked)

[warning] 30-30:
Escaped Mutant for Mutator "FalseValue":

--- Original
+++ New
@@ @@
private const REQUIRED_FIELDS = ['default', 'debug', 'normalizerRegistrationStrategy', 'encoderRegistrationStrategy', 'metadataLoader'];
public function __construct(
private readonly string $defaultSerializer = 'symfony-json',

  •    private readonly bool $debug = false,
    
  •    private readonly bool $debug = true,
       /** @var class-string<NormalizerRegistrationStrategy>|null */
       private readonly ?string $normalizerRegistrationStrategy = null,
       /** @var class-string<EncoderRegistrationStrategy>|null */
    

31-33: LGTM! But verify the default value for debug.

The code changes are approved.

However, ensure that the default value for debug is correctly set to false.

Verification successful

The default value for debug is correctly set to false.

The property definition in src/Config.php confirms this:

  • src/Config.php: private readonly bool $debug = false,
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the default value for `debug`.

# Test: Search for the usage of the constructor to ensure the default value for `debug` is correctly set.
rg --type php $'new Config'

Length of output: 28



Script:

#!/bin/bash
# Description: Verify the default value for `debug` in the Config class.

# Search for the definition of the `debug` property in the Config class.
ast-grep --lang php --pattern '$debug = $_' > debug_property.txt

# Output the results to verify the default value for `debug`.
cat debug_property.txt

Length of output: 177



Script:

#!/bin/bash
# Description: Verify the default value for `debug` in the Config class.

# Search for the definition of the `debug` property in the Config class.
rg --type php 'private $debug' > debug_property.txt

# Output the results to verify the default value for `debug`.
cat debug_property.txt

Length of output: 57



Script:

#!/bin/bash
# Description: Verify the default value for `debug` in the Config class.

# Search for the definition of the `debug` property in the Config class, including all visibility keywords.
rg --type php '\$debug' > debug_property.txt

# Output the results to verify the default value for `debug`.
cat debug_property.txt

Length of output: 198

psalm-baseline.xml (1)

Line range hint 1-155: LGTM!

The changes related to static analysis are approved.

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.

1 participant