-
Notifications
You must be signed in to change notification settings - Fork 379
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
Upgrading to Symfony5 #1256
Merged
Merged
Upgrading to Symfony5 #1256
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5a1a4d2
temp workaround
Guite 7476aa5
requested updates
Guite 0740c60
typo
Guite 5a96a61
remove symfony/4.2 support & allow Twig 3 in tests
weaverryan 0b50a3e
bumping enqueue version
weaverryan 65349e4
Adding void return type for PHPUnit
weaverryan 00f2ce6
Returning Event, which is required by newer versions of EventDispatcher
weaverryan b74e0f0
Removing PHPUnit deprecation readAttribute & assertAttributeSame
weaverryan eb08852
Adding BC layer for watermark and paste fiters due to kernel.root_dir…
weaverryan ba92c9a
Update composer.json
weaverryan 715c659
changing BC layer for 2 filters
weaverryan 3f9c29c
allowing enqueue-bundle 0.9, which allows 3.4 support
weaverryan f4d0979
pr/1256: Move 'NonFunctionalFilterExceptionPass' to be called first
michellesanver 6274144
Adjust test for adding compiler pass
michellesanver 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
There are no files selected for viewing
This file contains 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
53 changes: 53 additions & 0 deletions
53
DependencyInjection/Compiler/NonFunctionalFilterExceptionPass.php
This file contains 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 | ||
|
||
namespace Liip\ImagineBundle\DependencyInjection\Compiler; | ||
|
||
use Liip\ImagineBundle\Imagine\Filter\Loader\NonFunctionalPasteFilterLoader; | ||
use Liip\ImagineBundle\Imagine\Filter\Loader\NonFunctionalWatermarkFilterLoader; | ||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
||
/** | ||
* For transitioning from Symfony 4 to Symfony 5 with the removal | ||
* of the kernel.root_dir parameter. | ||
*/ | ||
class NonFunctionalFilterExceptionPass implements CompilerPassInterface | ||
{ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
$canFiltersStillFunction = $container->hasParameter('kernel.root_dir'); | ||
$throwWarning = function(string $filterName) use ($canFiltersStillFunction) { | ||
$message = sprintf( | ||
'The "%s" filter %s in Symfony 5.0. Please use "%s_image" and adapt the "image" option to be relative to the "%%kernel.project_dir%%" instead of "%%kernel.root_dir%%".', | ||
$filterName, | ||
$canFiltersStillFunction ? 'is deprecated and will not work' : 'no longer works', | ||
$filterName | ||
); | ||
|
||
if ($canFiltersStillFunction) { | ||
@trigger_error($message, E_USER_DEPRECATED); | ||
} else { | ||
throw new \InvalidArgumentException($message); | ||
} | ||
}; | ||
|
||
$filterSets = $container->getParameter('liip_imagine.filter_sets'); | ||
foreach ($filterSets as $filterSet) { | ||
foreach ($filterSet['filters'] as $filterName => $filter) { | ||
if ($filterName === 'paste') { | ||
$throwWarning('paste'); | ||
} | ||
|
||
if ($filterName === 'watermark') { | ||
$throwWarning('watermark'); | ||
} | ||
} | ||
} | ||
|
||
// remove the definitions entirely if kernel.root_dir does not exist | ||
if (!$canFiltersStillFunction) { | ||
$container->removeDefinition('liip_imagine.filter.loader.watermark'); | ||
$container->removeDefinition('liip_imagine.filter.loader.paste'); | ||
} | ||
} | ||
} |
This file contains 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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
Oops, something went wrong.
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.
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.
This is a really clear error message! Love this solution :)