Skip to content

Commit

Permalink
change namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Khobosha committed Sep 22, 2021
1 parent 4b37775 commit 2b4428d
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 20 deletions.
6 changes: 0 additions & 6 deletions src/DependencyInjection/A2lixTranslationFormExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
class A2lixTranslationFormExtension extends Extension
{
/**
*
* @param array $configs
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
*/
Expand All @@ -33,11 +32,6 @@ public function load(array $configs, ContainerBuilder $container): void
// Enable gedmo?
if ($container->hasParameter('stof_doctrine_extensions.default_locale')) {
$loader->load('gedmo.xml');

// If persistDefaultTranslation enabled, detect GedmoTranslation annotations is useless
if ($container->getParameter('stof_doctrine_extensions.persist_default_translation')) {
$container->removeDefinition('a2lix_translation_form.listener.controller');
}
}
}
}
1 change: 1 addition & 0 deletions src/DependencyInjection/Compiler/TemplatingPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

class TemplatingPass implements CompilerPassInterface
{
/** {@inheritdoc} */
public function process(ContainerBuilder $container): void
{
if (false !== ($template = $container->getParameter('a2lix_translation_form.templating'))) {
Expand Down
8 changes: 3 additions & 5 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,18 @@

class Configuration implements ConfigurationInterface
{
/**
* {@inheritDoc}
*/
/** {@inheritdoc} */
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('a2lix_translation_form');
$rootNode = method_exists(TreeBuilder::class, 'getRootNode') ? $treeBuilder->getRootNode() : $treeBuilder->root('a2lix_translation_form');
$rootNode = \method_exists(TreeBuilder::class, 'getRootNode') ? $treeBuilder->getRootNode() : $treeBuilder->root('a2lix_translation_form');

$rootNode
->children()
->arrayNode('locales')
->beforeNormalization()
->ifString()
->then(function($v) { return preg_split('/\s*,\s*/', $v); })
->then(function($v) { return \preg_split('/\s*,\s*/', $v); })
->end()
->requiresAtLeastOneElement()
->prototype('scalar')->end()
Expand Down
2 changes: 1 addition & 1 deletion src/Form/DataMapper/GedmoTranslationMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function mapDataToForms($data, $forms)
return;
}

if (!is_array($data) && !is_object($data)) {
if (!\is_array($data) && !\is_object($data)) {
throw new UnexpectedTypeException($data, 'object, array or empty');
}

Expand Down
6 changes: 3 additions & 3 deletions src/Form/DataMapper/IndexByTranslationMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function mapDataToForms($data, $forms)
return;
}

if (!is_array($data) && !is_object($data)) {
if (!\is_array($data) && !\is_object($data)) {
throw new UnexpectedTypeException($data, 'object, array or empty');
}

Expand All @@ -33,14 +33,14 @@ public function mapFormsToData($forms, &$data)
return;
}

if (!is_array($data) && !is_object($data)) {
if (!\is_array($data) && !\is_object($data)) {
throw new UnexpectedTypeException($data, 'object, array or empty');
}

$data = $data ?: new ArrayCollection();

foreach ($forms as $form) {
if (is_object($translation = $form->getData()) && !$translation->getId()) {
if (\is_object($translation = $form->getData()) && !$translation->getId()) {
$locale = $form->getConfig()->getName();
$translation->setLocale($locale);

Expand Down
4 changes: 0 additions & 4 deletions src/Form/EventListener/GedmoTranslationsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;

/**
*
* @author David ALLIX
*/
class GedmoTranslationsListener implements EventSubscriberInterface
{
private $translationForm;
Expand Down
2 changes: 1 addition & 1 deletion src/Form/Type/TranslationsLocalesSelectorType.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct($locales)
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'choices' => array_combine($this->locales, $this->locales),
'choices' => \array_combine($this->locales, $this->locales),
'expanded' => true,
'multiple' => true,
'attr' => [
Expand Down

0 comments on commit 2b4428d

Please sign in to comment.