-
Notifications
You must be signed in to change notification settings - Fork 109
Make classes final and add some types #390
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
Conversation
|
Warning Rate limit exceeded@norkunas has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 9 minutes and 29 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (40)
WalkthroughApplied widespread type-safety and signature tightening: classes made final, constructor property promotion used, static properties typed as arrays, explicit return types added, and PHPDoc array annotations refined across DI, provider factories, plugins, validators, and commands. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
e3f49b7 to
a016c5b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (1)
src/ProviderFactory/ProviderFactoryInterface.php (1)
16-21: Verify if exception imports are necessary.These exception classes are imported but only referenced in
@throwsdocblock annotations. While useful for IDE support and documentation, they are technically unused at runtime. This is acceptable for documentation purposes, but consider if the imports are needed given that the interface itself doesn't throw these exceptions directly.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (40)
phpstan-baseline.phpsrc/BazingaGeocoderBundle.phpsrc/Command/GeocodeCommand.phpsrc/DataCollector/GeocoderDataCollector.phpsrc/DependencyInjection/BazingaGeocoderExtension.phpsrc/DependencyInjection/Compiler/FactoryValidatorPass.phpsrc/DependencyInjection/Configuration.phpsrc/Doctrine/ORM/GeocoderListener.phpsrc/Plugin/FakeIpPlugin.phpsrc/Plugin/ProfilingPlugin.phpsrc/ProviderFactory/AbstractFactory.phpsrc/ProviderFactory/AlgoliaFactory.phpsrc/ProviderFactory/ArcGISOnlineFactory.phpsrc/ProviderFactory/BingMapsFactory.phpsrc/ProviderFactory/ChainFactory.phpsrc/ProviderFactory/FreeGeoIpFactory.phpsrc/ProviderFactory/GeoIP2Factory.phpsrc/ProviderFactory/GeoPluginFactory.phpsrc/ProviderFactory/GeonamesFactory.phpsrc/ProviderFactory/GoogleMapsFactory.phpsrc/ProviderFactory/GoogleMapsPlacesFactory.phpsrc/ProviderFactory/HereFactory.phpsrc/ProviderFactory/HostIpFactory.phpsrc/ProviderFactory/IpInfoDbFactory.phpsrc/ProviderFactory/IpInfoFactory.phpsrc/ProviderFactory/IpstackFactory.phpsrc/ProviderFactory/LocationIQFactory.phpsrc/ProviderFactory/MapQuestFactory.phpsrc/ProviderFactory/MapboxFactory.phpsrc/ProviderFactory/MaxMindFactory.phpsrc/ProviderFactory/NominatimFactory.phpsrc/ProviderFactory/OpenCageFactory.phpsrc/ProviderFactory/OpenRouteServiceFactory.phpsrc/ProviderFactory/PickPointFactory.phpsrc/ProviderFactory/PluginProviderFactory.phpsrc/ProviderFactory/ProviderFactoryInterface.phpsrc/ProviderFactory/TomTomFactory.phpsrc/ProviderFactory/YandexFactory.phpsrc/Validator/Constraint/AddressValidator.phptests/Plugin/FakeIpPluginTest.php
🧰 Additional context used
🧬 Code graph analysis (22)
src/ProviderFactory/ChainFactory.php (2)
src/ProviderFactory/AbstractFactory.php (1)
configureOptionResolver(93-95)src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)
src/ProviderFactory/LocationIQFactory.php (17)
src/ProviderFactory/AlgoliaFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/ArcGISOnlineFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/BingMapsFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/FreeGeoIpFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/GeonamesFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GoogleMapsFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/GoogleMapsPlacesFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/HereFactory.php (1)
configureOptionResolver(49-64)src/ProviderFactory/HostIpFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpInfoDbFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpstackFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/MapQuestFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/MapboxFactory.php (1)
configureOptionResolver(35-48)src/ProviderFactory/MaxMindFactory.php (1)
configureOptionResolver(37-48)src/DependencyInjection/Compiler/AddProvidersPass.php (1)
AddProvidersPass(23-43)
src/DataCollector/GeocoderDataCollector.php (2)
src/Plugin/ProfilingPlugin.php (1)
ProfilingPlugin(27-94)src/DependencyInjection/Compiler/ProfilerPass.php (2)
ProfilerPass(25-39)process(27-38)
src/ProviderFactory/GeoIP2Factory.php (2)
src/ProviderFactory/AbstractFactory.php (1)
configureOptionResolver(93-95)src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)
src/ProviderFactory/HereFactory.php (7)
src/ProviderFactory/ArcGISOnlineFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/FreeGeoIpFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/GoogleMapsPlacesFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/HostIpFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/MapboxFactory.php (1)
configureOptionResolver(35-48)
src/ProviderFactory/FreeGeoIpFactory.php (2)
src/ProviderFactory/ArcGISOnlineFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)
src/ProviderFactory/OpenCageFactory.php (4)
src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/HereFactory.php (1)
configureOptionResolver(49-64)src/ProviderFactory/IpstackFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/MapboxFactory.php (1)
configureOptionResolver(35-48)
src/ProviderFactory/IpInfoFactory.php (4)
src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/HereFactory.php (1)
configureOptionResolver(49-64)src/ProviderFactory/HostIpFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/MapboxFactory.php (1)
configureOptionResolver(35-48)
src/ProviderFactory/MapQuestFactory.php (16)
src/ProviderFactory/AlgoliaFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/ArcGISOnlineFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/BingMapsFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/FreeGeoIpFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/GeonamesFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GoogleMapsFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/GoogleMapsPlacesFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/HereFactory.php (1)
configureOptionResolver(49-64)src/ProviderFactory/HostIpFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpInfoDbFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpstackFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/LocationIQFactory.php (1)
configureOptionResolver(35-44)src/ProviderFactory/MapboxFactory.php (1)
configureOptionResolver(35-48)src/ProviderFactory/MaxMindFactory.php (1)
configureOptionResolver(37-48)
src/DependencyInjection/Configuration.php (8)
src/Command/GeocodeCommand.php (1)
__construct(41-45)src/DataCollector/GeocoderDataCollector.php (1)
__construct(31-35)src/Doctrine/ORM/GeocoderListener.php (1)
__construct(29-33)src/Plugin/FakeIpPlugin.php (1)
__construct(31-40)src/Plugin/ProfilingPlugin.php (1)
__construct(37-40)src/ProviderFactory/AbstractFactory.php (1)
__construct(33-36)src/Validator/Constraint/AddressValidator.php (1)
__construct(28-31)tests/DependencyInjection/ConfigurationTest.php (3)
ConfigurationTest(23-53)testGetConfigTreeBuilderNoDebug(41-52)testGetConfigTreeBuilder(25-39)
src/ProviderFactory/IpInfoDbFactory.php (3)
src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/HostIpFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)
src/ProviderFactory/TomTomFactory.php (16)
src/ProviderFactory/AlgoliaFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/ArcGISOnlineFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/BingMapsFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/FreeGeoIpFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/GeonamesFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GoogleMapsFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/GoogleMapsPlacesFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/HereFactory.php (1)
configureOptionResolver(49-64)src/ProviderFactory/HostIpFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpInfoDbFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpstackFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/LocationIQFactory.php (1)
configureOptionResolver(35-44)src/ProviderFactory/MapQuestFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/MapboxFactory.php (1)
configureOptionResolver(35-48)
src/ProviderFactory/ProviderFactoryInterface.php (1)
src/ProviderFactory/AbstractFactory.php (2)
createProvider(43-52)validate(54-73)
src/ProviderFactory/HostIpFactory.php (16)
src/ProviderFactory/AlgoliaFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/ArcGISOnlineFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/BingMapsFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/FreeGeoIpFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/GeonamesFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GoogleMapsFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/GoogleMapsPlacesFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/HereFactory.php (1)
configureOptionResolver(49-64)src/ProviderFactory/IpInfoDbFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpstackFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/LocationIQFactory.php (1)
configureOptionResolver(35-44)src/ProviderFactory/MapQuestFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/MapboxFactory.php (1)
configureOptionResolver(35-48)src/ProviderFactory/MaxMindFactory.php (1)
configureOptionResolver(37-48)
src/ProviderFactory/AbstractFactory.php (5)
src/ProviderFactory/ProviderFactoryInterface.php (1)
validate(47-47)src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/HereFactory.php (1)
configureOptionResolver(49-64)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/MapQuestFactory.php (1)
configureOptionResolver(37-48)
src/ProviderFactory/GeoPluginFactory.php (5)
src/ProviderFactory/BingMapsFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/HereFactory.php (1)
configureOptionResolver(49-64)src/ProviderFactory/HostIpFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/MapboxFactory.php (1)
configureOptionResolver(35-48)
src/ProviderFactory/MaxMindFactory.php (3)
src/ProviderFactory/BingMapsFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)
src/ProviderFactory/YandexFactory.php (5)
src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/HereFactory.php (1)
configureOptionResolver(49-64)src/ProviderFactory/HostIpFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/MapboxFactory.php (1)
configureOptionResolver(35-48)
src/ProviderFactory/NominatimFactory.php (3)
src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/HostIpFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)
src/ProviderFactory/BingMapsFactory.php (3)
src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpstackFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/MapboxFactory.php (1)
configureOptionResolver(35-48)
src/ProviderFactory/GeonamesFactory.php (4)
src/ProviderFactory/ArcGISOnlineFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GoogleMapsFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/HereFactory.php (1)
configureOptionResolver(49-64)src/ProviderFactory/MapboxFactory.php (1)
configureOptionResolver(35-48)
src/ProviderFactory/AlgoliaFactory.php (4)
src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/GoogleMapsFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/MapboxFactory.php (1)
configureOptionResolver(35-48)
🪛 GitHub Actions: CI
src/Command/GeocodeCommand.php
[error] 27-27: Unknown named parameter $help detected in Symfony Console command. This suggests a PHP 8+ named parameter usage incompatible with the installed Symfony Console version. Update command to use positional/option definitions compatible with the current Symfony version.
🪛 PHPMD (2.15.0)
src/ProviderFactory/AbstractFactory.php
93-93: Avoid unused parameters such as '$resolver'. (undefined)
(UnusedFormalParameter)
src/Plugin/ProfilingPlugin.php
42-42: Avoid unused parameters such as '$first'. (undefined)
(UnusedFormalParameter)
🔇 Additional comments (56)
src/BazingaGeocoderBundle.php (1)
24-24: LGTM! Making the bundle class final follows best practices.Making the bundle class final prevents unintended inheritance and potential breaking changes. Bundle entry point classes are typically not meant to be extended.
src/DependencyInjection/Compiler/FactoryValidatorPass.php (3)
27-29: LGTM! Property type declaration improves type safety.The addition of the
arraytype hint and thelist<non-empty-string>PHPDoc annotation strengthens type safety and provides valuable information for static analysis tools.
41-43: LGTM! Method signature improvements enhance type safety.The explicit
stringtype hint for the parameter andvoidreturn type, along with thenon-empty-stringPHPDoc annotation, improve type safety and align with the property type declaration.
24-24: Verify if this class should be markedfinal.The PR title indicates "Make classes final and add some types," but this class is not marked as
final. Please confirm whether this is intentional or if thefinalmodifier should be added to align with the PR objectives.src/DependencyInjection/Configuration.php (2)
24-27: Excellent refactoring with promoted properties.The conversion to a promoted
readonlyproperty is a great improvement that:
- Reduces boilerplate by eliminating explicit property declaration and assignment
- Adds immutability guarantees via
readonly- Maintains type safety with explicit
booltype- Aligns with patterns used throughout the codebase
22-22: Making Configuration final is appropriate and safe for a Symfony configuration class.No classes in the codebase extend Configuration, confirming the
finalkeyword change does not introduce breaking changes.src/Doctrine/ORM/GeocoderListener.php (1)
27-27: LGTM! Making this internal listener final is appropriate.The
finalmodifier prevents unintended inheritance and aligns well with the PR objectives. Since this is an infrastructure class that users typically wouldn't extend, addingfinalis a reasonable change—they would create their own listener rather than subclass this one.src/Validator/Constraint/AddressValidator.php (4)
26-26: LGTM! Class finalization aligns with PR objectives.Making the validator class final is a good practice and aligns with the PR's goal to systematize type safety. Note that this is a breaking change if any consumers have extended this class.
60-60: LGTM! Explicit return type improves clarity.Adding the
: voidreturn type to the helper method is a good practice that makes the method's contract explicit.
33-33: Good addition of explicit type hints.The signature properly implements the parent
ConstraintValidator::validatemethod with modern type declarations:mixed $valueand explicit: voidreturn type are consistent with Symfony's documented constraint validator pattern. This enhances type safety without changing the method's behavior.
28-30: Excellent use of constructor property promotion and readonly.The change from
protectedtoprivate readonlywith property promotion is a clean improvement. Thereadonlykeyword is supported as of PHP 8.1.0, and the project's composer.json specifies^8.1, so this feature is fully compatible. The improvements are solid:
privateis appropriate since the class is now finalreadonlyensures immutability- Property promotion reduces boilerplate
tests/Plugin/FakeIpPluginTest.php (1)
21-21: LGTM! Documentation fix.The closing angle bracket in the author's email address has been corrected.
src/Plugin/FakeIpPlugin.php (2)
31-35: Excellent refactoring: constructor property promotion with readonly.The constructor now uses promoted properties, which is cleaner and more concise. The
readonlymodifier is appropriate since these values are immutable after construction. The trailing comma is good practice for easier maintenance.Changes preserve the original behavior while improving code quality.
27-27: Good practice: marking class as final.Making the class final prevents unintended inheritance and aligns with the PR objectives. Verified that no subclasses of
FakeIpPluginexist in the codebase.src/ProviderFactory/PluginProviderFactory.php (1)
28-28: LGTM! Documentation simplification.The PHPDoc update from
array<mixed, mixed>toarray<mixed>is a reasonable simplification that maintains clarity while being more concise.src/DependencyInjection/BazingaGeocoderExtension.php (3)
80-80: LGTM! Explicit return type.Adding the
: voidreturn type improves type safety and makes the method signature more explicit.
92-92: LGTM! Cleanup of unused variable.Dropping the unused exception variable
$eis a good cleanup.
119-121: LGTM! Improved PHPDoc annotations.The changes improve clarity:
array<mixed>is more concise thanarray<mixed, mixed>list<Reference>is more precise thanReference[]as it indicates a sequential integer-indexed arraysrc/Command/GeocodeCommand.php (1)
39-45: LGTM! Modern PHP patterns.The addition of the
finalkeyword and constructor property promotion are excellent modernizations:
finalprevents unintended inheritancereadonlyensures immutability- Constructor property promotion reduces boilerplate
phpstan-baseline.php (1)
92-92: LGTM! Baseline reflects improved typing.The phpstan baseline updates align with the type improvements made across the codebase in this PR. The tightened expectations (non-empty-string, simplified array types) reflect better type safety.
Also applies to: 128-128
src/ProviderFactory/ChainFactory.php (1)
28-28: LGTM! Consistent type annotations.Adding explicit
arraytype to$dependenciesand: voidreturn type toconfigureOptionResolverimproves type safety and consistency across provider factories.Also applies to: 45-45
src/ProviderFactory/BingMapsFactory.php (1)
23-23: LGTM! Consistent type annotations.Adding explicit
arraytype to$dependenciesand: voidreturn type toconfigureOptionResolverimproves type safety and aligns with the pattern applied across all provider factories in this PR.Also applies to: 37-37
src/ProviderFactory/TomTomFactory.php (1)
23-23: LGTM! Consistent type annotations.Adding explicit
arraytype to$dependenciesand: voidreturn type toconfigureOptionResolverimproves type safety and maintains consistency with other provider factories.Also applies to: 37-37
src/ProviderFactory/MapQuestFactory.php (1)
23-23: LGTM! Consistent type annotations.Adding explicit
arraytype to$dependenciesand: voidreturn type toconfigureOptionResolvercompletes the consistent type safety improvements across all provider factories.Also applies to: 37-37
src/ProviderFactory/LocationIQFactory.php (1)
21-21: LGTM! Excellent type safety improvements.Adding explicit
arraytype to the static$dependenciesproperty and the: voidreturn type toconfigureOptionResolverimproves type safety without changing behavior. These changes align with modern PHP typing best practices.Also applies to: 35-35
src/ProviderFactory/PickPointFactory.php (1)
23-23: LGTM! Consistent type improvements.The explicit
arraytype for$dependenciesand: voidreturn type forconfigureOptionResolverenhance type safety. These changes are consistent with the pattern applied across all provider factories.Also applies to: 37-37
src/ProviderFactory/HereFactory.php (1)
23-23: LGTM! Type safety improvements.Adding explicit types for
$dependenciesand the: voidreturn type forconfigureOptionResolverstrengthens type safety. The changes are consistent with the broader refactoring pattern across provider factories.Also applies to: 49-49
src/ProviderFactory/FreeGeoIpFactory.php (1)
23-23: LGTM! Type declarations aligned.The explicit
arraytype and: voidreturn type enhance type safety. These changes are well-aligned with the systematic typing improvements throughout the codebase.Also applies to: 37-37
src/ProviderFactory/NominatimFactory.php (1)
23-23: LGTM! Type safety enhanced.The explicit typing for
$dependenciesand the: voidreturn type forconfigureOptionResolverimprove type safety. These changes maintain consistency with the broader refactoring effort.Also applies to: 37-37
src/ProviderFactory/OpenRouteServiceFactory.php (1)
23-23: LGTM! Typing improvements applied.The explicit
arraytype for$dependenciesand: voidreturn type strengthen type safety. These changes follow the consistent pattern applied throughout the provider factories.Also applies to: 37-37
src/ProviderFactory/IpInfoFactory.php (1)
23-23: LGTM! Type declarations added.The explicit
arraytype and: voidreturn type enhance type safety. These changes are consistent with the systematic improvements across all provider factory classes.Also applies to: 37-37
src/ProviderFactory/HostIpFactory.php (1)
23-23: LGTM! Type safety improvements complete.The explicit
arraytype for$dependenciesand: voidreturn type forconfigureOptionResolverenhance type safety. These changes complete the consistent typing improvements across all provider factories in this PR.Also applies to: 37-37
src/ProviderFactory/AlgoliaFactory.php (1)
23-23: LGTM! Type annotations improve static analysis.The explicit
arraytype for$dependenciesand: voidreturn type forconfigureOptionResolverstrengthen type safety without altering behavior.Also applies to: 37-37
src/ProviderFactory/OpenCageFactory.php (1)
23-23: LGTM! Type annotations improve static analysis.The explicit
arraytype for$dependenciesand: voidreturn type forconfigureOptionResolverstrengthen type safety without altering behavior.Also applies to: 37-37
src/ProviderFactory/MaxMindFactory.php (1)
23-23: LGTM! Type annotations improve static analysis.The explicit
arraytype for$dependenciesand: voidreturn type forconfigureOptionResolverstrengthen type safety without altering behavior.Also applies to: 37-37
src/ProviderFactory/GoogleMapsFactory.php (1)
23-23: LGTM! Type annotations improve static analysis.The explicit
arraytype for$dependenciesand: voidreturn type forconfigureOptionResolverstrengthen type safety without altering behavior.Also applies to: 37-37
src/ProviderFactory/IpInfoDbFactory.php (1)
23-23: LGTM! Type annotations improve static analysis.The explicit
arraytype for$dependenciesand: voidreturn type forconfigureOptionResolverstrengthen type safety without altering behavior.Also applies to: 37-37
src/ProviderFactory/GeoIP2Factory.php (1)
25-25: LGTM! Type annotations improve static analysis.The explicit
arraytype for$dependenciesand: voidreturn type forconfigureOptionResolverstrengthen type safety without altering behavior.Also applies to: 50-50
src/ProviderFactory/MapboxFactory.php (1)
21-21: LGTM! Type annotations improve static analysis.The explicit
arraytype for$dependenciesand: voidreturn type forconfigureOptionResolverstrengthen type safety without altering behavior.Also applies to: 35-35
src/ProviderFactory/GeoPluginFactory.php (1)
23-23: LGTM! Type annotations improve static analysis.The explicit
arraytype for$dependenciesand: voidreturn type forconfigureOptionResolverstrengthen type safety without altering behavior.Also applies to: 37-37
src/ProviderFactory/GeonamesFactory.php (1)
23-25: LGTM!The explicit
arraytype on$dependenciesand thevoidreturn type onconfigureOptionResolveralign with the base class changes inAbstractFactoryand improve type safety consistently with other provider factories in this PR.Also applies to: 37-46
src/ProviderFactory/YandexFactory.php (1)
23-25: LGTM!The typed
$dependenciesproperty andvoidreturn type are consistent with the refactoring pattern applied across all provider factories.Also applies to: 37-48
src/ProviderFactory/GoogleMapsPlacesFactory.php (1)
23-25: LGTM!Type annotations are correctly applied, consistent with other factory implementations.
Also applies to: 37-46
src/ProviderFactory/IpstackFactory.php (1)
23-25: LGTM!Typed property and void return type align with the codebase-wide type safety improvements.
Also applies to: 37-46
src/ProviderFactory/ArcGISOnlineFactory.php (1)
23-25: LGTM!Type improvements are consistent with the broader refactoring effort.
Also applies to: 37-46
src/ProviderFactory/AbstractFactory.php (2)
31-36: Clean modernization using PHP 8+ features.The typed static property and constructor property promotion are well-applied, reducing boilerplate while improving type safety.
93-95: Unused parameter is intentional for override pattern.The static analysis warning about unused
$resolveris a false positive. This is an abstract base implementation designed to be overridden by subclasses that configure the resolver.src/Plugin/ProfilingPlugin.php (6)
27-27: Good use offinalkeyword.Making the class final prevents inheritance and aligns with the PR's objectives to improve type safety and immutability.
32-32: Explicit array type declaration approved.The explicit type declaration with initialization improves type safety while maintaining consistency with the detailed PHPDoc shape annotation above.
37-40: Constructor property promotion looks good.Using promoted properties is a clean, modern PHP 8+ pattern that reduces boilerplate while maintaining type safety.
59-59: Explicitmixedtype andvoidreturn improve clarity.The signature now clearly documents that the result can be of any type (Collection, Exception, or null) and that the method has no return value.
87-89: Non-empty-string annotation enhances static analysis.The PHPDoc annotation provides valuable information for static analysis tools while maintaining the runtime string return type.
42-42: Verify if the$firstparameter is required by the interface.The
Promisereturn type is a good addition. However, the$firstparameter appears unused in the method body. Please confirm whether this parameter is mandated by thePlugininterface contract or can be safely removed.#!/bin/bash # Description: Check if the Plugin interface requires the $first parameter in handleQuery. # Search for the Plugin interface definition to verify the handleQuery signature ast-grep --pattern $'interface Plugin { $$$ handleQuery($$$) $$$ $$$ }' # Also search with rg to find the interface method signature rg -n -A 3 'interface\s+Plugin' --type=php rg -n -A 3 'function\s+handleQuery' --type=php -g '**/Plugin.php' -g '**/PluginInterface.php'src/DataCollector/GeocoderDataCollector.php (3)
24-24: Good use offinalkeyword.Making the data collector final is appropriate as it's a concrete implementation that shouldn't be extended.
46-46: More explicit array comparison approved.The change from
!empty($this->data['queries'])to[] !== $this->data['queries']is more explicit and type-safe for checking non-empty arrays.
103-103: Explicitvoidreturn type improves clarity.Adding the explicit return type removes the need for the PHPDoc
@return voidannotation and provides better IDE support and type safety.
| * @throws AccessException If called from a lazy option or normalizer | ||
| */ | ||
| public static function validate(array $options, $providerName); | ||
| public static function validate(array $options, string $providerName): void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interface signature mismatch with AbstractFactory::validate.
The interface now declares validate(array $options, string $providerName): void, but AbstractFactory::validate at line 54 still uses an untyped $providerName parameter. This will cause a PHP fatal error due to declaration incompatibility.
🔎 Proposed fix in AbstractFactory.php
- public static function validate(array $options, $providerName): void
+ public static function validate(array $options, string $providerName): voidCommittable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In src/ProviderFactory/ProviderFactoryInterface.php around line 47 and
corresponding AbstractFactory::validate at line 54, the interface declares
validate(array $options, string $providerName): void but
AbstractFactory::validate uses an untyped $providerName causing a signature
mismatch; update AbstractFactory::validate to type-hint the $providerName
parameter as string and keep the static/void signature consistent with the
interface, and optionally update any docblocks and all concrete implementations
to match the new typed signature.
There was a problem hiding this 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
♻️ Duplicate comments (2)
src/ProviderFactory/AbstractFactory.php (1)
54-54: Missingstringtype on$providerNameparameter.This method implements
ProviderFactoryInterface::validatewhich requiresstring $providerName. The untyped parameter will cause a PHP declaration compatibility error.🔎 Proposed fix
- public static function validate(array $options, $providerName): void + public static function validate(array $options, string $providerName): voidsrc/ProviderFactory/ProviderFactoryInterface.php (1)
47-47: Interface signature mismatch withAbstractFactory::validate.As noted in a previous review, the interface now declares
validate(array $options, string $providerName): void, but the relevant code snippet showsAbstractFactory::validateat line 53 still uses an untyped$providerNameparameter. This will cause a PHP fatal error due to declaration incompatibility.Ensure
AbstractFactory::validateis updated to match:public static function validate(array $options, string $providerName): void
🧹 Nitpick comments (1)
src/ProviderFactory/OpenRouteServiceFactory.php (1)
39-44: Redundant default for required option.Setting
'api_key' => nullas a default (line 41) is unnecessary since it's immediately marked as required (line 44). ThesetRequiredcall will override the default, making the null value unreachable. Other factories likeBingMapsFactoryandIpstackFactorydon't set defaults for required options.🔎 Proposed fix
$resolver->setDefaults([ 'http_client' => null, - 'api_key' => null, ]);
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (40)
phpstan-baseline.phpsrc/BazingaGeocoderBundle.phpsrc/Command/GeocodeCommand.phpsrc/DataCollector/GeocoderDataCollector.phpsrc/DependencyInjection/BazingaGeocoderExtension.phpsrc/DependencyInjection/Compiler/FactoryValidatorPass.phpsrc/DependencyInjection/Configuration.phpsrc/Doctrine/ORM/GeocoderListener.phpsrc/Plugin/FakeIpPlugin.phpsrc/Plugin/ProfilingPlugin.phpsrc/ProviderFactory/AbstractFactory.phpsrc/ProviderFactory/AlgoliaFactory.phpsrc/ProviderFactory/ArcGISOnlineFactory.phpsrc/ProviderFactory/BingMapsFactory.phpsrc/ProviderFactory/ChainFactory.phpsrc/ProviderFactory/FreeGeoIpFactory.phpsrc/ProviderFactory/GeoIP2Factory.phpsrc/ProviderFactory/GeoPluginFactory.phpsrc/ProviderFactory/GeonamesFactory.phpsrc/ProviderFactory/GoogleMapsFactory.phpsrc/ProviderFactory/GoogleMapsPlacesFactory.phpsrc/ProviderFactory/HereFactory.phpsrc/ProviderFactory/HostIpFactory.phpsrc/ProviderFactory/IpInfoDbFactory.phpsrc/ProviderFactory/IpInfoFactory.phpsrc/ProviderFactory/IpstackFactory.phpsrc/ProviderFactory/LocationIQFactory.phpsrc/ProviderFactory/MapQuestFactory.phpsrc/ProviderFactory/MapboxFactory.phpsrc/ProviderFactory/MaxMindFactory.phpsrc/ProviderFactory/NominatimFactory.phpsrc/ProviderFactory/OpenCageFactory.phpsrc/ProviderFactory/OpenRouteServiceFactory.phpsrc/ProviderFactory/PickPointFactory.phpsrc/ProviderFactory/PluginProviderFactory.phpsrc/ProviderFactory/ProviderFactoryInterface.phpsrc/ProviderFactory/TomTomFactory.phpsrc/ProviderFactory/YandexFactory.phpsrc/Validator/Constraint/AddressValidator.phptests/Plugin/FakeIpPluginTest.php
🚧 Files skipped from review as they are similar to previous changes (16)
- src/ProviderFactory/IpInfoFactory.php
- src/ProviderFactory/MapboxFactory.php
- src/ProviderFactory/MapQuestFactory.php
- src/ProviderFactory/GeoIP2Factory.php
- src/ProviderFactory/FreeGeoIpFactory.php
- src/ProviderFactory/YandexFactory.php
- src/ProviderFactory/PluginProviderFactory.php
- src/ProviderFactory/PickPointFactory.php
- src/ProviderFactory/LocationIQFactory.php
- src/ProviderFactory/ArcGISOnlineFactory.php
- src/BazingaGeocoderBundle.php
- src/DependencyInjection/Configuration.php
- src/ProviderFactory/IpInfoDbFactory.php
- tests/Plugin/FakeIpPluginTest.php
- src/DependencyInjection/Compiler/FactoryValidatorPass.php
- src/DependencyInjection/BazingaGeocoderExtension.php
🧰 Additional context used
🧬 Code graph analysis (16)
phpstan-baseline.php (2)
src/DependencyInjection/Compiler/AddProvidersPass.php (1)
AddProvidersPass(23-43)tests/DependencyInjection/Compiler/FactoryValidatorPassTest.php (3)
FactoryValidatorPassTest(20-89)setUp(25-30)tearDown(32-40)
src/ProviderFactory/GeoPluginFactory.php (5)
src/ProviderFactory/GoogleMapsFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/HereFactory.php (1)
configureOptionResolver(49-64)src/ProviderFactory/HostIpFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/MapboxFactory.php (1)
configureOptionResolver(35-48)
src/ProviderFactory/OpenCageFactory.php (4)
src/ProviderFactory/BingMapsFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/GoogleMapsFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/MapboxFactory.php (1)
configureOptionResolver(35-48)
src/ProviderFactory/GeonamesFactory.php (4)
src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/GoogleMapsFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/HostIpFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)
src/ProviderFactory/NominatimFactory.php (16)
src/ProviderFactory/AlgoliaFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/ArcGISOnlineFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/BingMapsFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/FreeGeoIpFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/GeonamesFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GoogleMapsFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/GoogleMapsPlacesFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/HereFactory.php (1)
configureOptionResolver(49-64)src/ProviderFactory/HostIpFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpInfoDbFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpstackFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/LocationIQFactory.php (1)
configureOptionResolver(35-44)src/ProviderFactory/MapQuestFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/MapboxFactory.php (1)
configureOptionResolver(35-48)
src/ProviderFactory/MaxMindFactory.php (16)
src/ProviderFactory/AlgoliaFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/ArcGISOnlineFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/BingMapsFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/FreeGeoIpFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/GeonamesFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GoogleMapsFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/GoogleMapsPlacesFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/HereFactory.php (1)
configureOptionResolver(49-64)src/ProviderFactory/HostIpFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpInfoDbFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpstackFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/LocationIQFactory.php (1)
configureOptionResolver(35-44)src/ProviderFactory/MapQuestFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/MapboxFactory.php (1)
configureOptionResolver(35-48)
src/ProviderFactory/ChainFactory.php (16)
src/ProviderFactory/AbstractFactory.php (1)
configureOptionResolver(93-95)src/ProviderFactory/AlgoliaFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/ArcGISOnlineFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/BingMapsFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/FreeGeoIpFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GeoIP2Factory.php (1)
configureOptionResolver(50-74)src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/GeonamesFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GoogleMapsFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/GoogleMapsPlacesFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/HereFactory.php (1)
configureOptionResolver(49-64)src/ProviderFactory/HostIpFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpInfoDbFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpstackFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/LocationIQFactory.php (1)
configureOptionResolver(35-44)
src/ProviderFactory/IpstackFactory.php (4)
src/ProviderFactory/BingMapsFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/HostIpFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)
src/ProviderFactory/HereFactory.php (16)
src/ProviderFactory/AlgoliaFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/ArcGISOnlineFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/BingMapsFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/FreeGeoIpFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/GeonamesFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GoogleMapsFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/GoogleMapsPlacesFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/HostIpFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpInfoDbFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpstackFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/LocationIQFactory.php (1)
configureOptionResolver(35-44)src/ProviderFactory/MapQuestFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/MapboxFactory.php (1)
configureOptionResolver(35-48)src/ProviderFactory/MaxMindFactory.php (1)
configureOptionResolver(37-48)
src/ProviderFactory/GoogleMapsPlacesFactory.php (3)
src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/GoogleMapsFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)
src/ProviderFactory/AbstractFactory.php (3)
src/Command/GeocodeCommand.php (1)
__construct(33-37)src/ProviderFactory/ProviderFactoryInterface.php (1)
validate(47-47)src/ProviderFactory/AlgoliaFactory.php (1)
configureOptionResolver(37-48)
src/ProviderFactory/TomTomFactory.php (16)
src/ProviderFactory/AlgoliaFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/ArcGISOnlineFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/BingMapsFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/FreeGeoIpFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/GeonamesFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GoogleMapsFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/GoogleMapsPlacesFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/HereFactory.php (1)
configureOptionResolver(49-64)src/ProviderFactory/HostIpFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpInfoDbFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/IpstackFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/LocationIQFactory.php (1)
configureOptionResolver(35-44)src/ProviderFactory/MapQuestFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/MapboxFactory.php (1)
configureOptionResolver(35-48)
src/DataCollector/GeocoderDataCollector.php (1)
src/Plugin/ProfilingPlugin.php (1)
ProfilingPlugin(27-94)
src/ProviderFactory/HostIpFactory.php (5)
src/ProviderFactory/BingMapsFactory.php (1)
configureOptionResolver(37-46)src/ProviderFactory/GeoPluginFactory.php (1)
configureOptionResolver(37-44)src/ProviderFactory/GoogleMapsFactory.php (1)
configureOptionResolver(37-48)src/ProviderFactory/HereFactory.php (1)
configureOptionResolver(49-64)src/ProviderFactory/IpInfoFactory.php (1)
configureOptionResolver(37-44)
src/Plugin/FakeIpPlugin.php (8)
src/Command/GeocodeCommand.php (1)
__construct(33-37)src/DataCollector/GeocoderDataCollector.php (1)
__construct(31-35)src/DependencyInjection/Configuration.php (1)
__construct(24-27)src/Doctrine/ORM/GeocoderListener.php (1)
__construct(29-33)src/Plugin/ProfilingPlugin.php (1)
__construct(37-40)src/ProviderFactory/AbstractFactory.php (1)
__construct(33-36)src/Validator/Constraint/AddressValidator.php (1)
__construct(28-31)src/Validator/Constraint/Address.php (1)
__construct(45-50)
src/ProviderFactory/ProviderFactoryInterface.php (1)
src/ProviderFactory/AbstractFactory.php (2)
createProvider(43-52)validate(54-73)
🪛 PHPMD (2.15.0)
src/ProviderFactory/AbstractFactory.php
93-93: Avoid unused parameters such as '$resolver'. (undefined)
(UnusedFormalParameter)
src/Plugin/ProfilingPlugin.php
42-42: Avoid unused parameters such as '$first'. (undefined)
(UnusedFormalParameter)
🔇 Additional comments (42)
src/ProviderFactory/ChainFactory.php (2)
28-30: LGTM! Type declaration improves static analysis.The explicit
arraytype on the static property strengthens type safety and aligns with the pattern applied across all provider factories in this PR.
45-51: LGTM! Explicit void return type enhances clarity.The void return type makes the method contract explicit and consistent with other factory classes updated in this PR.
phpstan-baseline.php (2)
96-101: LGTM! Baseline correctly reflects tightened parameter type.The updated baseline entry correctly reflects that
FactoryValidatorPass::addFactoryServiceId()now expects anon-empty-stringparameter, aligning with the signature changes in the PR.
132-137: LGTM! Baseline updated to match simplified array type.The baseline entry correctly reflects the updated parameter type for
configureProviderPlugins(), which now expects a simplerarraytype instead ofarray<int|string, mixed>.src/ProviderFactory/HostIpFactory.php (2)
23-25: LGTM! Type declaration improves static analysis.The explicit
arraytype on the static property aligns with the consistent pattern applied across all provider factories in this PR.
37-44: LGTM! Explicit void return type enhances clarity.The void return type makes the method contract explicit and consistent with the broader refactoring pattern.
src/Plugin/FakeIpPlugin.php (2)
31-40: LGTM! Constructor property promotion with readonly enhances immutability.The promoted readonly properties make the class safer by preventing accidental modification after construction. The trailing comma is a good practice for easier future modifications.
27-27: LGTM! Final declaration prevents unintended inheritance.Making the class final is appropriate for plugin classes that are not designed for extension. No existing code extends
FakeIpPlugin.src/Command/GeocodeCommand.php (3)
27-30: LGTM! Multi-line attribute format improves readability.The multi-line format for the
AsCommandattribute is clearer and more maintainable. Note that the help text is correctly placed in thesetHelp()method rather than the attribute, ensuring compatibility with Symfony 5.4+.
31-31: LGTM! Final declaration is appropriate for command classes.Making the command class final prevents unintended inheritance, which is a good practice for concrete command implementations.
33-37: LGTM! Constructor property promotion with readonly enhances type safety.The promoted readonly property makes the dependency injection clearer and prevents accidental modification of the geocoder after construction.
src/Validator/Constraint/AddressValidator.php (4)
26-26: LGTM! Final declaration is appropriate for validator classes.Making the validator class final prevents unintended inheritance, which is a good practice for concrete validator implementations.
28-31: LGTM! Constructor property promotion enhances immutability.The promoted readonly property makes the dependency injection clearer and prevents accidental modification of the geocoder after construction.
33-33: LGTM! Signature aligns with Symfony's ConstraintValidator interface.The
mixedparameter type andvoidreturn type correctly match Symfony'sConstraintValidator::validate()signature, improving type safety and interface compliance.
60-67: LGTM! Explicit void return type enhances clarity.The void return type makes the method contract explicit and improves type safety.
src/Plugin/ProfilingPlugin.php (6)
27-27: LGTM! Final declaration is appropriate for plugin classes.Making the class final prevents unintended inheritance, which is a good practice for plugin implementations.
32-32: LGTM! Explicit array type improves static analysis.The typed property declaration strengthens type safety and makes the intent clear.
37-40: LGTM! Constructor property promotion with readonly enhances immutability.The promoted readonly property for the provider name is appropriate since it shouldn't change after construction. The non-empty-string docblock annotation adds useful context.
42-57: LGTM! Explicit Promise return type improves clarity.The return type makes the method contract explicit and aligns with the Plugin interface. The unused
$firstparameter flagged by static analysis is required by the Plugin interface contract, so the warning is a false positive.
59-77: LGTM! Enhanced type safety and error handling.The explicit handling for
GeocodeQueryandReverseQuerywith aLogicExceptionfor unsupported types improves robustness. Themixedparameter type andvoidreturn type strengthen the method signature.
87-93: LGTM! Refined docblock annotation.The
non-empty-stringannotation is accurate since the method returns the constructor-injected name property, which is guaranteed to be a string.src/Doctrine/ORM/GeocoderListener.php (1)
27-33: LGTM! Final declaration prevents unintended inheritance.Making the class final is a good practice for classes not designed for extension. The EventSubscriber implementation remains unchanged. No existing code extends GeocoderListener.
src/DataCollector/GeocoderDataCollector.php (3)
24-24: LGTM!The
finalclass modifier prevents unintended inheritance and aligns with the PR's objective to tighten class declarations across the codebase.
46-46: LGTM!The guard condition change from
!empty($this->data['queries'])to[] !== $this->data['queries']is logically equivalent for arrays and more explicit about the comparison being performed.
103-103: LGTM!The explicit
voidreturn type improves type safety and method signature clarity.src/ProviderFactory/AbstractFactory.php (4)
31-31: LGTM!The explicit
arraytype annotation on the$dependenciesproperty improves type safety and aligns with similar changes across all provider factories.
33-35: LGTM!The constructor property promotion is clean and follows modern PHP 8+ syntax, reducing boilerplate while maintaining clarity.
80-80: LGTM!The explicit
voidreturn type improves method signature clarity.
93-93: LGTM!The explicit
voidreturn type improves method signature clarity. Note: The PHPMD hint about the unused$resolverparameter is a false positive—this abstract template method is designed to be overridden by subclasses that configure the resolver.src/ProviderFactory/GeoPluginFactory.php (1)
23-23: LGTM!The explicit
arraytype on$dependenciesandvoidreturn type onconfigureOptionResolver()improve type safety and align with the PR-wide refactor across all provider factories.Also applies to: 37-37
src/ProviderFactory/NominatimFactory.php (1)
23-23: LGTM!The explicit
arraytype on$dependenciesandvoidreturn type onconfigureOptionResolver()improve type safety and maintain consistency with other provider factories in this PR.Also applies to: 37-37
src/ProviderFactory/GeonamesFactory.php (1)
23-23: LGTM!The explicit
arraytype on$dependenciesandvoidreturn type onconfigureOptionResolver()improve type safety and follow the consistent pattern applied across all provider factories.Also applies to: 37-37
src/ProviderFactory/TomTomFactory.php (1)
23-23: LGTM!The explicit
arraytype on$dependenciesandvoidreturn type onconfigureOptionResolver()improve type safety and maintain consistency with the repository-wide typing improvements.Also applies to: 37-37
src/ProviderFactory/GoogleMapsFactory.php (1)
23-23: LGTM!The explicit
arraytype on$dependenciesandvoidreturn type onconfigureOptionResolver()improve type safety and align with the consistent refactoring pattern across all provider factories.Also applies to: 37-37
src/ProviderFactory/HereFactory.php (1)
23-23: LGTM!The explicit
arraytype on$dependenciesandvoidreturn type onconfigureOptionResolver()improve type safety and complete the consistent typing pattern across all provider factories in this PR.Also applies to: 49-49
src/ProviderFactory/BingMapsFactory.php (1)
23-25: LGTM! Type declarations improve code safety.The explicit
arraytype on$dependenciesand thevoidreturn type onconfigureOptionResolverare correct and align with the broader typing improvements across the provider factories.Also applies to: 37-46
src/ProviderFactory/OpenCageFactory.php (1)
23-25: LGTM!Type declarations are consistent with the other factory implementations.
Also applies to: 37-46
src/ProviderFactory/MaxMindFactory.php (1)
23-25: LGTM!Type declarations are correct. The endpoint validation with
setAllowedValuesis a good practice for constraining configuration options.Also applies to: 37-48
src/ProviderFactory/ProviderFactoryInterface.php (1)
16-21: New exception imports are appropriate.The added imports for OptionsResolver exceptions align with the
@throwsannotations in the PHPDoc block, improving documentation accuracy.src/ProviderFactory/GoogleMapsPlacesFactory.php (1)
23-25: LGTM!Type declarations are consistent with the other factory implementations.
Also applies to: 37-46
src/ProviderFactory/IpstackFactory.php (1)
23-25: LGTM!Type declarations are correct and the configuration pattern for required options is properly implemented.
Also applies to: 37-46
src/ProviderFactory/AlgoliaFactory.php (1)
23-25: LGTM!Type declarations are correct. The optional
api_keyandapp_idconfiguration is appropriate for the AlgoliaPlaces provider which supports both authenticated and unauthenticated usage.Also applies to: 37-48
Summary by CodeRabbit
Refactor
Chores
Tests
✏️ Tip: You can customize this high-level summary in your review settings.