Skip to content

Commit

Permalink
Resolve deprecations, drop support for non-supported Symfony versions
Browse files Browse the repository at this point in the history
  • Loading branch information
bobvandevijver committed Feb 24, 2023
1 parent bbb5eef commit 9f1a322
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 48 deletions.
30 changes: 15 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@
}
],
"require": {
"php": ">=7.0",
"symfony/config": "~3.4 || ~4.3 || ~5.0 || ~6.0",
"symfony/console": "~3.4 || ~4.3 || ~5.0 || ~6.0",
"symfony/dependency-injection": "~3.4 || ~4.3 || ~5.0 || ~6.0",
"symfony/filesystem": "~3.4 || ~4.3 || ~5.0 || ~6.0",
"symfony/finder": "~3.4 || ~4.3 || ~5.0 || ~6.0",
"symfony/form": "~3.4 || ~4.3 || ~5.0 || ~6.0",
"symfony/framework-bundle": "~3.4 || ~4.3 || ~5.0 || ~6.0",
"symfony/http-foundation": "~3.4 || ~4.3 || ~5.0 || ~6.0",
"symfony/http-kernel": "~3.4 || ~4.3 || ~5.0 || ~6.0",
"symfony/options-resolver": "~3.4 || ~4.3 || ~5.0 || ~6.0",
"symfony/process": "~3.4 || ~4.3 || ~5.0 || ~6.0",
"twig/twig": "~1.38 || ~2.15 || ~3.0"
"php": ">=8.1",
"symfony/config": "^4.4 || ^5.4 || ^6.2",
"symfony/console": "^4.4 || ^5.4 || ^6.2",
"symfony/dependency-injection": "^4.4 || ^5.4 || ^6.2",
"symfony/filesystem": "^4.4 || ^5.4 || ^6.2",
"symfony/finder": "^4.4 || ^5.4 || ^6.2",
"symfony/form": "^4.4 || ^5.4 || ^6.2",
"symfony/framework-bundle": "^4.4 || ^5.4 || ^6.2",
"symfony/http-foundation": "^4.4 || ^5.4 || ^6.2",
"symfony/http-kernel": "^4.4 || ^5.4 || ^6.2",
"symfony/options-resolver": "^4.4 || ^5.4 || ^6.2",
"symfony/process": "^4.4 || ^5.4 || ^6.2",
"twig/twig": "^2.15 || ^3.0"
},
"require-dev": {
"symfony/string": "~5.0",
"symfony/lock": "~3.4 || ~4.3 || ~5.0",
"symfony/string": "^4.4 || ^5.4 || ^6.2",
"symfony/lock": "^4.4 || ^5.4 || ^6.2",
"phpunit/phpunit": "^9.5"
},
"suggest": {
Expand Down
13 changes: 4 additions & 9 deletions src/Command/LatexTestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,8 @@

class LatexTestCommand extends Command
{
/**
* @var LatexGeneratorInterface
*/
private $latexGenerator;

public function __construct(LatexGeneratorInterface $latexGenerator) {
public function __construct(private readonly LatexGeneratorInterface $latexGenerator) {
parent::__construct();

$this->latexGenerator = $latexGenerator;
}

protected function configure() {
Expand All @@ -36,7 +29,7 @@ protected function configure() {
->addArgument('no-pdf', InputArgument::OPTIONAL, 'Do not generate a PDF test file');
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$latex = new Article('BobvLatexTest');
$latex->addPackage('lipsum');
$latex->addElement(new TitlePage('Bobv Latex Test', 'a subtitle', 'an author'));
Expand All @@ -62,5 +55,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$generatedLocation = $this->latexGenerator->generate($latex);

$output->writeln($generatedLocation);

return 0; // Success
}
}
13 changes: 1 addition & 12 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder() {
$treeBuilder = new TreeBuilder('bobv_latex');

if (method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->getRootNode();
} else {
// for symfony/config 4.1 and older
$rootNode = $treeBuilder->root('bobv_latex');
}

// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for
// more information on that topic.

$rootNode
$treeBuilder->getRootNode()
->children()
->arrayNode('escaping')
->addDefaultsIfNotSet()
Expand Down
15 changes: 3 additions & 12 deletions src/Form/Type/LatexType.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,23 @@ public function buildView(FormView $view, FormInterface $form, array $options)
/**
* {@inheritdoc}
*/
public function getName()
public function getName(): string
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
public function getBlockPrefix()
public function getBlockPrefix() : string
{
return 'bobv_latex';
}

/**
* {@inheritdoc}
*/
public function getParent()
public function getParent(): ?string
{
$ivory_form_class = 'Ivory\CKEditorBundle\Form\Type\CKEditorType';
$fos_form_class = 'FOS\CKEditorBundle\Form\Type\CKEditorType';
Expand All @@ -121,13 +121,4 @@ public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(self::getDefaultConfig());
}

/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolver $resolver)
{
$this->configureOptions($resolver);
}

}

0 comments on commit 9f1a322

Please sign in to comment.