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

Use php-cs-fixer/shim version directly as dev dependency #17

Merged
merged 4 commits into from
May 24, 2024
Merged
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: 12 additions & 7 deletions .github/workflows/pull-request-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.3', '7.4']
php: ['7.4']
composer-options:
- --prefer-dist --no-progress --no-interaction
- --prefer-dist --no-progress --no-interaction --prefer-lowest

steps:
# Checkout & installation
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -20,18 +24,19 @@ jobs:
ini-values: "memory_limit=-1"
php-version: "${{ matrix.php }}"

- name: Composer install
run: composer update --prefer-dist --no-progress --no-suggest --no-interaction --prefer-lowest
# Install project
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-interaction

- name: PHPCS Fixer install
run: composer bin php-cs-fixer update
- name: Composer update
run: composer update ${{ matrix.composer-options }}

# Linters
- name: Run Composer linter
run: composer validate --strict --no-check-lock

- name: Run lint PHP
run: vendor-bin/php-cs-fixer/vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --ansi --verbose --diff --dry-run
run: composer run-script php-cs-fixer-dry-run

# Tests
- name: Run PHP unit test suite
Expand Down
2 changes: 1 addition & 1 deletion Form/Type/SiteType.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'choices' => $this->siteRepository->findAll(),
'choice_label' => static function (SiteInterface $site = null) {
'choice_label' => static function (?SiteInterface $site = null) {
return (string) $site;
},
'choice_value' => 'id',
Expand Down
4 changes: 2 additions & 2 deletions Router/HostnameIdentifiedLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(IdentifierMappingInterface $identifierMapping)
$this->identifierMapping = $identifierMapping;
}

public function load($resource, string $type = null): RouteCollection
public function load($resource, ?string $type = null): RouteCollection
{
$this->resourceStack[] = $resource;

Expand All @@ -52,7 +52,7 @@ public function load($resource, string $type = null): RouteCollection
return $collection;
}

public function supports($resource, string $type = null): bool
public function supports($resource, ?string $type = null): bool
{
return null === $type && !\in_array($resource, $this->resourceStack, true);
}
Expand Down
2 changes: 1 addition & 1 deletion Router/PathIdentifiedUrlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ final class PathIdentifiedUrlGenerator implements UrlGeneratorInterface
private $defaultIdentifier;
private $urlGenerator;

public function __construct(UrlGeneratorInterface $urlGenerator, string $routeParameter = 'site', string $defaultIdentifier = null)
public function __construct(UrlGeneratorInterface $urlGenerator, string $routeParameter = 'site', ?string $defaultIdentifier = null)
{
$this->routeParameter = $routeParameter;
$this->defaultIdentifier = $defaultIdentifier;
Expand Down
2 changes: 1 addition & 1 deletion Site/IdentifierMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function findIdentifierByHostname(string $hostname): ?string
return null;
}

public function findHostnamesByIdentifier(string $identifier, string $locale = null): array
public function findHostnamesByIdentifier(string $identifier, ?string $locale = null): array
{
if (!isset($this->mapping[$identifier])) {
return [];
Expand Down
2 changes: 1 addition & 1 deletion Site/IdentifierMappingInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ public function findIdentifierByHostname(string $hostname): ?string;
/**
* @return string[]
*/
public function findHostnamesByIdentifier(string $identifier, string $locale = null): array;
public function findHostnamesByIdentifier(string $identifier, ?string $locale = null): array;
}
3 changes: 1 addition & 2 deletions Site/PrefixedPathIdentifiedSiteResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ final class PrefixedPathIdentifiedSiteResolver implements SiteResolverInterface

/**
* @param string[] $identifiers
* @param string $defaultIdentifier
*/
public function __construct(SiteRepositoryInterface $siteRepository, array $identifiers, string $defaultIdentifier = null)
public function __construct(SiteRepositoryInterface $siteRepository, array $identifiers, ?string $defaultIdentifier = null)
{
$this->siteRepository = $siteRepository;
$this->defaultIdentifier = $defaultIdentifier;
Expand Down
2 changes: 1 addition & 1 deletion Tests/Site/IdentifierMappingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected function setUp(): void
/**
* @dataProvider identifierMappingData
*/
public function testFindIdentifierByHostnameReturnsCorrectIdentifier(string $hostname, string $expectedIdentifier = null): void
public function testFindIdentifierByHostnameReturnsCorrectIdentifier(string $hostname, ?string $expectedIdentifier = null): void
{
$identifier = $this->identifierMapping->findIdentifierByHostname($hostname);

Expand Down
13 changes: 7 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
}
],
"require": {
"php": ">=7.3",
"php": ">=7.4",
"symfony/config": "^4.4 | ^5.0 | ^6.0",
"symfony/dependency-injection": "^4.4 | ^5.0 | ^6.0",
"symfony/event-dispatcher": "^4.4 | ^5.0 | ^6.0",
Expand All @@ -34,7 +34,7 @@
"symfony/yaml": "^4.4 | ^5.0 | ^6.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8",
"php-cs-fixer/shim": "^3.57",
"phpunit/phpunit": "^8.5 | ^9.0",
"symfony/doctrine-bridge": "^4.4 | ^5.0 | ^6.0",
"symfony/form": "^4.4 | ^5.0 | ^6.0",
Expand All @@ -55,9 +55,10 @@
}
},
"config": {
"sort-packages": true,
"allow-plugins": {
"bamarni/composer-bin-plugin": true
}
"sort-packages": true
},
"scripts": {
"php-cs-fixer-dry-run": "vendor/bin/php-cs-fixer fix --ansi --verbose --diff --dry-run",
"php-cs-fixer-fix": "vendor/bin/php-cs-fixer fix --ansi --verbose --diff"
}
}
5 changes: 0 additions & 5 deletions vendor-bin/php-cs-fixer/composer.json

This file was deleted.