-
Notifications
You must be signed in to change notification settings - Fork 109
Switch from yaml to php format services definition #373
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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']); | ||
| }; |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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]) | ||
|
|
||
norkunas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ->set(GeocodeCommand::class) | ||
| ->args([ | ||
| service(ProviderAggregator::class), | ||
| ]) | ||
| ->tag('console.command') | ||
|
|
||
| ->set(AddressValidator::class) | ||
| ->args([ | ||
| service(ProviderAggregator::class), | ||
| ]) | ||
| ->tag('validator.constraint_validator') | ||
| ; | ||
| }; | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
🧩 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):
SYMFONY_DEPRECATIONS_HELPER='ignoreFile=./tests/deprecations-ignore' ./vendor/bin/simple-phpunit
SYMFONY_DEPRECATIONS_HELPER='ignoreFile=/full/path/to/tests/deprecations-ignore' ./vendor/bin/simple-phpunit
Reference: docs show ignoreFile usage. [1]
Windows (CMD):
set SYMFONY_DEPRECATIONS_HELPER=ignoreFile=C:\path\to\tests\deprecations-ignore
vendor\bin\simple-phpunit.bat
$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:
SYMFONY_DEPRECATIONS_HELPER='ignoreFile=./tests/deprecations-ignore&verbose=0' ./vendor/bin/simple-phpunit
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
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
"scripts": { "build-assets": "cross-env APP_ENV=production npm run build" }
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
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_HELPERto phpunit.xml for cross-platform compatibility.The inline
VAR=... cmdsyntax is POSIX-shell-specific and will fail on Windows (CMD/PowerShell). Per Symfony's PHPUnit Bridge docs, set this as an environment variable inphpunit.xml.distinstead:This approach works across Windows, macOS, and Linux without shell-specific syntax.
🤖 Prompt for AI Agents
Uh oh!
There was an error while loading. Please reload this page.
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.
well then running
vendor/bin/simple-phpunitwill always use it and there will be no way to opt-out to check what deprecations are really triggered now and what to cleanupThere 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.
@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:
This way:
composer test→ ignores baseline deprecationscomposer test-all-deprecations→ shows all deprecations (or directvendor/bin/simple-phpunitcall)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.