Skip to content

Commit

Permalink
Dependency upgrade to propel 2.0.0-beta4 and symfony 7 (#41)
Browse files Browse the repository at this point in the history
* Dependency upgrade to propel 2.0.0-beta4 and symfony 7

* Fix tests \n\n PHP Fatal error:  Declaration of Propel\Bundle\PropelBundle\Tests\Fixtures\Model\User::eraseCredentials() must be compatible with Symfony\Component\Security\Core\User\UserInterface::eraseCredentials(): void

* Add type hint to FixturesLoadCommand

Fix error phpstan

  Line   Command/FixturesLoadCommand.php
 ------ -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  112    Return type mixed of method Propel\Bundle\PropelBundle\Command\FixturesLoadCommand::execute() is not covariant with return type int of method Symfony\Component\Console\Command\Command::execute().

* Fix symfony warning on Twig Extension

 1x: Method "Twig\Extension\ExtensionInterface::getFilters()" might add "array" as a native return type declaration in the future. Do the same in implementation "Propel\Bundle\PropelBundle\Twig\Extension\SyntaxExtension" now to avoid errors or add an explicit @return annotation to suppress this message.

* Fix others symfony warnings

See by `SYMFONY_PATCH_TYPE_DECLARATIONS=force=2 vendor/bin/patch-type-declarations`
Commit contains only classes implementing Symfony interfaces or extends
Synfony classes

https://symfony.com/blog/symfony-7-0-type-declarations#preparing-your-applications

* Update README for branch 7.0

---------

Co-authored-by: Ludovic Daoudal <[email protected]>
Co-authored-by: LDA <[email protected]>
  • Loading branch information
3 people authored Sep 4, 2024
1 parent be58c3c commit 1b8d723
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 43 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI 7.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: [ '8.0.2', '8.1', '8.1' ]
symfony-version: [ '6.0', '6.1', '6.2', '6.3' ]
php-version: [ '8.0.2', '8.1', '8.1', '8.2', '8.3' ]
symfony-version: [ '6.0', '6.1', '6.2', '6.3', '6.4', '7.0', '7.1' ]
steps:
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
Expand Down
2 changes: 1 addition & 1 deletion Command/FixturesLoadCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected function configure(): void
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->filesystem = new Filesystem();

Expand Down
2 changes: 1 addition & 1 deletion Form/EventListener/TranslationFormListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(array $columns, string $dataClass)
$this->dataClass = $dataClass;
}

public static function getSubscribedEvents()
public static function getSubscribedEvents(): array
{
return array(
FormEvents::PRE_SET_DATA => array('preSetData', 1),
Expand Down
2 changes: 1 addition & 1 deletion Form/FormBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ protected function buildFormFields(Table $table)

return $buildCode;
}
}
}
5 changes: 3 additions & 2 deletions Form/PropelExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Propel\Bundle\PropelBundle\Form;

use Symfony\Component\Form\FormTypeGuesserInterface;
use Symfony\Component\Form\AbstractExtension;
use Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface;
use Symfony\Component\Form\ChoiceList\Factory\DefaultChoiceListFactory;
Expand Down Expand Up @@ -48,7 +49,7 @@ public function __construct(PropertyAccessorInterface $propertyAccessor = null,
$this->choiceListFactory = $choiceListFactory ?: new PropertyAccessDecorator(new DefaultChoiceListFactory(), $this->propertyAccessor);
}

protected function loadTypes()
protected function loadTypes(): array
{
return array(
new Type\ModelType($this->propertyAccessor, $this->choiceListFactory),
Expand All @@ -57,7 +58,7 @@ protected function loadTypes()
);
}

protected function loadTypeGuesser()
protected function loadTypeGuesser(): ?FormTypeGuesserInterface
{
return new TypeGuesser();
}
Expand Down
7 changes: 2 additions & 5 deletions Form/Type/ModelType.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,12 @@ public function configureOptions(OptionsResolver $resolver): void
$resolver->setAllowedTypes('query', ['null', 'Propel\Runtime\ActiveQuery\ModelCriteria']);
}

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

public function getParent()
public function getParent(): ?string
{
return 'Symfony\Component\Form\Extension\Core\Type\ChoiceType';
}
Expand Down
10 changes: 2 additions & 8 deletions Form/Type/TranslationCollectionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,12 @@ public function configureOptions(OptionsResolver $resolver): void
));
}

/**
* {@inheritdoc}
*/
public function getParent()
public function getParent(): ?string
{
return CollectionType::class;
}

/**
* {@inheritdoc}
*/
public function getBlockPrefix()
public function getBlockPrefix(): string
{
return 'propel_translation_collection';
}
Expand Down
5 changes: 1 addition & 4 deletions Form/Type/TranslationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ public function configureOptions(OptionsResolver $resolver): void
));
}

/**
* {@inheritdoc}
*/
public function getBlockPrefix()
public function getBlockPrefix(): string
{
return 'propel_translation';
}
Expand Down
5 changes: 3 additions & 2 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ As `Propel2` will be released in the near future, we are migrating the branching
* The `5.0` branch contains `Propel2`(branch **2.0.0-beta1**) integration for Symfony **4.x|5.x** and PHP **7.2** - **8.0**.
* The `5.1` branch contains `Propel2`(branch **2.0.0-beta2**) integration for Symfony **4.x|5.x|6.x** and PHP **7.4** - **8.1**.
* The `6.0` branch contains `Propel2`(branch **2.0.0-beta2**) integration for Symfony **6.x**. and PHP **8.0.2+**
* The `7.0` branch contains `Propel2`(branch **2.0.0-beta2**, **2.0.0-beta3**, **2.0.0-beta4**) integration for Symfony **6.x|7.x**. and PHP **8.0.2+**

## Version 6.0 Changes

Expand All @@ -29,11 +30,11 @@ As `Propel2` will be released in the near future, we are migrating the branching
- propel/propel

### Composer command
- composer require propel/propel "2.0.0-beta2"
- composer require propel/propel "2.0.0-beta4"
- composer require skyfox/propel-bundle "6.0.1"(or newer tag/release) or "6.0.x-dev"

### composer.json -> add in "require"
- "propel/propel": "2.0.0-beta2"
- "propel/propel": "2.0.0-beta4"
- "skyfox/propel-bundle": "6.0.1"(or newer tag/release) or "6.0.x-dev"

## Features
Expand Down
2 changes: 1 addition & 1 deletion Request/ParamConverter/PropelParamConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class PropelParamConverter implements ParamConverterInterface
* @throws NotFoundHttpException
* @throws \Exception
*/
public function apply(Request $request, ParamConverter $configuration)
public function apply(Request $request, ParamConverter $configuration): bool
{
$class = $configuration->getClass();
$classQuery = $class . 'Query';
Expand Down
2 changes: 1 addition & 1 deletion Tests/Fixtures/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class User extends BaseUser implements UserInterface
{
public function eraseCredentials()
public function eraseCredentials(): void
{
}

Expand Down
2 changes: 1 addition & 1 deletion Twig/Extension/SyntaxExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
class SyntaxExtension extends \Twig\Extension\AbstractExtension
{
public function getFilters()
public function getFilters(): array
{
return [
new \Twig\TwigFilter('format_sql', [$this, 'formatSQL'], ['is_safe' => ['html']]),
Expand Down
10 changes: 2 additions & 8 deletions Validator/Constraints/UniqueObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,12 @@ public function __construct($options = null)
}
}

/**
* {@inheritDoc}
*/
public function getRequiredOptions()
public function getRequiredOptions(): array
{
return array('fields');
}

/**
* {@inheritDoc}
*/
public function getTargets()
public function getTargets(): array|string
{
return self::CLASS_CONSTRAINT;
}
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
},
"require": {
"php": ">=8.0.2",
"propel/propel": "2.0.0-beta2||2.0.0-beta3",
"symfony/console": "^5.0||^6.0",
"symfony/dependency-injection": "^6.0",
"symfony/framework-bundle": "^6.0",
"symfony/security-bundle": "^6.0",
"symfony/yaml": "^5.0||^6.0"
"propel/propel": "2.0.0-beta2||2.0.0-beta3||2.0.0-beta4",
"symfony/console": "^5.0||^6.0||^7.0",
"symfony/dependency-injection": "^6.0||^7.0",
"symfony/framework-bundle": "^6.0||^7.0",
"symfony/security-bundle": "^6.0||^7.0",
"symfony/yaml": "^5.0||^6.0||^7.0"
},
"require-dev": {
"ext-json": "*",
Expand Down

0 comments on commit 1b8d723

Please sign in to comment.