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

[rector] add more default sets, bump php cs fixer, phpunit #260

Open
wants to merge 2 commits into
base: 2.5
Choose a base branch
from
Open
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
19 changes: 0 additions & 19 deletions bin/phpunit

This file was deleted.

7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"symfony/twig-bundle": "^6.3"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.41",
"friendsofphp/php-cs-fixer": "^3.64",
"jangregor/phpstan-prophecy": "^1.0",
"phpcr/phpcr-shell": "^1.5",
"phpspec/prophecy-phpunit": "^2.1",
Expand All @@ -63,14 +63,13 @@
"phpstan/phpstan-phpunit": "^1.3",
"phpstan/phpstan-symfony": "^1.3",
"phpstan/phpstan-webmozart-assert": "^1.2",
"phpunit/phpunit": "^9.6",
"phpunit/phpunit": "^10.5",
"rector/rector": "^1.0",
"sulu/sulu-rector": "^1.0",
"symfony/browser-kit": "^6.3",
"symfony/css-selector": "^6.3",
"symfony/debug-bundle": "^6.3",
"symfony/error-handler": "^6.3",
"symfony/phpunit-bridge": "^6.3",
"symfony/thanks": "^1.2",
"symfony/web-profiler-bundle": "^6.3",
"thecodingmachine/phpstan-strict-rules": "^1.0"
Expand Down Expand Up @@ -124,7 +123,7 @@
"@php bin/adminconsole doctrine:database:create --env test",
"@php bin/adminconsole doctrine:schema:create --env test"
],
"test": "@php bin/phpunit",
"test": "@php vendor/bin/phpunit",
"test-with-coverage": "@test --coverage-php var/reports/coverage.php --coverage-cobertura=var/reports/cobertura-coverage.xml --coverage-html var/reports/html --log-junit var/reports/junit.xml",
"lint": [
"@phpstan",
Expand Down
3 changes: 3 additions & 0 deletions config/routes/security.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
_security_logout:
resource: security.route_loader.logout
type: service
29 changes: 12 additions & 17 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,30 @@
declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Symfony\Set\SymfonySetList;

return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withRootFiles()
->withPHPStanConfigs([
__DIR__ . '/phpstan.dist.neon',
// rector does not load phpstan extension automatically so require them manually here:
__DIR__ . '/vendor/phpstan/phpstan-doctrine/extension.neon',
__DIR__ . '/vendor/phpstan/phpstan-symfony/extension.neon',
])
->withImportNames(importShortClasses: false)
->withPreparedSets(codeQuality: true, doctrineCodeQuality: true)
->withPhpSets()

// symfony rules
->withSymfonyContainerPhp(__DIR__ . '/var/cache/website/dev/App_KernelDevDebugContainer.xml')
TomasVotruba marked this conversation as resolved.
Show resolved Hide resolved
->withPhpSets()
->withPreparedSets(codeQuality: true, doctrineCodeQuality: true, symfonyCodeQuality: true, deadCode: true, codingStyle: true, instanceOf: true, typeDeclarations: true)
->withImportNames(importShortClasses: false)
->withAttributesSets(all: true)
->withSets([
SymfonySetList::SYMFONY_CODE_QUALITY,
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
TomasVotruba marked this conversation as resolved.
Show resolved Hide resolved
// activate when doing updates:
// SymfonyLevelSetList::UP_TO_SYMFONY_63,
// activate when doing updates:
// PHPUnitLevelSetList::UP_TO_PHPUNIT_90,
// PHPUnitSetList::PHPUNIT_91,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've bumped the PHPUnit to 10, which is the highest version with BC changes so far, so no need for extra upgrade sets.

Copy link
Member

Choose a reason for hiding this comment

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

What is strange is that a basic symfony still installs PHPUnit 9:

composer create-project symfony/skeleton
cd skeleton
composer require test

Need todo some research why it is so 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think flex + related hacks are maintained much. Composer require works well:

composer create-project symfony/skeleton
cd skeleton
composer require phpunit/phpunit

image

// sulu rules
// activate for updates when doing updates:
// SuluLevelSetList::UP_TO_SULU_25,
])
// symfony rules
->withSymfonyContainerPhp(__DIR__ . '/var/cache/website/dev/App_KernelDevDebugContainer.xml')
->withPHPStanConfigs([
__DIR__ . '/phpstan.dist.neon',
// rector does not load phpstan extension automatically so require them manually here:
__DIR__ . '/vendor/phpstan/phpstan-doctrine/extension.neon',
__DIR__ . '/vendor/phpstan/phpstan-symfony/extension.neon',
]);
2 changes: 1 addition & 1 deletion tests/phpstan/object-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
// this is a workaround for the following phpstan issue: https://github.com/phpstan/phpstan-doctrine/issues/98
$resolveTargetEntityListener = \current(\array_filter(
$objectManager->getEventManager()->getListeners('loadClassMetadata'),
static fn ($listener) => $listener instanceof ResolveTargetEntityListener,
static fn ($listener): bool => $listener instanceof ResolveTargetEntityListener,
));

if (false !== $resolveTargetEntityListener) {
Expand Down
Loading