Skip to content

Commit

Permalink
Merge pull request #61 from Runroom/feature/move-folders
Browse files Browse the repository at this point in the history
Move config and templates outside Resources
  • Loading branch information
jordisala1991 authored Sep 9, 2024
2 parents 55bf67a + 79770bd commit 56f61e5
Show file tree
Hide file tree
Showing 29 changed files with 28 additions and 26 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ jobs:
- run: composer validate --strict
- run: composer rector -- --dry-run
- run: bin/console lint:container
- run: bin/console lint:twig src
- run: bin/console lint:xliff src
- run: bin/console lint:yaml src
- run: bin/console lint:twig templates
- run: bin/console lint:xliff config
- run: bin/console lint:yaml config
3 changes: 2 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use PhpCsFixer\Config;
use PhpCsFixer\Finder;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;

$header = <<<'HEADER'
This file is part of the RunroomSamplesBundle.
Expand All @@ -18,6 +19,7 @@

$config = new Config();

$config->setParallelConfig(ParallelConfigFactory::detect());
$config->setRules([
'@PSR12' => true,
'@PSR12:risky' => true,
Expand All @@ -34,7 +36,6 @@
'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'],
'no_useless_else' => true,
'no_useless_return' => true,
'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => true],
'ordered_class_elements' => true,
'ordered_imports' => ['sort_algorithm' => 'alpha', 'imports_order' => ['class', 'function', 'const']],
'phpdoc_order' => ['order' => ['var', 'param', 'throws', 'return', 'phpstan-var', 'psalm-var', 'phpstan-param', 'psalm-param', 'phpstan-return', 'psalm-return']],
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.19
FROM alpine:3.20

ARG PHP_VERSION=83
ARG UID=1000
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
UID = $(shell id -u)
GID = $(shell id -g)
PHP_VERSION="8.2"
PHP_VERSION="8.1"
CONTAINER_NAME = runroom_samples_bundle
DOCKER_RUN = docker run --rm --volume $(PWD):/usr/app -w /usr/app $(CONTAINER_NAME)

Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions src/Resources/config/services.php → config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
->autowire()
->autoconfigure();

$services->load('Runroom\SamplesBundle\\', '../../*')
->exclude('../../{Resources,DependencyInjection}');
$services->load('Runroom\SamplesBundle\\', '../src/*')
->exclude('../src/{DependencyInjection}');

// BasicEntities
$services->load('Runroom\SamplesBundle\BasicEntities\Controller\\', '../../BasicEntities/Controller')
$services->load('Runroom\SamplesBundle\BasicEntities\Controller\\', '../src/BasicEntities/Controller')
->public()
->tag('controller.service_arguments');

Expand All @@ -60,7 +60,7 @@
$services->alias(PageRendererInterface::class, 'runroom.render_event.renderer.page');
$services->alias(FormHandlerInterface::class, 'runroom.form_handler.form_handler');

$services->load('Runroom\SamplesBundle\Forms\Controller\\', '../../Forms/Controller')
$services->load('Runroom\SamplesBundle\Forms\Controller\\', '../src/Forms/Controller')
->public()
->tag('controller.service_arguments');

Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
]);

$rectorConfig->sets([
LevelSetList::UP_TO_PHP_80,
LevelSetList::UP_TO_PHP_81,
]);

$rectorConfig->importNames();
Expand Down
2 changes: 1 addition & 1 deletion src/BasicEntities/Controller/BookController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class BookController extends AbstractController
{
public function __construct(private BookService $service) {}
public function __construct(private readonly BookService $service) {}

public function books(): Response
{
Expand Down
2 changes: 1 addition & 1 deletion src/BasicEntities/Repository/BookRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class BookRepository extends ServiceEntityRepository
{
public function __construct(
ManagerRegistry $registry,
private RequestStack $requestStack,
private readonly RequestStack $requestStack,
) {
parent::__construct($registry, Book::class);
}
Expand Down
2 changes: 1 addition & 1 deletion src/BasicEntities/Service/BookService.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class BookService
{
public function __construct(private BookRepository $repository) {}
public function __construct(private readonly BookRepository $repository) {}

public function getBooksViewModel(): BooksViewModel
{
Expand Down
2 changes: 1 addition & 1 deletion src/BasicEntities/ViewModel/BookViewModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class BookViewModel
{
public function __construct(private Book $book) {}
public function __construct(private readonly Book $book) {}

public function getBook(): Book
{
Expand Down
2 changes: 1 addition & 1 deletion src/BasicEntities/ViewModel/BooksViewModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class BooksViewModel
/**
* @param Book[] $books
*/
public function __construct(private array $books) {}
public function __construct(private readonly array $books) {}

/**
* @return Book[]
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/RunroomSamplesExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function load(array $configs, ContainerBuilder $container): void
*/
$config = $this->processConfiguration($configuration, $configs);

$loader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/../../config'));
$loader->load('services.php');

$this->mapMediaField('picture', Book::class, $config);
Expand Down
6 changes: 3 additions & 3 deletions src/Forms/Controller/ContactController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
final class ContactController
{
public function __construct(
private PageRendererInterface $renderer,
private UrlGeneratorInterface $router,
private ContactService $service,
private readonly PageRendererInterface $renderer,
private readonly UrlGeneratorInterface $router,
private readonly ContactService $service,
) {}

public function contact(): Response
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/Form/ContactEventHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

final class ContactEventHandler implements EventSubscriberInterface
{
public function __construct(private EntityManagerInterface $entityManager) {}
public function __construct(private readonly EntityManagerInterface $entityManager) {}

/**
* @phpstan-param GenericEvent<FormAwareInterface> $event
Expand Down
8 changes: 4 additions & 4 deletions src/Forms/Form/ContactHubspotEventHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
final class ContactHubspotEventHandler implements EventSubscriberInterface
{
public function __construct(
private TranslatorInterface $translator,
private Forms $hubspotForms,
private int $portalId,
private string $formId,
private readonly TranslatorInterface $translator,
private readonly Forms $hubspotForms,
private readonly int $portalId,
private readonly string $formId,
) {}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/Service/ContactService.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

class ContactService
{
public function __construct(private FormHandlerInterface $handler) {}
public function __construct(private readonly FormHandlerInterface $handler) {}

public function getContactForm(): FormAwareInterface
{
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions tests/App/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa
],
'orm' => [
'auto_mapping' => true,
'controller_resolver' => ['auto_mapping' => false],
'mappings' => [
'BasicEntities' => [
'type' => 'attribute',
Expand Down

0 comments on commit 56f61e5

Please sign in to comment.