Skip to content

Conversation

@GromNaN
Copy link
Owner

@GromNaN GromNaN commented Dec 2, 2025

Closes #30

Copilot AI review requested due to automatic review settings December 2, 2025 14:38
Copy link

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 updates the codebase to use PHP's ::class notation for all fully qualified class names (FQCNs) instead of string literals. The main change enhances the converter logic to detect FQCN-like strings using a regex pattern, ensuring consistent use of ::class notation throughout the generated configuration files.

Key Changes:

  • Enhanced the formatString() method to detect FQCN patterns using regex in addition to checking for existing classes/interfaces/traits/enums
  • Updated test fixtures to reflect the new ::class notation for all service definitions
  • Removed an unnecessary blank line in the validation method

Reviewed changes

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

File Description
src/XmlToPhpConfigConverter.php Added regex pattern matching to detect FQCN-like strings and format them with ::class notation
tests/Fixtures/config/all_features.php Updated all service definitions to use ::class notation instead of string literals for class names
src/ConvertCommand.php Removed extraneous blank line in the validation method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1046 to +1047
if (class_exists($value) || interface_exists($value) || trait_exists($value) || enum_exists($value)
|| str_contains($value, '\\') && preg_match('/(?(DEFINE)(?<V>[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+))^(?&V)(?:\\\\(?&V))*+$/', $value)) {
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

The regex pattern is complex and lacks explanation. Consider extracting it to a named constant with documentation explaining that it validates PHP namespace and class name syntax according to PHP's identifier rules.

Copilot uses AI. Check for mistakes.
@GromNaN GromNaN merged commit 6d1e6fa into main Dec 2, 2025
1 check passed
@GromNaN GromNaN deleted the class branch December 2, 2025 16:07
@stof stof mentioned this pull request Dec 2, 2025
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.

Class names should be converted to ::class references

3 participants