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

Add native types to class properties, by Rector PHP #1392

Merged
merged 3 commits into from Oct 30, 2020

Conversation

maks-rafalko
Copy link
Member

@maks-rafalko maks-rafalko commented Oct 30, 2020

This is a follow up for #1340

./rector.phar process src --config=rector.php

rector.php config:

<?php

declare(strict_types=1);

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

return static function (ContainerConfigurator $containerConfigurator): void {
    $services = $containerConfigurator->services();

    $services->set(TypedPropertyRector::class);

    $parameters = $containerConfigurator->parameters();

    $parameters->set(Option::PHP_VERSION_FEATURES, PhpVersionFeature::TYPED_PROPERTIES);
};

Next steps:

  • update CI to fail the build when native type is missed (another PR)

```bash
./rector.phar process src --config=rector.php
```

config:

```php
<?php

declare(strict_types=1);

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

return static function (ContainerConfigurator $containerConfigurator): void {
    $services = $containerConfigurator->services();

    $services->set(TypedPropertyRector::class);

        $parameters = $containerConfigurator->parameters();

        $parameters->set(Option::PHP_VERSION_FEATURES, PhpVersionFeature::TYPED_PROPERTIES);
};
```
Copy link
Member

@sidz sidz left a comment

Choose a reason for hiding this comment

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

👍

src/Logger/ConsoleLogger.php Outdated Show resolved Hide resolved
src/Metrics/MetricsCalculator.php Outdated Show resolved Hide resolved
@maks-rafalko maks-rafalko merged commit 63046b6 into master Oct 30, 2020
@maks-rafalko maks-rafalko deleted the rector-php-7.4 branch October 30, 2020 20:47
@maks-rafalko
Copy link
Member Author

Thank you @sidz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants