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

chore: update rector.php #560

Merged
merged 11 commits into from
Dec 17, 2022
Merged

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Dec 14, 2022

  • add declare(strict_types=1) in rector.php
  • update rector version to ^0.15.1
  • add rector rules
  • remove deprecated TypedPropertyRector
  • refactor test code by rector
  • update .php-cs-fixer.dist.php
PHP Fatal error:  Uncaught _PHPStan_9a6ded56a\Nette\Schema\ValidationException: Unexpected item 'parameters › deprecationRulesInstalled'. in phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Processor.php:75

Fatal error: Uncaught _PHPStan_9a6ded56a\Nette\Schema\ValidationException: Unexpected item 'parameters › deprecationRulesInstalled'. in phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Processor.php:75
Stack trace:
Stack trace:
#0 phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Processor.php(38): _PHPStan_9a6ded56a\Nette\Schema\Processor->throwsErrors()
#0 phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Processor.php(38): _PHPStan_9a6ded56a\Nette\Schema\Processor->throwsErrors()
#1 phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/DependencyInjection/ParametersSchemaExtension.php(43): _PHPStan_9a6ded56a\Nette\Schema\Processor->process()
#1 phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/DependencyInjection/ParametersSchemaExtension.php(43): _PHPStan_9a6ded56a\Nette\Schema\Processor->process()
#2 phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Compiler.php(182): PHPStan\DependencyInjection\ParametersSchemaExtension->loadConfiguration()
#2 phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Compiler.php(182): PHPStan\DependencyInjection\ParametersSchemaExtension->loadConfiguration()
#3 phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Compiler.php(158): _PHPStan_9 in phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Processor.php on line 75
#3 phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Compiler.php(158): _PHPStan_9 in phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Processor.php on line 75
Error: Process completed with exit code 255.

https://github.com/codeigniter4/shield/actions/runs/3692642168/jobs/6251736949

@kenjis kenjis changed the title chore: fix rectore.php chore: fix rector.php Dec 14, 2022
@samsonasik
Copy link
Member

You can pin to phpstan 1.9.2 or use rector dev-main that already include phpstan 1.9.3

@kenjis
Copy link
Member Author

kenjis commented Dec 14, 2022

@samsonasik Do you know why this error happens?

PHP Fatal error:  Uncaught _PHPStan_9a6ded56a\Nette\Schema\ValidationException: Unexpected item 'parameters › deprecationRulesInstalled'. in phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Processor.php:75

Fatal error: Uncaught _PHPStan_9a6ded56a\Nette\Schema\ValidationException: Unexpected item 'parameters › deprecationRulesInstalled'. in phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Processor.php:75
Stack trace:
#0 phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Processor.php(38): _PHPStan_9a6ded56a\Nette\Schema\Processor->throwsErrors()
#1 phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/DependencyInjection/ParametersSchemaExtension.php(43): _PHPStan_9a6ded56a\Nette\Schema\Processor->process()
#2 phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Compiler.php(182): PHPStan\DependencyInjection\ParametersSchemaExtension->loadConfiguration()
#3 phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Compiler.php(158): _PHPStan_9 in phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Processor.php on line 75
Stack trace:
#0 phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Processor.php(38): _PHPStan_9a6ded56a\Nette\Schema\Processor->throwsErrors()
#1 phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/src/DependencyInjection/ParametersSchemaExtension.php(43): _PHPStan_9a6ded56a\Nette\Schema\Processor->process()
#2 phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Compiler.php(182): PHPStan\DependencyInjection\ParametersSchemaExtension->loadConfiguration()
#3 phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/di/src/DI/Compiler.php(158): _PHPStan_9 in phar:///home/runner/.composer/vendor/rector/rector/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Processor.php on line 75
Error: Process completed with exit code 255.

https://github.com/codeigniter4/shield/actions/runs/3692658459/jobs/6251768963

@samsonasik
Copy link
Member

You can pin to phpstan 1.9.2 or use rector dev-main that already include phpstan 1.9.3

@kenjis
Copy link
Member Author

kenjis commented Dec 14, 2022

@samsonasik Thanks! No errors with dev-main .

@kenjis kenjis mentioned this pull request Dec 14, 2022
@kenjis
Copy link
Member Author

kenjis commented Dec 14, 2022

@samsonasik
I don't feel comfortable changing the GitHub workflow to dev-main, so I'll leave it as is for a while.

Will this be fixed in the next release?

@samsonasik
Copy link
Member

Yes, wait for next release seems ok 👍 , the error usually happen when phpstan add new parameters config

@samsonasik
Copy link
Member

@kenjis Rector 0.15.1 released, I restarted the build.

@samsonasik
Copy link
Member

@kenjis the workflow seems still using rector 0.13

Run composer global require --dev rector/rector:^0.13.3
Changed current directory to /home/runner/.composer
./composer.json has been updated
Running composer update rector/rector
Loading composer repositories with package information
Updating dependencies
Lock file operations: 2 installs, 0 updates, 0 removals
  - Locking phpstan/phpstan (1.9.3)
  - Locking rector/rector (0.13.10)

composer global require --dev rector/rector:^0.13.3

Please update to ^0.15.1

@kenjis kenjis changed the title chore: fix rector.php chore: update rector.php Dec 15, 2022
@kenjis kenjis added the github_actions Pull requests that update GitHub Actions code label Dec 15, 2022
rector.php Outdated
$rectorConfig
->ruleWithConfiguration(TypedPropertyFromAssignsRector::class, [
// Set to false if you use in libraries, or it does create breaking changes.
TypedPropertyFromAssignsRector::INLINE_PUBLIC => false,
Copy link
Member

Choose a reason for hiding this comment

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

It false by default, no need to define in config for false value

Copy link
Member Author

Choose a reason for hiding this comment

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

It comes from a template file in devkit.

Copy link
Member

Choose a reason for hiding this comment

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

For devkit, that can be on purpose so user know when to enable it, I think it can be removed in here

Copy link
Member Author

Choose a reason for hiding this comment

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

I followed the instruction in the devkit template.

If we need to remove the default value, please update the devkit comment.
Otherwise, the code will revert again when I or someone else copy the devkit template to update in the future.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, I created PR codeigniter4/devkit#61 for it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed the config line.

@kenjis
Copy link
Member Author

kenjis commented Dec 15, 2022

Why did the coverage rate drop to 69.743%?

It is 94.95% in my local environment.

Code Coverage Report:        
  2022-12-14 20:01:58        
                             
 Summary:                    
  Classes: 45.83% (22/48)    
  Methods: 79.86% (222/278)  
  Lines:   94.95% (2484/2616)

@MGatner
Copy link
Member

MGatner commented Dec 15, 2022

Why did the coverage rate drop to 69.743%?

No clue!

It is included in LevelSetList::UP_TO_PHP_74.
@kenjis kenjis merged commit 22ccaf4 into codeigniter4:develop Dec 17, 2022
@kenjis kenjis deleted the fix-rector-config branch December 17, 2022 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
github_actions Pull requests that update GitHub Actions code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants