Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,18 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.{yml,yaml}]
[.github/**/*.{yml,yaml}]
indent_size = 2

[*.{yml,yaml}]
trim_trailing_whitespace = false

[**.md]
indent_size = unset
indent_style = unset

[*.json]
insert_final_newline = false

[*.{neon,neon.dist}]
indent_style = tab
5 changes: 1 addition & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@
"symfony/var-exporter": "^5.4 || ^6.4 || ^7.0",
"symfony/yaml": "^5.4 || ^6.4 || ^7.0"
},
"conflict": {
"geocoder-php/nominatim-provider": "<5.0"
},
"autoload": {
"psr-4": {
"Bazinga\\GeocoderBundle\\": "src/"
Expand All @@ -88,7 +85,7 @@
}
},
"scripts": {
"test": "vendor/bin/simple-phpunit --testsuite main"
"test": "SYMFONY_DEPRECATIONS_HELPER=ignoreFile='./tests/baseline-ignore' vendor/bin/simple-phpunit --testsuite main"
},
Comment on lines +88 to 89
Copy link

@coderabbitai coderabbitai bot Dec 12, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

symfony/phpunit-bridge SYMFONY_DEPRECATIONS_HELPER ignoreFile cross-platform configuration

💡 Result:

Short answer: use the SYMFONY_DEPRECATIONS_HELPER env var with the ignoreFile key (URL-encoded form), point it to a plain-text regex list, and prefer an absolute path or set it inside phpunit.xml to avoid shell/OS quoting issues. Examples below.

Why: the helper accepts a URL-encoded query string (keys like ignoreFile, baselineFile, max[...] etc.). The ignoreFile value is a filesystem path to a text file (one regexp per line). See Symfony docs. [1][2]

Examples

  • Unix / macOS (shell):

    • export and run:
      SYMFONY_DEPRECATIONS_HELPER='ignoreFile=./tests/deprecations-ignore' ./vendor/bin/simple-phpunit
    • absolute path (safer):
      SYMFONY_DEPRECATIONS_HELPER='ignoreFile=/full/path/to/tests/deprecations-ignore' ./vendor/bin/simple-phpunit
      Reference: docs show ignoreFile usage. [1]
  • Windows (CMD):

    • set and run:
      set SYMFONY_DEPRECATIONS_HELPER=ignoreFile=C:\path\to\tests\deprecations-ignore
      vendor\bin\simple-phpunit.bat
    • PowerShell:
      $env:SYMFONY_DEPRECATIONS_HELPER = 'ignoreFile=C:\path\to\tests\deprecations-ignore'; vendor\bin\simple-phpunit
      Note: avoid single-quote URL-encoding in CMD; PowerShell accepts the quoted string. Use absolute Windows path to avoid cwd differences. [1][2]
  • When you must combine multiple options (or include & characters) URL-encode or quote properly:

    • Unix:
      SYMFONY_DEPRECATIONS_HELPER='ignoreFile=./tests/deprecations-ignore&verbose=0' ./vendor/bin/simple-phpunit
    • If values contain ampersands or special chars, percent-encode them (e.g. & → %26) or wrap whole value in single quotes in shells that support it. [2]
  • Safer: put the env var in phpunit.xml to avoid shell quoting differences:



    This is cross-platform because PHPUnit reads phpunit.xml on all OSes. (Docs show using for SYMFONY_DEPRECATIONS_HELPER.) [2]

Tips

  • Use absolute paths to avoid cwd differences.
  • The ignoreFile format: plain text, one regexp per line; lines starting with # are comments. [1]
  • If you need a generated JSON baseline use baselineFile/generateBaseline options (also URL-encoded). [2]

References
[1] Symfony PHPUnit Bridge — Ignoring deprecations / ignoreFile usage. https://symfony.com/doc/current/components/phpunit_bridge.html
[2] Symfony docs (PHPUnit Bridge configuration; environment variable examples and baseline/ignoreFile). https://symfony.com/doc/6.1/components/phpunit_bridge.html


🌐 Web query:

composer.json scripts environment variables Windows POSIX compatibility

💡 Result:

Short answer — use a cross‑platform helper (recommended) or call platform‑specific commands.

Options

  1. Use cross-env (simple, widely used)
  • Install: npm install --save-dev cross-env.
  • composer.json example (runs an npm script but same idea for any command):
    "scripts": { "build-assets": "cross-env APP_ENV=production npm run build" }
  • cross-env lets you write POSIX style VAR=val and it works on Windows and POSIX. [1][2]
  1. Use an env file reader (env-cmd / cross-env-file) if you prefer files
  • Put vars in a file and use env-cmd or cross-env-file to load them before the command. [2][8]
  1. If you cannot add Node tools, call platform-specific forms in composer scripts (less desirable)
  • POSIX: "mycmd": "APP_ENV=production php bin/console …"
  • Windows cmd.exe: "mycmd:windows": "set APP_ENV=production&& php bin/console …" (note spacing/&&)
  • Or PowerShell: $env:APP_ENV='production'; composer …
    Composer can run different script names and you can detect OS in CI to pick the right script, but this is error‑prone. [5]

Notes

  • Composer supports environment substitution in some fields (e.g. scripts/extra) via ${VAR}, but setting inline env reliably across Windows and POSIX is best done with cross-env or an env-loader. [5][1]

Sources
[1] cross-env (package readme / docs).
[2] cross-env / cross-env-shell usage and alternatives (npm/Yarn docs).
[5] Composer: using environment variables in scripts and fields.


Move SYMFONY_DEPRECATIONS_HELPER to phpunit.xml for cross-platform compatibility.

The inline VAR=... cmd syntax is POSIX-shell-specific and will fail on Windows (CMD/PowerShell). Per Symfony's PHPUnit Bridge docs, set this as an environment variable in phpunit.xml.dist instead:

<php>
  <env name="SYMFONY_DEPRECATIONS_HELPER" value="ignoreFile=./tests/baseline-ignore"/>
</php>

This approach works across Windows, macOS, and Linux without shell-specific syntax.

🤖 Prompt for AI Agents
composer.json lines 88-89: the "test" script currently sets
SYMFONY_DEPRECATIONS_HELPER inline using POSIX shell syntax which breaks on
Windows; remove the environment variable from the npm script so the command is
just the PHPUnit invocation (vendor/bin/simple-phpunit --testsuite main) and
instead add the SYMFONY_DEPRECATIONS_HELPER env var to phpunit.xml.dist (or
phpunit.xml) by adding a <php><env name="SYMFONY_DEPRECATIONS_HELPER"
value="ignoreFile=./tests/baseline-ignore"/></php> entry so the variable is set
cross-platform.

Copy link
Member Author

@norkunas norkunas Dec 12, 2025

Choose a reason for hiding this comment

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

well then running vendor/bin/simple-phpunit will always use it and there will be no way to opt-out to check what deprecations are really triggered now and what to cleanup

Copy link

Choose a reason for hiding this comment

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

@norkunas That's a fair point! Having the flexibility to opt-out is valuable for deprecation cleanup work.

You could preserve both cross-platform compatibility and the opt-out ability by providing two scripts:

"scripts": {
  "test": "SYMFONY_DEPRECATIONS_HELPER=ignoreFile='./tests/baseline-ignore' vendor/bin/simple-phpunit --testsuite main",
  "test-all-deprecations": "vendor/bin/simple-phpunit --testsuite main"
}

This way:

  • composer test → ignores baseline deprecations
  • composer test-all-deprecations → shows all deprecations (or direct vendor/bin/simple-phpunit call)
  • Windows users could use the second script or override the env var

That said, if most of your development/CI happens on Unix-like systems and the current approach works for your workflow, the inline env var is perfectly reasonable. The Windows limitation may not be significant for your use case.

"config": {
"allow-plugins": {
Expand Down
14 changes: 14 additions & 0 deletions config/profiling.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Bazinga\GeocoderBundle\DataCollector\GeocoderDataCollector;

return static function (ContainerConfigurator $container) {
$services = $container->services();

$services->set(GeocoderDataCollector::class)
->tag('data_collector', ['template' => '@BazingaGeocoder/Collector/geocoder.html.twig', 'id' => 'geocoder']);
};
6 changes: 0 additions & 6 deletions config/profiling.yml

This file was deleted.

53 changes: 53 additions & 0 deletions config/services.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Bazinga\GeocoderBundle\Command\GeocodeCommand;
use Bazinga\GeocoderBundle\Plugin\FakeIpPlugin;
use Bazinga\GeocoderBundle\Validator\Constraint\AddressValidator;
use Geocoder\Dumper\Dumper;
use Geocoder\Dumper\GeoArray;
use Geocoder\Dumper\GeoJson;
use Geocoder\Dumper\Gpx;
use Geocoder\Dumper\Kml;
use Geocoder\Dumper\Wkb;
use Geocoder\Dumper\Wkt;
use Geocoder\ProviderAggregator;

return static function (ContainerConfigurator $container) {
$services = $container->services();
$services->instanceof(Dumper::class)
->public();

$services
->set(GeoArray::class)
->set(GeoJson::class)
->set(Gpx::class)
->set(Kml::class)
->set(Wkb::class)
->set(Wkt::class)

->load('Bazinga\\GeocoderBundle\\ProviderFactory\\', __DIR__.'/../src/ProviderFactory')
->autowire()
->autoconfigure()

->set(ProviderAggregator::class)

->set(FakeIpPlugin::class)
->args([null, null, false])

->set(GeocodeCommand::class)
->args([
service(ProviderAggregator::class),
])
->tag('console.command')

->set(AddressValidator::class)
->args([
service(ProviderAggregator::class),
])
->tag('validator.constraint_validator')
;
};
41 changes: 0 additions & 41 deletions config/services.yml

This file was deleted.

2 changes: 1 addition & 1 deletion src/Command/GeocodeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/**
* @author Markus Bachmann <markus.bachmann@bachi.biz>
*/
#[AsCommand(name: 'geocoder:geocode', description: 'Geocode an address or a ip address')]
#[AsCommand(name: 'geocoder:geocode', description: 'Geocode an address or an IP address')]
class GeocodeCommand extends Command
{
private ProviderAggregator $geocoder;
Expand Down
8 changes: 4 additions & 4 deletions src/DependencyInjection/BazingaGeocoderExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\DependencyInjection\Reference;

/**
Expand All @@ -50,11 +50,11 @@ public function load(array $configs, ContainerBuilder $container)
$configuration = $this->getConfiguration($configs, $container);
$config = $processor->processConfiguration($configuration, $configs);

$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../../config'));
$loader->load('services.yml');
$loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../../config'));
$loader->load('services.php');

if (true === $config['profiling']['enabled']) {
$loader->load('profiling.yml');
$loader->load('profiling.php');
}

if ($config['fake_ip']['enabled']) {
Expand Down
22 changes: 0 additions & 22 deletions tests/Functional/BundleInitializationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,28 +160,6 @@ public function testBundleWithPluginsYml(): void
self::assertInstanceOf(LoggerPlugin::class, $plugins[0]);
}

public function testBundleWithPluginXml(): void
{
self::bootKernel(['config' => static function (TestKernel $kernel) {
$kernel->addTestConfig(__DIR__.'/config/framework.yml');

if ($kernel::VERSION_ID >= 60000) {
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
}

$kernel->addTestConfig(__DIR__.'/config/service_plugin.xml');
}]);

$container = self::getContainer();

self::assertTrue($container->has('bazinga_geocoder.provider.acme'));
$service = $container->get('bazinga_geocoder.provider.acme');
self::assertInstanceOf(PluginProvider::class, $service);
$plugins = NSA::getProperty($service, 'plugins');
self::assertNotEmpty($plugins);
self::assertInstanceOf(LoggerPlugin::class, $plugins[0]);
}

public function testBundleHasRegisteredDumpers(): void
{
self::bootKernel(['config' => static function (TestKernel $kernel) {
Expand Down
18 changes: 0 additions & 18 deletions tests/Functional/config/service_plugin.xml

This file was deleted.

1 change: 1 addition & 0 deletions tests/baseline-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,4 @@
%Not enabling native lazy objects is deprecated and will be impossible in Doctrine ORM 4.0%
%Not setting "doctrine.orm.enable_native_lazy_objects" to true is deprecated%
%Disabling native lazy objects is deprecated and will be impossible in Doctrine ORM 4.0%
%Class "Nyholm\\Psr7\\Factory\\HttplugFactory" is deprecated since version 1.8, use "Nyholm\\Psr7\\Factory\\Psr17Factory" instead%