Skip to content
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

Use PHP 7.4 syntax #171

Merged
merged 2 commits into from
Aug 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,20 @@
"pagerfanta/pagerfanta": "^1.1 || ^2.5",
"pamil/phpspec-skip-example-extension": "^4.2",
"phpspec/phpspec": "^7.0",
"phpstan/phpstan": "0.12.82",
"phpstan/phpstan": "0.12.94",
"phpstan/phpstan-phpunit": "0.12.18",
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpunit/phpunit": "^9.5",
"sylius-labs/coding-standard": "^3.0",
"sylius-labs/coding-standard": "^4.0",
"sylius/resource-bundle": "^1.8",
"symfony/console": "^4.4 || ^5.2",
"symfony/dotenv": "^4.4 || ^5.2",
"symfony/polyfill-mbstring": "<1.22.0 || >1.22.0",
"symfony/twig-bundle": "^4.4 || ^5.2",
"twig/extensions": "^1.5",
"twig/twig": "^2.12 || ^3.0",
"vimeo/psalm": "4.6.4"
"vimeo/psalm": "4.6.4",
"rector/rector": "^0.11.47"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong order of dependencies

},
"suggest": {
"sylius/currency-bundle": "^1.7"
Expand Down
18 changes: 18 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

use Rector\Core\Configuration\Option;
use Rector\Php74\Rector\Property\TypedPropertyRector;
use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void
{
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::AUTO_IMPORT_NAMES, true);
$parameters->set(Option::IMPORT_SHORT_CLASSES, false);

$services = $containerConfigurator->services();
$services->set(TypedPropertyRector::class);
};
6 changes: 2 additions & 4 deletions src/Bundle/Doctrine/DBAL/DataSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@

final class DataSource implements DataSourceInterface
{
/** @var QueryBuilder */
private $queryBuilder;
private QueryBuilder $queryBuilder;

/** @var ExpressionBuilderInterface */
private $expressionBuilder;
private ExpressionBuilderInterface $expressionBuilder;

public function __construct(QueryBuilder $queryBuilder)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Bundle/Doctrine/DBAL/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ final class Driver implements DriverInterface
{
public const NAME = 'doctrine/dbal';

/** @var Connection */
private $connection;
private Connection $connection;

public function __construct(Connection $connection)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Bundle/Doctrine/DBAL/ExpressionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

final class ExpressionBuilder implements ExpressionBuilderInterface
{
/** @var QueryBuilder */
private $queryBuilder;
private QueryBuilder $queryBuilder;

public function __construct(QueryBuilder $queryBuilder)
{
Expand Down
6 changes: 2 additions & 4 deletions src/Bundle/Doctrine/ORM/DataSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@

final class DataSource implements DataSourceInterface
{
/** @var QueryBuilder */
private $queryBuilder;
private QueryBuilder $queryBuilder;

/** @var ExpressionBuilderInterface */
private $expressionBuilder;
private ExpressionBuilderInterface $expressionBuilder;

public function __construct(QueryBuilder $queryBuilder)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Bundle/Doctrine/ORM/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ final class Driver implements DriverInterface
{
public const NAME = 'doctrine/orm';

/** @var ManagerRegistry */
private $managerRegistry;
private ManagerRegistry $managerRegistry;

public function __construct(ManagerRegistry $managerRegistry)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Bundle/Doctrine/ORM/ExpressionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

final class ExpressionBuilder implements ExpressionBuilderInterface
{
/** @var QueryBuilder */
private $queryBuilder;
private QueryBuilder $queryBuilder;

public function __construct(QueryBuilder $queryBuilder)
{
Expand Down
6 changes: 2 additions & 4 deletions src/Bundle/Doctrine/PHPCRODM/DataSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@

final class DataSource implements DataSourceInterface
{
/** @var QueryBuilder */
private $queryBuilder;
private QueryBuilder $queryBuilder;

/** @var ExpressionBuilderInterface */
private $expressionBuilder;
private ExpressionBuilderInterface $expressionBuilder;

public function __construct(QueryBuilder $queryBuilder, ?ExpressionBuilderInterface $expressionBuilder = null)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Bundle/Doctrine/PHPCRODM/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ final class Driver implements DriverInterface
*/
public const QB_SOURCE_ALIAS = 'o';

/** @var DocumentManagerInterface */
private $documentManager;
private DocumentManagerInterface $documentManager;

public function __construct(DocumentManagerInterface $documentManager)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Bundle/Doctrine/PHPCRODM/ExpressionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
*/
final class ExpressionBuilder implements ExpressionBuilderInterface
{
/** @var CollectionsExpressionBuilder */
private $expressionBuilder;
private CollectionsExpressionBuilder $expressionBuilder;

/** @var array */
private $orderBys = [];
Expand Down
2 changes: 1 addition & 1 deletion src/Bundle/Doctrine/PHPCRODM/ExpressionVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
final class ExpressionVisitor
{
private $queryBuilder;
private QueryBuilder $queryBuilder;

public function __construct(QueryBuilder $queryBuilder)
{
Expand Down
6 changes: 2 additions & 4 deletions src/Bundle/FieldTypes/TwigFieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@

final class TwigFieldType implements FieldTypeInterface
{
/** @var DataExtractorInterface */
private $dataExtractor;
private DataExtractorInterface $dataExtractor;

/** @var Environment */
private $twig;
private Environment $twig;

public function __construct(DataExtractorInterface $dataExtractor, Environment $twig)
{
Expand Down
5 changes: 2 additions & 3 deletions src/Bundle/Form/DataTransformer/DateTimeFilterTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@
final class DateTimeFilterTransformer implements DataTransformerInterface
{
/** @var array<string, array{hour: string, minute: string}> */
private static $defaultTime = [
private static array $defaultTime = [
'from' => ['hour' => '00', 'minute' => '00'],
'to' => ['hour' => '23', 'minute' => '59'],
];

/** @var string */
private $type;
private string $type;

public function __construct(string $type)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Bundle/Form/Registry/FormTypeRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

final class FormTypeRegistry implements FormTypeRegistryInterface
{
/** @var array */
private $formTypes = [];
private array $formTypes = [];

public function add(string $identifier, string $typeIdentifier, string $formType): void
{
Expand Down
6 changes: 2 additions & 4 deletions src/Bundle/Renderer/TwigBulkActionGridRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@

final class TwigBulkActionGridRenderer implements BulkActionGridRendererInterface
{
/** @var Environment */
private $twig;
private Environment $twig;

/** @var array */
private $bulkActionTemplates;
private array $bulkActionTemplates;

public function __construct(Environment $twig, array $bulkActionTemplates)
{
Expand Down
21 changes: 7 additions & 14 deletions src/Bundle/Renderer/TwigGridRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,19 @@

final class TwigGridRenderer implements GridRendererInterface
{
/** @var Environment */
private $twig;
private Environment $twig;

/** @var ServiceRegistryInterface */
private $fieldsRegistry;
private ServiceRegistryInterface $fieldsRegistry;

/** @var FormFactoryInterface */
private $formFactory;
private FormFactoryInterface $formFactory;

/** @var FormTypeRegistryInterface */
private $formTypeRegistry;
private FormTypeRegistryInterface $formTypeRegistry;

/** @var string */
private $defaultTemplate;
private string $defaultTemplate;

/** @var array */
private $actionTemplates;
private array $actionTemplates;

/** @var array */
private $filterTemplates;
private array $filterTemplates;

public function __construct(
Environment $twig,
Expand Down
3 changes: 1 addition & 2 deletions src/Bundle/Templating/Helper/BulkActionGridHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
*/
class BulkActionGridHelper
{
/** @var BulkActionGridRendererInterface */
private $bulkActionGridRenderer;
private BulkActionGridRendererInterface $bulkActionGridRenderer;

public function __construct(BulkActionGridRendererInterface $bulkActionGridRenderer)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Bundle/Templating/Helper/GridHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

class GridHelper
{
/** @var GridRendererInterface */
private $gridRenderer;
private GridRendererInterface $gridRenderer;

public function __construct(GridRendererInterface $gridRenderer)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Bundle/Twig/BulkActionGridExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

final class BulkActionGridExtension extends AbstractExtension
{
/** @var BulkActionGridHelper */
private $bulkActionGridHelper;
private BulkActionGridHelper $bulkActionGridHelper;

public function __construct(BulkActionGridHelper $bulkActionGridHelper)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Bundle/Twig/GridExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

final class GridExtension extends AbstractExtension
{
/** @var GridHelper */
private $gridHelper;
private GridHelper $gridHelper;

public function __construct(GridHelper $gridHelper)
{
Expand Down
37 changes: 25 additions & 12 deletions src/Bundle/test/config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,30 @@

declare(strict_types=1);

use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
use Symfony\Bundle\TwigBundle\TwigBundle;
use FOS\RestBundle\FOSRestBundle;
use JMS\SerializerBundle\JMSSerializerBundle;
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
use Sylius\Bundle\GridBundle\SyliusGridBundle;
use BabDev\PagerfantaBundle\BabDevPagerfantaBundle;
use Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle;
use winzou\Bundle\StateMachineBundle\winzouStateMachineBundle;
use Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle;
use Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle;

return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
FOS\RestBundle\FOSRestBundle::class => ['all' => true],
JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true],
Sylius\Bundle\ResourceBundle\SyliusResourceBundle::class => ['all' => true],
Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true],
BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true],
Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle::class => ['all' => true],
winzou\Bundle\StateMachineBundle\winzouStateMachineBundle::class => ['all' => true],
Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['all' => true],
Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['all' => true],
FrameworkBundle::class => ['all' => true],
DoctrineBundle::class => ['all' => true],
TwigBundle::class => ['all' => true],
FOSRestBundle::class => ['all' => true],
JMSSerializerBundle::class => ['all' => true],
SyliusResourceBundle::class => ['all' => true],
SyliusGridBundle::class => ['all' => true],
BabDevPagerfantaBundle::class => ['all' => true],
BazingaHateoasBundle::class => ['all' => true],
winzouStateMachineBundle::class => ['all' => true],
FidryAliceDataFixturesBundle::class => ['all' => true],
NelmioAliceBundle::class => ['all' => true],
];
12 changes: 4 additions & 8 deletions src/Bundle/test/src/Entity/Author.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,26 @@
class Author implements ResourceInterface
{
/**
* @var int|null
*
* @Serializer\Expose
* @Serializer\Type("integer")
*/
private $id;
private ?int $id = null;

/**
* @var string|null
*
* @Serializer\Expose
* @Serializer\Type("string")
*/
private $name;
private ?string $name = null;

/**
* @var Nationality|null
*
* @Serializer\Expose
*/
private $nationality;
private ?Nationality $nationality = null;

/** @var Collection&Book[] */
private $books;
private Collection $books;

public function __construct()
{
Expand Down
Loading