Skip to content

Commit

Permalink
cs fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Apr 6, 2024
1 parent 9341e85 commit 96f8dc9
Show file tree
Hide file tree
Showing 24 changed files with 79 additions and 142 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Static analysis

on:
push:
branches:
- '[0-9]+.x'
- '[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.x'
pull_request:

jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-latest

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: "curl,dom,json,xml,dom"
coverage: none

- name: Checkout code
uses: actions/checkout@v4

# have to install phpstan ourselves here, the phpstan-ga fails at composer install with weird errors
- name: Install phpstan
run: |
# composer require --no-update jackalope/jackalope-doctrine-dbal jackalope/jackalope-jackrabbit phpstan/phpstan
composer update

- name: PHPStan
run: vendor/bin/phpstan analyze --no-progress

php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --dry-run --diff
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ phpunit.xml
composer.lock
vendor
tests/Fixtures/App/var/
.phpunit.result.cache
.phpunit.result.cache
.php-cs-fixer.cache
19 changes: 19 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
->exclude('tests/Fixtures/App/var/')
->name('*.php')
;

$config = new PhpCsFixer\Config();

return $config
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'single_line_throw' => false,
])
->setFinder($finder)
;
31 changes: 0 additions & 31 deletions .styleci.yml

This file was deleted.

3 changes: 0 additions & 3 deletions src/DependencyInjection/CmfRoutingExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
*/
final class CmfRoutingExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container): void
{
$config = $this->processConfiguration(new Configuration(), $configs);
Expand Down
2 changes: 0 additions & 2 deletions src/Doctrine/Orm/ContentRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ protected function getModelAndId(string $identifier): array
}

/**
* {@inheritdoc}
*
* @param string $id The ID contains both model name and id, separated by a colon
*/
public function findById(mixed $id): ?object
Expand Down
9 changes: 0 additions & 9 deletions src/Doctrine/Orm/RedirectRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ public function setParameters(array $parameters): void
$this->serialisedParameters = json_encode($parameters, \JSON_THROW_ON_ERROR);
}

/**
* {@inheritdoc}
*/
public function getParameters(): array
{
if (!isset($this->serialisedParameters)) {
Expand All @@ -65,9 +62,6 @@ public function getParameters(): array
return \is_array($params) ? $params : [];
}

/**
* {@inheritdoc}
*/
public function getPath(): string
{
$pattern = parent::getPath();
Expand All @@ -78,9 +72,6 @@ public function getPath(): string
return $pattern;
}

/**
* {@inheritdoc}
*/
protected function isBooleanOption(string $name): bool
{
return 'add_trailing_slash' === $name || parent::isBooleanOption($name);
Expand Down
3 changes: 0 additions & 3 deletions src/Doctrine/Orm/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ public function getPosition(): int
return $this->position;
}

/**
* {@inheritdoc}
*/
public function getRouteKey(): string
{
return $this->getName();
Expand Down
11 changes: 1 addition & 10 deletions src/Doctrine/Orm/RouteProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ public function __construct(ManagerRegistry $managerRegistry, CandidatesInterfac
$this->candidatesStrategy = $candidatesStrategy;
}

/**
* {@inheritdoc}
*/
public function getRouteCollectionForRequest(Request $request): RouteCollection
{
$collection = new RouteCollection();
Expand All @@ -52,7 +49,7 @@ public function getRouteCollectionForRequest(Request $request): RouteCollection
if (0 === \count($candidates)) {
return $collection;
}
$routes = $this->getRouteRepository()->findByStaticPrefix($candidates, ['position' => 'ASC']); /** @phpstan-ignore-line */
$routes = $this->getRouteRepository()->findByStaticPrefix($candidates, ['position' => 'ASC']); /* @phpstan-ignore-line */
/** @var Route $route */
foreach ($routes as $route) {
$collection->add($route->getName(), $route);
Expand All @@ -61,9 +58,6 @@ public function getRouteCollectionForRequest(Request $request): RouteCollection
return $collection;
}

/**
* {@inheritdoc}
*/
public function getRouteByName($name): SymfonyRoute
{
if (!$this->candidatesStrategy->isCandidate($name)) {
Expand All @@ -78,9 +72,6 @@ public function getRouteByName($name): SymfonyRoute
return $route;
}

/**
* {@inheritdoc}
*/
public function getRoutesByNames($names = null): array
{
if (null === $names) {
Expand Down
6 changes: 0 additions & 6 deletions src/Doctrine/Phpcr/ContentRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,11 @@
*/
class ContentRepository extends DoctrineProvider implements ContentRepositoryInterface
{
/**
* {@inheritdoc}
*/
public function findById($id): ?object
{
return $this->getObjectManager()->find(null, $id);
}

/**
* {@inheritdoc}
*/
public function getContentId($content): ?string
{
if (!\is_object($content)) {
Expand Down
7 changes: 1 addition & 6 deletions src/Doctrine/Phpcr/PrefixCandidates.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ final class PrefixCandidates extends Candidates
* is using
* @param int $limit Limit to candidates generated per prefix
*/
public function __construct(array $prefixes, array $locales = [], ManagerRegistry $doctrine = null, int $limit = 20)
public function __construct(array $prefixes, array $locales = [], ?ManagerRegistry $doctrine = null, int $limit = 20)
{
parent::__construct($locales, $limit);
$this->setPrefixes($prefixes);
Expand All @@ -74,8 +74,6 @@ public function isCandidate($name): bool
}

/**
* {@inheritdoc}
*
* @param QueryBuilder $queryBuilder
*/
public function restrictQuery($queryBuilder): void
Expand All @@ -91,9 +89,6 @@ public function restrictQuery($queryBuilder): void
}
}

/**
* {@inheritdoc}
*/
public function getCandidates(Request $request): array
{
$candidates = [];
Expand Down
12 changes: 0 additions & 12 deletions src/Doctrine/Phpcr/RedirectRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ public function setParentDocument($parent): static
return $this;
}

/**
* {@inheritdoc}
*/
public function getParentDocument(): ?object
{
return $this->parent;
Expand Down Expand Up @@ -160,9 +157,6 @@ public function getPrefix(): string
return $this->idPrefix;
}

/**
* {@inheritdoc}
*/
public function setPrefix(string $prefix): static
{
$this->idPrefix = $prefix;
Expand Down Expand Up @@ -206,9 +200,6 @@ public function generateStaticPrefix(string $id, string $idPrefix): string
return $url;
}

/**
* {@inheritdoc}
*/
public function getPath(): string
{
$pattern = parent::getPath();
Expand Down Expand Up @@ -240,9 +231,6 @@ public function getRouteChildren(): array
return $children;
}

/**
* {@inheritdoc}
*/
protected function isBooleanOption(string $name): bool
{
return 'add_trailing_slash' === $name || parent::isBooleanOption($name);
Expand Down
6 changes: 0 additions & 6 deletions src/Doctrine/Phpcr/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,6 @@ public function getPrefix(): ?string
return $this->idPrefix;
}

/**
* {@inheritdoc}
*/
public function setPrefix(string $prefix): static
{
$this->idPrefix = $prefix;
Expand Down Expand Up @@ -264,9 +261,6 @@ public function getChildren(): Collection
return $this->children;
}

/**
* {@inheritdoc}
*/
protected function isBooleanOption(string $name): bool
{
return 'add_trailing_slash' === $name || parent::isBooleanOption($name);
Expand Down
4 changes: 1 addition & 3 deletions src/Doctrine/Phpcr/RouteProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(
ManagerRegistry $managerRegistry,
CandidatesInterface $candidatesStrategy,
?string $className = null,
LoggerInterface $logger = null
?LoggerInterface $logger = null
) {
parent::__construct($managerRegistry, $className);
$this->candidatesStrategy = $candidatesStrategy;
Expand Down Expand Up @@ -102,8 +102,6 @@ public function getRouteCollectionForRequest(Request $request): RouteCollection
}

/**
* {@inheritdoc}
*
* @param string $name The absolute path or uuid of the Route document
*/
public function getRouteByName(string $name): SymfonyRoute
Expand Down
9 changes: 0 additions & 9 deletions src/Form/Type/RouteTypeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ class RouteTypeType extends AbstractType
{
protected array $routeTypes = [];

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver): void
{
$choices = [];
Expand All @@ -43,17 +40,11 @@ public function addRouteType(string $type): void
$this->routeTypes[$type] = $type;
}

/**
* {@inheritdoc}
*/
public function getParent(): string
{
return ChoiceType::class;
}

/**
* {@inheritdoc}
*/
public function getBlockPrefix(): string
{
return 'cmf_routing_route_type';
Expand Down
Loading

0 comments on commit 96f8dc9

Please sign in to comment.