Skip to content

[v5] Add Rector CI job and run automated refactoring #2755

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

Draft
wants to merge 11 commits into
base: 5.0
Choose a base branch
from
Draft
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
3 changes: 3 additions & 0 deletions .github/workflows/code_samples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ jobs:
- name: Run PHPStan analysis
run: composer phpstan

- name: Run rector
run: vendor/bin/rector process --dry-run --ansi

code-samples-inclusion-check:
name: Check code samples inclusion
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'doc:add_language'
name: 'doc:add_language',
description: 'Lists available languages and add Polish.'
)]
class AddLanguageCommand extends Command
{
Expand All @@ -30,11 +31,6 @@ public function __construct(LanguageService $languageService, UserService $userS
parent::__construct();
}

protected function configure(): void
{
$this->setDescription('Lists available languages and add Polish.');
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$user = $this->userService->loadUserByLogin('admin');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'doc:add_location'
name: 'doc:add_location',
description: 'Add a Location to content item and hides it.'
)]
class AddLocationToContentCommand extends Command
{
Expand All @@ -38,7 +39,6 @@ public function __construct(ContentService $contentService, LocationService $loc
protected function configure(): void
{
$this
->setDescription('Add a Location to content item and hides it.')
->setDefinition([
new InputArgument('contentId', InputArgument::REQUIRED, 'Content ID'),
new InputArgument('parentLocationId', InputArgument::REQUIRED, 'Parent Location ID'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'doc:browse_locations'
name: 'doc:browse_locations',
description: 'Lists all descendants of the Location'
)]
class BrowseLocationsCommand extends Command
{
Expand All @@ -27,7 +28,6 @@ public function __construct(LocationService $locationService)
protected function configure(): void
{
$this
->setDescription('Lists all descendants of the Location')
->setDefinition([
new InputArgument('locationId', InputArgument::REQUIRED, 'Location ID to browse from'),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'doc:calendar'
name: 'doc:calendar',
description: 'Lists Calendar event in the provided time range and reschedules them.'
)]
class CalendarCommand extends Command
{
Expand All @@ -34,7 +35,6 @@ public function __construct(PermissionResolver $permissionResolver, UserService

public function configure(): void
{
$this->setDescription('Lists Calendar event in the provided time range and reschedules them.');
}

protected function execute(InputInterface $input, OutputInterface $output): int
Expand Down
4 changes: 2 additions & 2 deletions code_samples/api/public_php_api/src/Command/FilterCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'doc:filter'
name: 'doc:filter',
description: 'Returns children of the provided Location, sorted by name in descending order.'
)]
class FilterCommand extends Command
{
Expand All @@ -29,7 +30,6 @@ public function __construct(ContentService $contentService)

public function configure(): void
{
$this->setDescription('Returns children of the provided Location, sorted by name in descending order.');
$this->setDefinition([
new InputArgument('parentLocationId', InputArgument::REQUIRED, 'ID of the parent Location'),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'doc:filter_location'
name: 'doc:filter_location',
description: 'Returns children of the provided Location, sorted by name in descending order.'
)]
class FilterLocationCommand extends Command
{
Expand All @@ -29,7 +30,6 @@ public function __construct(LocationService $locationService)

public function configure(): void
{
$this->setDescription('Returns children of the provided Location, sorted by name in descending order.');
$this->setDefinition([
new InputArgument('parentLocationId', InputArgument::REQUIRED, 'ID of the parent Location'),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'doc:find_complex'
name: 'doc:find_complex',
description: 'Lists content belonging to the provided content type.'
)]
class FindComplexCommand extends Command
{
Expand All @@ -33,7 +34,6 @@ public function __construct(SearchService $searchService, LocationService $locat
protected function configure(): void
{
$this
->setDescription('Lists content belonging to the provided content type.')
->setDefinition([
new InputArgument('locationId', InputArgument::REQUIRED, ''),
new InputArgument('contentTypeIdentifier', InputArgument::REQUIRED, 'Content type identifier'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'doc:find_content'
name: 'doc:find_content',
description: 'Lists content belonging to the provided content type.'
)]
class FindContentCommand extends Command
{
Expand All @@ -28,7 +29,6 @@ public function __construct(SearchService $searchService)
protected function configure(): void
{
$this
->setDescription('Lists content belonging to the provided content type.')
->setDefinition([
new InputArgument('contentTypeIdentifier', InputArgument::REQUIRED, 'Content type identifier'),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'doc:find_in_trash'
name: 'doc:find_in_trash',
description: 'Lists content in Trash belonging to the provided content type.'
)]
class FindInTrashCommand extends Command
{
Expand All @@ -27,7 +28,6 @@ public function __construct(TrashService $trashService)
protected function configure(): void
{
$this
->setDescription('Lists content in Trash belonging to the provided content type.')
->setDefinition([
new InputArgument('contentTypeId', InputArgument::REQUIRED, 'Content type ID'),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'doc:find_url'
name: 'doc:find_url',
description: 'Finds all valid URLs in the provided Section.'
)]
class FindUrlCommand extends Command
{
Expand All @@ -33,12 +34,6 @@ public function __construct(URLService $URLService, UserService $userService, Pe
parent::__construct();
}

protected function configure(): void
{
$this
->setDescription('Finds all valid URLs in the provided Section.');
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$user = $this->userService->loadUserByLogin('admin');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'doc:find_with_aggregation'
name: 'doc:find_with_aggregation',
description: 'Counts content per content type and the value of Selection Field.'
)]
class FindWithAggregationCommand extends Command
{
Expand All @@ -26,12 +27,6 @@ public function __construct(SearchService $searchService)
parent::__construct();
}

protected function configure(): void
{
$this
->setDescription('Counts content per content type and the value of Selection Field.');
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$query = new LocationQuery();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'doc:hide'
name: 'doc:hide',
description: 'Hides and reveals again selected Location.'
)]
class HideLocationCommand extends Command
{
Expand All @@ -34,7 +35,6 @@ public function __construct(LocationService $locationService, UserService $userS
protected function configure(): void
{
$this
->setDescription('Hides and reveals again selected Location.')
->setDefinition([
new InputArgument('location_id', InputArgument::REQUIRED, 'Location ID'),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'doc:move_content'
name: 'doc:move_content',
description: 'Moves the selected Location with its subtree.'
)]
class MoveContentCommand extends Command
{
Expand All @@ -34,7 +35,6 @@ public function __construct(LocationService $locationService, UserService $userS
protected function configure(): void
{
$this
->setDescription('Moves the selected Location with its subtree.')
->setDefinition([
new InputArgument('locationId', InputArgument::REQUIRED, 'Location to copy'),
new InputArgument('targetLocationId', InputArgument::REQUIRED, 'Target to copy or move to'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'doc:object_state'
name: 'doc:object_state',
description: 'Creates OS group with provided States and assigned the Lock OS to provided content item'
)]
class ObjectStateCommand extends Command
{
Expand All @@ -38,7 +39,6 @@ public function __construct(ContentService $contentService, UserService $userSer
protected function configure(): void
{
$this
->setDescription('Creates OS group with provided States and assigned the Lock OS to provided content item')
->setDefinition([
new InputArgument('objectStateGroupIdentifier', InputArgument::REQUIRED, 'Identifier of new OG group to create'),
new InputArgument('objectStateIdentifier', InputArgument::REQUIRED, 'Identifier(s) of a new Object State'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'doc:section'
name: 'doc:section',
description: 'Creates new section and adds selected content item to it.'
)]
class SectionCommand extends Command
{
Expand Down Expand Up @@ -44,7 +45,6 @@ public function __construct(SectionService $sectionService, UserService $userSer
protected function configure(): void
{
$this
->setDescription('Creates new section and adds selected content item to it.')
->setDefinition([
new InputArgument('sectionName', InputArgument::REQUIRED, 'Name of the new Section'),
new InputArgument('sectionIdentifier', InputArgument::REQUIRED, 'Identifier of the new Section'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ public function __construct(SegmentationService $segmentationService, UserServic
parent::__construct();
}

protected function configure(): void
{
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$user = $this->userService->loadUserByLogin('admin');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'doc:set_main_location'
name: 'doc:set_main_location',
description: 'Set a Location as content item\'s main'
)]
class SetMainLocationCommand extends Command
{
Expand All @@ -34,7 +35,6 @@ public function __construct(ContentService $contentService, UserService $userSer
protected function configure(): void
{
$this
->setDescription('Set a Location as content item\'s main')
->setDefinition([
new InputArgument('contentId', InputArgument::REQUIRED, 'The Content ID'),
new InputArgument('locationId', InputArgument::REQUIRED, 'One of the Locations of the Content'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'doc:update_content'
name: 'doc:update_content',
description: 'Update provided content item with a new name'
)]
class UpdateContentCommand extends Command
{
Expand All @@ -34,7 +35,6 @@ public function __construct(ContentService $contentService, UserService $userSer
protected function configure(): void
{
$this
->setDescription('Update provided content item with a new name')
->setDefinition([
new InputArgument('contentId', InputArgument::REQUIRED, 'Content ID'),
new InputArgument('newName', InputArgument::REQUIRED, 'New name for the updated content item'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'doc:view_content'
name: 'doc:view_content',
description: 'Output Field values on provided content item.'
)]
class ViewContentCommand extends Command
{
Expand All @@ -34,7 +35,6 @@ public function __construct(ContentService $contentService, ContentTypeService $
protected function configure(): void
{
$this
->setDescription('Output Field values on provided content item.')
->setDefinition([
new InputArgument('contentId', InputArgument::REQUIRED, 'Location ID'),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'doc:view_metadata'
name: 'doc:view_metadata',
description: 'Output various metadata about a content item.'
)]
class ViewContentMetaDataCommand extends Command
{
Expand Down Expand Up @@ -47,7 +48,6 @@ public function __construct(ContentService $contentService, LocationService $loc
protected function configure(): void
{
$this
->setDescription('Output various metadata about a content item.')
->setDefinition([
new InputArgument('contentId', InputArgument::REQUIRED, 'An existing content ID'),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(
name: 'doc:workflow'
name: 'doc:workflow',
description: 'Starts content in the selected workflow and makes the provided transition.'
)]
class WorkflowCommand extends Command
{
Expand All @@ -34,7 +35,6 @@ public function __construct(WorkflowServiceInterface $workflowService, WorkflowR
protected function configure(): void
{
$this
->setDescription('Starts content in the selected workflow and makes the provided transition.')
->setDefinition([
new InputArgument('contentId', InputArgument::REQUIRED, 'Content ID'),
new InputArgument('workflowName', InputArgument::REQUIRED, 'Workflow identifier'),
Expand Down
Loading
Loading