Skip to content

Conversation

mehmet-yoti
Copy link
Contributor

No description provided.

@Alttaf Alttaf requested a review from Copilot June 27, 2025 10:14
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds PHP 8.4 support and related CI coverage, replaces legacy utf8_encode/utf8_decode calls with mb_convert_encoding, and tightens up type hints with nullable types across the codebase.

  • Switch encoding functions to mb_convert_encoding in both source and tests
  • Update method signatures to use nullable type hints for PHP 8.x compatibility
  • Add PHP 8.4 job to the GitHub Actions workflow and bump composer.json requirement

Reviewed Changes

Copilot reviewed 29 out of 32 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
composer.json Added ^8.4 to supported PHP versions
.github/workflows/tests.yaml Introduced php8-4 job for CI
src/Util/Json.php Replaced utf8_encode with mb_convert_encoding
src/ShareUrl/Policy/DynamicPolicyBuilder.php Made parameters nullable and renamed advanced identity method
tests/Util/JsonTest.php Updated tests to use mb_convert_encoding instead of utf8_decode
tests/ShareUrl/Policy/DynamicPolicyBuilderTest.php Updated test to call the renamed method
Comments suppressed due to low confidence (2)

tests/ShareUrl/Policy/DynamicPolicyBuilderTest.php:722

  • [nitpick] This abbreviated method name is inconsistent with other builder methods which use full words (e.g., withAdvancedIdentityProfileRequirements). Consider keeping the descriptive name for better clarity and API consistency.
            ->withAdvIdentityProfileReqs($advancedIdentityProfileSample)

src/ShareUrl/Policy/DynamicPolicyBuilder.php:414

  • [nitpick] The method name withAdvIdentityProfileReqs is an abbreviation of the original withAdvancedIdentityProfileRequirements. Abbreviations can reduce readability; consider restoring the full, descriptive name to maintain a clear and consistent API.
    public function withAdvIdentityProfileReqs($advancedIdentityProfileRequirements): self

Comment on lines +84 to +102
$latin1String = mb_convert_encoding('éàê', 'ISO-8859-1', 'UTF-8');
$latin1Array = [
mb_convert_encoding('éàê', 'ISO-8859-1', 'UTF-8'),
mb_convert_encoding('çî', 'ISO-8859-1', 'UTF-8')
];
$nestedLatin1Array = [
mb_convert_encoding('éàê', 'ISO-8859-1', 'UTF-8'),
[
mb_convert_encoding('çî', 'ISO-8859-1', 'UTF-8'),
mb_convert_encoding('üñ', 'ISO-8859-1', 'UTF-8')
]
];

$latin1Object = new \stdClass();
$latin1Object->property1 = utf8_decode('éàê');
$latin1Object->property2 = utf8_decode('çî');
$latin1Object->property1 = mb_convert_encoding('éàê', 'ISO-8859-1', 'UTF-8');
$latin1Object->property2 = mb_convert_encoding('çî', 'ISO-8859-1', 'UTF-8');

$nestedLatin1Object = new \stdClass();
$nestedLatin1Object->property = utf8_decode('çî');
$nestedLatin1Object->property = mb_convert_encoding('çî', 'ISO-8859-1', 'UTF-8');
Copy link
Preview

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

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

[nitpick] There are many repeated calls to mb_convert_encoding with the same parameters. Consider extracting a small helper function (e.g., latin1($str)) to DRY up these tests and improve readability.

Copilot uses AI. Check for mistakes.

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