Skip to content

Commit

Permalink
Feature 77476 acl (#82)
Browse files Browse the repository at this point in the history
* php83 -> AddTypeToConstRector
* doctrine 2 -> 3 update
* symfony 6.4 -> 7 update
* User ACL update, renamed _VIEW to _READ

### Fixes
* update licence collection in `AssetLicenceGroup` update
  • Loading branch information
TomasHermanek authored Jul 8, 2024
1 parent f4b703a commit 6f55281
Show file tree
Hide file tree
Showing 277 changed files with 950 additions and 1,077 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## [1.9.2](https://github.com/anzusystems/core-dam-bundle/compare/1.9.1...1.10.0) (2024-07-03)
* php83 -> AddTypeToConstRector
* doctrine 2 -> 3 update
* symfony 6.4 -> 7 update
* User ACL update, renamed _VIEW to _READ

### Fixes
* update licence collection in `AssetLicenceGroup` update


## [1.9.1](https://github.com/anzusystems/core-dam-bundle/compare/1.9.0...1.9.1) (2024-05-09)

### Fixes
Expand Down
57 changes: 29 additions & 28 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,59 +5,59 @@
"license": "Apache-2.0",
"authors": [
],
"prefer-stable": true,
"require": {
"php": ">=8.3",
"ext-json": "*",
"ext-pcntl": "*",
"ext-mongodb": "*",
"ext-pcntl": "*",
"ext-redis": "*",
"ext-simplexml": "*",
"ext-vips": "*",
"ext-xmlreader": "*",
"ext-zend-opcache": "*",
"anzusystems/common-bundle": "^5.0",
"doctrine/orm": "^2.10",
"anzusystems/common-bundle": "^8.0",
"doctrine/doctrine-bundle": "^2.12",
"doctrine/orm": "^3.1",
"elasticsearch/elasticsearch": "^8.6",
"fakerphp/faker": "^1.20",
"google/apiclient": "^2.12",
"google/cloud-pubsub": "^1.39",
"html2text/html2text": "^4.3",
"jcupitt/vips": "^1.0",
"league/flysystem": "^3.7",
"league/flysystem-google-cloud-storage": "^3.7",
"petitpress/gps-messenger-bundle": "^1.4",
"petitpress/gps-messenger-bundle": "^2.0",
"php-ffmpeg/php-ffmpeg": "^1.0",
"phpexiftool/exiftool": "^10.16",
"symfony/dependency-injection": "^6.4",
"symfony/doctrine-bridge": "^6.4",
"symfony/dotenv": "^6.4",
"symfony/expression-language": "^6.4",
"symfony/framework-bundle": "^6.4",
"symfony/http-client": "^6.4",
"symfony/http-kernel": "^6.4",
"symfony/lock": "^6.4",
"symfony/messenger": "^6.4",
"symfony/mime": "^6.4",
"symfony/options-resolver": "^6.4",
"symfony/dependency-injection": "^7.0",
"symfony/doctrine-bridge": "^7.0",
"symfony/dotenv": "^7.0",
"symfony/expression-language": "^7.0",
"symfony/framework-bundle": "^7.0",
"symfony/http-client": "^7.0",
"symfony/http-kernel": "^7.0",
"symfony/lock": "^7.0",
"symfony/messenger": "^7.0",
"symfony/mime": "^7.0",
"symfony/options-resolver": "^7.0",
"symfony/polyfill-uuid": "^1.24",
"symfony/process": "^6.4",
"symfony/property-access": "^6.4",
"symfony/runtime": "^6.4",
"symfony/security-bundle": "^6.4",
"symfony/uid": "^6.4",
"symfony/validator": "^6.4",
"symfony/yaml": "^6.4"
"symfony/process": "^7.0",
"symfony/property-access": "^7.0",
"symfony/runtime": "^7.0",
"symfony/security-bundle": "^7.0",
"symfony/uid": "^7.0",
"symfony/validator": "^7.0",
"symfony/yaml": "^7.0"
},
"require-dev": {
"doctrine/doctrine-bundle": "^2.4",
"phpunit/phpunit": "^9.5",
"psalm/plugin-symfony": "^5.0",
"rector/rector": "^1.0",
"slevomat/coding-standard": "^7.0",
"symfony/test-pack": "^1.0",
"symplify/easy-coding-standard": "^11.1",
"symplify/easy-coding-standard": "^12.1",
"vimeo/psalm": "^5.6",
"weirdan/doctrine-psalm-plugin": "^2.8",
"ext-fileinfo": "*"
"weirdan/doctrine-psalm-plugin": "^2.8"
},
"replace": {
"symfony/polyfill-ctype": "*",
Expand Down Expand Up @@ -92,5 +92,6 @@
"symfony/runtime": true,
"php-http/discovery": true
}
}
},
"minimum-stability": "dev"
}
212 changes: 84 additions & 128 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

declare(strict_types=1);

use AnzuSystems\CommonBundle\DependencyInjection\Configuration;
use PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\ForbiddenFunctionsSniff;
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
use PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer;
Expand All @@ -14,24 +13,20 @@
use PhpCsFixer\Fixer\DoctrineAnnotation\DoctrineAnnotationIndentationFixer;
use PhpCsFixer\Fixer\DoctrineAnnotation\DoctrineAnnotationSpacesFixer;
use PhpCsFixer\Fixer\FunctionNotation\SingleLineThrowFixer;
use PhpCsFixer\Fixer\Import\GlobalNamespaceImportFixer;
use PhpCsFixer\Fixer\ListNotation\ListSyntaxFixer;
use PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer;
use PhpCsFixer\Fixer\Phpdoc\GeneralPhpdocTagRenameFixer;
use PhpCsFixer\Fixer\Phpdoc\NoSuperfluousPhpdocTagsFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocAlignFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocAnnotationWithoutDotFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocInlineTagNormalizerFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocSeparationFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocToCommentFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocTypesOrderFixer;
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
use PhpCsFixer\Fixer\Whitespace\BlankLineBeforeStatementFixer;
use PhpCsFixer\Fixer\Whitespace\MethodChainingIndentationFixer;
use SlevomatCodingStandard\Sniffs\Classes\MethodSpacingSniff;
use SlevomatCodingStandard\Sniffs\Classes\ModernClassNameReferenceSniff;
use SlevomatCodingStandard\Sniffs\Classes\ParentCallSpacingSniff;
use SlevomatCodingStandard\Sniffs\Classes\PropertySpacingSniff;
use SlevomatCodingStandard\Sniffs\Commenting\DocCommentSpacingSniff;
use SlevomatCodingStandard\Sniffs\Commenting\UselessInheritDocCommentSniff;
use SlevomatCodingStandard\Sniffs\ControlStructures\RequireNullCoalesceOperatorSniff;
use SlevomatCodingStandard\Sniffs\Functions\ArrowFunctionDeclarationSniff;
Expand All @@ -43,27 +38,15 @@
use SlevomatCodingStandard\Sniffs\Namespaces\UseFromSameNamespaceSniff;
use SlevomatCodingStandard\Sniffs\Numbers\RequireNumericLiteralSeparatorSniff;
use SlevomatCodingStandard\Sniffs\PHP\UselessParenthesesSniff;
use SlevomatCodingStandard\Sniffs\TypeHints\UselessConstantTypeHintSniff;
use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayListItemNewlineFixer;
use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayOpenerAndCloserNewlineFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Option;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;

return static function (ECSConfig $ECSConfig): void {
$ECSConfig->import(SetList::CLEAN_CODE);
$ECSConfig->import(SetList::PSR_12);
$ECSConfig->import(SetList::COMMON);

$parameters = $ECSConfig->parameters();
$parameters->set(Option::PARALLEL, true);
$parameters->set(Option::DEBUG, true);

$ECSConfig->cacheDirectory(__DIR__ . '/var/ecs_cache');

$ECSConfig->skip([
Configuration::class,
PhpdocTypesOrderFixer::class,
return ECSConfig::configure()
->withPreparedSets(psr12: true, common: true, cleanCode: true)
->withParallel()
->withCache(directory: __DIR__ . '/var/ecs_cache')
->withSkip([
ArrayListItemNewlineFixer::class => null,
PhpdocToCommentFixer::class => null,
PhpdocAlignFixer::class => null,
Expand All @@ -76,111 +59,84 @@
DoctrineAnnotationBracesFixer::class => null,
NotOperatorWithSuccessorSpaceFixer::class => null,
UselessParenthesesSniff::class => null,
PhpdocSeparationFixer::class => null, // some bug with infinity applied checker
MethodChainingIndentationFixer::class => ['DependencyInjection/*Configuration.php'],
'SlevomatCodingStandard\Sniffs\Whitespaces\DuplicateSpacesSniff.DuplicateDeclareStrictTypesSpaces' => null,
MethodChainingIndentationFixer::class => ['src/DependencyInjection/*Configuration.php'],
'PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\AssignmentInConditionSniff.FoundInWhileCondition' => [
'src/Security/OAuth2TokenStorage/RedisRefreshTokenStorage.php'
],
'SlevomatCodingStandard\Sniffs\Classes\UnusedPrivateElementsSniff.WriteOnlyProperty' => ['src/Entity/User.php'],
'SlevomatCodingStandard\Sniffs\Whitespaces\DuplicateSpacesSniff.DuplicateSpaces' => null,
'SlevomatCodingStandard\Sniffs\Commenting\DisallowCommentAfterCodeSniff.DisallowedCommentAfterCode' => null,
PhpdocAnnotationWithoutDotFixer::class => null,
'src/Model/Enum/*.php',
PhpCsFixer\Fixer\Import\NoUnusedImportsFixer::class => null // bug: removes usages of attributes if attributes are in one line i.e. #[OARequest, OAResponse]
]);

$services = $ECSConfig->services();

$services->set(NoSuperfluousPhpdocTagsFixer::class)
->call('configure', [['remove_inheritdoc' => false, 'allow_mixed' => false]]);

$services->set(ClassDefinitionFixer::class)
->call('configure', [['multi_line_extends_each_single_line' => false]]);

$services->set(ClassAttributesSeparationFixer::class)
->call('configure', [['elements' => ['method', 'property']]]);

$services->set(DocCommentSpacingSniff::class)
->property('annotationsGroups', [
'@inheritDoc',
'@template, @extends, @implements, @template-implements @template-extends',
'@var, @psalm-var, @param, @psalm-param',
'@return, @psalm-return',
'@throws',
'@psalm-suppress',
])
'src/Prosemirror/*',
'src/DataMigration/*',
'src/Command/TestCommand.php',
])
->withConfiguredRule(NoSuperfluousPhpdocTagsFixer::class, ['remove_inheritdoc' => false, 'allow_mixed' => false])
->withConfiguredRule(ClassDefinitionFixer::class, ['multi_line_extends_each_single_line' => false])
->withConfiguredRule(ClassAttributesSeparationFixer::class, ['elements' => ['method', 'property']])
->withConfiguredRule(ArraySyntaxFixer::class, ['syntax' => 'short'])
->withConfiguredRule(ListSyntaxFixer::class, ['syntax' => 'short'])
->withConfiguredRule(PropertySpacingSniff::class, ['minLinesCountBeforeWithComment' => 1, 'maxLinesCountBeforeWithComment' => 1, 'maxLinesCountBeforeWithoutComment' => 0])
->withConfiguredRule(UnusedUsesSniff::class, ['searchAnnotations' => true])
->withConfiguredRule(YodaStyleFixer::class, ['identical' => true])
->withConfiguredRule(ForbiddenFunctionsSniff::class, ['forbiddenFunctions' => [
'chop' => 'rtrim',
'close' => 'closedir',
'delete' => 'unset',
'doubleval' => 'floatval',
'fputs' => 'fwrite',
'imap_create' => 'createmailbox',
'imap_fetchtext' => 'body',
'imap_header' => 'headerinfo',
'imap_listmailbox' => 'list',
'imap_listsubscribed' => 'lsub',
'imap_rename' => 'renamemailbox',
'imap_scan' => 'listscan',
'imap_scanmailbox' => 'listscan',
'mt_rand' => 'random_int',
'ini_alter' => 'set',
'is_double' => 'is_float',
'is_integer' => 'is_int',
'is_null' => '!== null',
'is_real' => 'is_float',
'is_writeable' => 'is_writable',
'join' => 'implode',
'key_exists' => 'array_key_exists',
'magic_quotes_runtime' => 'set_magic_quotes_runtime',
'pos' => 'current',
'rand' => 'random_int',
'show_source' => 'file',
'sizeof' => 'count',
'strchr' => 'strstr',
'create_function' => null,
'call_user_func' => null,
'call_user_func_array' => null,
'forward_static_call' => null,
'forward_static_call_array' => null,
'dump' => null,
'die' => null,
'dd' => null,
'echo' => null,
'var_dump' => null,
]])
->withRules([
DeclareStrictTypesFixer::class,
NoNullPropertyInitializationFixer::class,
ArrowFunctionDeclarationSniff::class,
StrictCallSniff::class,
UseDoesNotStartWithBackslashSniff::class,
AlphabeticallySortedUsesSniff::class,
RequireNumericLiteralSeparatorSniff::class,
UselessParenthesesSniff::class,
RequireNullCoalesceOperatorSniff::class,
ModernClassNameReferenceSniff::class,
UselessInheritDocCommentSniff::class,
UseFromSameNamespaceSniff::class,
UnusedInheritedVariablePassedToClosureSniff::class,
DoctrineAnnotationArrayAssignmentFixer::class,
DoctrineAnnotationIndentationFixer::class,
DoctrineAnnotationSpacesFixer::class,
BlankLineBeforeStatementFixer::class,
GlobalNamespaceImportFixer::class,
])
;

$services->set(MethodSpacingSniff::class);
$services->set(PropertySpacingSniff::class)
->property('minLinesCountBeforeWithComment', 1)
->property('maxLinesCountBeforeWithComment', 1)
->property('maxLinesCountBeforeWithoutComment', 0);

$services->set(UnusedUsesSniff::class)
->property('searchAnnotations', true);

$services->set(DeclareStrictTypesFixer::class);
$services->set(NoNullPropertyInitializationFixer::class);
$services->set(YodaStyleFixer::class);
$services->set(ArrowFunctionDeclarationSniff::class);
$services->set(StrictCallSniff::class);
$services->set(UseDoesNotStartWithBackslashSniff::class);
$services->set(AlphabeticallySortedUsesSniff::class);
$services->set(RequireNumericLiteralSeparatorSniff::class);
$services->set(UselessParenthesesSniff::class);
$services->set(RequireNullCoalesceOperatorSniff::class);
$services->set(ModernClassNameReferenceSniff::class);
$services->set(UselessInheritDocCommentSniff::class);
$services->set(UseFromSameNamespaceSniff::class);
$services->set(UnusedInheritedVariablePassedToClosureSniff::class);
$services->set(UselessConstantTypeHintSniff::class);
$services->set(DoctrineAnnotationArrayAssignmentFixer::class);
$services->set(DoctrineAnnotationIndentationFixer::class);
$services->set(DoctrineAnnotationSpacesFixer::class);
$services->set(BlankLineBeforeStatementFixer::class);

$services->set(ForbiddenFunctionsSniff::class)
->property('forbiddenFunctions', [
'chop' => 'rtrim',
'close' => 'closedir',
'delete' => 'unset',
'doubleval' => 'floatval',
'fputs' => 'fwrite',
'imap_create' => 'createmailbox',
'imap_fetchtext' => 'body',
'imap_header' => 'headerinfo',
'imap_listmailbox' => 'list',
'imap_listsubscribed' => 'lsub',
'imap_rename' => 'renamemailbox',
'imap_scan' => 'listscan',
'imap_scanmailbox' => 'listscan',
'mt_rand' => 'random_int',
'ini_alter' => 'set',
'is_double' => 'is_float',
'is_integer' => 'is_int',
'is_null' => '!== null',
'is_real' => 'is_float',
'is_writeable' => 'is_writable',
'join' => 'implode',
'key_exists' => 'array_key_exists',
'magic_quotes_runtime' => 'set_magic_quotes_runtime',
'pos' => 'current',
'rand' => 'random_int',
'show_source' => 'file',
'sizeof' => 'count',
'strchr' => 'strstr',
'create_function' => null,
'call_user_func' => null,
'call_user_func_array' => null,
'forward_static_call' => null,
'forward_static_call_array' => null,
'dump' => null,
'die' => null,
'dd' => null,
'echo' => null,
'var_dump' => null,
]);

$services->set(ArraySyntaxFixer::class)
->call('configure', [['syntax' => 'short']]);

$services->set(ListSyntaxFixer::class)
->call('configure', [['syntax' => 'short']]);
};
14 changes: 14 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

use Rector\Config\RectorConfig;
use Rector\Php83\Rector\ClassConst\AddTypeToConstRector;
use Rector\ValueObject\PhpVersion;

return RectorConfig::configure()
->withRules([
AddTypeToConstRector::class
])
->withPhpVersion(PhpVersion::PHP_83)
->withPaths([
__DIR__ . '/src',
]);
2 changes: 1 addition & 1 deletion src/AnzuSystemsCoreDamBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

final class AnzuSystemsCoreDamBundle extends Bundle
{
public const TAG_FILESYSTEM = 'core_dam_bundle.storage';
public const string TAG_FILESYSTEM = 'core_dam_bundle.storage';

public function build(ContainerBuilder $container): void
{
Expand Down
Loading

0 comments on commit 6f55281

Please sign in to comment.