Skip to content

Commit 8e4d48c

Browse files
Merge pull request #47 from matthiasnoback/fix_default_style
Improvements
2 parents 3f3155e + efb3c75 commit 8e4d48c

20 files changed

+120
-222
lines changed

.github/workflows/code-style.yaml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Code style
2+
3+
on:
4+
pull_request: null
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
code_analysis:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
actions:
15+
-
16+
name: "Code style"
17+
run: vendor/bin/php-cs-fixer fix -v --diff --dry-run
18+
php-versions: ['7.4']
19+
20+
name: ${{ matrix.actions.name }}
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
26+
# see https://github.com/shivammathur/setup-php
27+
- uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php-versions }}
30+
coverage: none
31+
32+
# composer install cache - https://github.com/ramsey/composer-install
33+
- uses: "ramsey/composer-install@v1"
34+
35+
- run: ${{ matrix.actions.run }}

.github/workflows/tests.yaml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Tests
2+
3+
on:
4+
pull_request: null
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
code_analysis:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
actions:
15+
-
16+
name: "Behat"
17+
run: vendor/bin/behat
18+
php-versions: ['7.4', '8.0']
19+
20+
name: ${{ matrix.actions.name }}
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
26+
# see https://github.com/shivammathur/setup-php
27+
- uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php-versions }}
30+
coverage: none
31+
32+
# composer install cache - https://github.com/ramsey/composer-install
33+
- uses: "ramsey/composer-install@v1"
34+
35+
- run: ${{ matrix.actions.run }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
/test/temp/
44
/vendor/
55
/composer.lock
6+
/.env

.travis.yml

-14
This file was deleted.

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2014 Matthias Noback
1+
Copyright (c) Matthias Noback
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
By Matthias Noback
44

5-
[![Build Status](https://travis-ci.org/matthiasnoback/symfony-console-form.svg?branch=master)](https://travis-ci.org/matthiasnoback/symfony-console-form)
6-
75
This package contains a Symfony bundle and some tools which enable you to use Symfony Form types to define and
86
interactively process user input from the CLI.
97

bin/composer

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
5+
# Copy user and group ID into .env file
6+
printf "HOST_UID=%s\nHOST_GID=%s\n" "$(id -u)" "$(id -g)" > .env
7+
8+
docker-compose run --rm composer --ignore-platform-reqs "$@"

bin/php

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
5+
# Copy user and group ID into .env file
6+
printf "HOST_UID=%s\nHOST_GID=%s\n" "$(id -u)" "$(id -g)" > .env
7+
8+
docker-compose run --rm php php "$@"

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
}
2424
},
2525
"require": {
26-
"php": ">=7.2",
26+
"php": ">=7.4",
2727
"symfony/form": "~5.0",
2828
"symfony/console": "~5.0",
2929
"symfony/translation": "~5.0"
@@ -37,6 +37,6 @@
3737
"symfony/validator": "~5.0",
3838
"symfony/yaml": "~5.0",
3939
"symfony/security-csrf": "~5.0",
40-
"phpunit/phpunit": "^7"
40+
"phpunit/phpunit": "^9.5"
4141
}
4242
}

docker-compose.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: '3'
2+
3+
services:
4+
composer:
5+
image: composer:latest
6+
working_dir: /app
7+
volumes:
8+
- ./:/app
9+
env_file:
10+
- .env
11+
user: ${HOST_UID}:${HOST_GID}
12+
init: true
13+
14+
php:
15+
image: php:7.4-cli-alpine
16+
working_dir: /app
17+
volumes:
18+
- ./:/app
19+
env_file:
20+
- .env
21+
user: ${HOST_UID}:${HOST_GID}
22+
init: true

git-hooks/pre-commit

+2-13
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,9 @@
44
exec 1>&2
55

66
ROOT="$PWD"
7-
PHP_CS_FIXER="${ROOT}/vendor/bin/php-cs-fixer"
8-
PHP_CS_CONFIG="${ROOT}/.php_cs"
9-
10-
if [ ! -f "$PHP_CS_CONFIG" ]; then
11-
echo "Please run 'git commit' from the root directory of the project"
12-
exit 1
13-
fi
14-
15-
if [ ! -x "$PHP_CS_FIXER" ]; then
16-
echo "Please run 'composer install' first"
17-
exit 1
18-
fi
7+
PHP_CS_FIXER="${ROOT}/bin/php vendor/bin/php-cs-fixer"
198

209
git status --porcelain | grep -e '^[AM]\(.*\).php$' | cut -c 3- | while read line; do
21-
$PHP_CS_FIXER fix --config=$PHP_CS_CONFIG --verbose "$line";
10+
$PHP_CS_FIXER fix --verbose "$line";
2211
git add "$line";
2312
done

src/Bridge/Interaction/CollectionInteractor.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ private function printHeader(FormInterface $form, OutputInterface $output): void
119119
{
120120
$output->writeln(
121121
strtr(
122-
'<fieldset>{label}</fieldset>',
122+
'<comment>{label}</comment>',
123123
[
124124
'{label}' => FormUtil::label($form),
125125
]
@@ -131,7 +131,7 @@ private function printEditEntryHeader(int $entryNumber, OutputInterface $output)
131131
{
132132
$output->writeln(
133133
strtr(
134-
'<fieldset>Edit entry {entryNumber}</fieldset>',
134+
'<comment>Edit entry {entryNumber}</comment>',
135135
[
136136
'{entryNumber}' => $entryNumber,
137137
]
@@ -143,7 +143,7 @@ private function printAddEntryHeader(int $entryNumber, OutputInterface $output):
143143
{
144144
$output->writeln(
145145
strtr(
146-
'<fieldset>Add entry {entryNumber}</fieldset>',
146+
'<comment>Add entry {entryNumber}</comment>',
147147
[
148148
'{entryNumber}' => $entryNumber,
149149
]

src/Bundle/RegisterOutputFormatterStylesPass.php

-67
This file was deleted.

src/Bundle/SymfonyConsoleFormBundle.php

-8
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@ public function build(ContainerBuilder $container): void
1616
{
1717
$container->addCompilerPass(new RegisterTransformersPass());
1818

19-
$container->addCompilerPass(
20-
new RegisterOutputFormatterStylesPass(
21-
'matthias_symfony_console.styles_collection',
22-
'console_style',
23-
'style'
24-
)
25-
);
26-
2719
$container->addCompilerPass(
2820
new RegisterHelpersPass(
2921
'matthias_symfony_console_form.helper_collection',

src/Bundle/SymfonyConsoleFormExtension.php

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ public function load(array $config, ContainerBuilder $container): void
1313
{
1414
$loader = new YamlFileLoader($container, new FileLocator(__DIR__));
1515
$loader->load('services.yml');
16-
$loader->load('style.yml');
1716
$loader->load('helpers.yml');
1817
}
1918

src/Bundle/style.yml

-38
This file was deleted.

src/Console/EventListener/RegisterOutputFormatterStylesEventListener.php

-26
This file was deleted.

src/Console/EventListener/SetInputDefinitionOfFormBasedCommandEventListener.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Symfony\Component\Console\Command\Command;
99
use Symfony\Component\Console\Command\HelpCommand;
1010
use Symfony\Component\Console\Event\ConsoleCommandEvent;
11+
use Symfony\Component\Console\Input\InputArgument;
1112
use Symfony\Component\Console\Input\InputDefinition;
1213
use Symfony\Component\Console\Input\InputInterface;
1314

@@ -42,7 +43,7 @@ private function setInputDefinition(Command $command, InputInterface $input, Inp
4243
{
4344
$command->setDefinition($inputDefinition);
4445
$command->mergeApplicationDefinition();
45-
$input->bind($inputDefinition);
46+
$input->bind($command->getDefinition());
4647
}
4748

4849
private function getCommandFromHelpCommand(HelpCommand $helpCommand): ?Command

0 commit comments

Comments
 (0)