Skip to content
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
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.gitattributes export-ignore
.gitignore export-ignore
.php-cs-fixer.dist.php export-ignore
/.github export-ignore
/tests export-ignore
ecs.php export-ignore
Makefile export-ignore
mkdocs.yml export-ignore
phpstan.neon.dist export-ignore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
with:
python-version: 3.x
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/coding-standards.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ on:
branches: ['5.x', '4.x', '3.x']

jobs:
php-cs-fixer:
name: PHP CS Fixer (PHP ${{ matrix.php-version }})
easy-coding-standard:
name: Easy Coding Standard (PHP ${{ matrix.php-version }})
runs-on: ubuntu-24.04

strategy:
Expand All @@ -18,7 +18,7 @@ jobs:

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

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand All @@ -30,7 +30,5 @@ jobs:
- name: Install Composer dependencies
uses: ramsey/composer-install@v3

- name: Run PHP CS Fixer
run: 'vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr'
env:
PHP_CS_FIXER_IGNORE_ENV: 1
- name: Run Easy Coding Standard
run: 'vendor/bin/ecs --output-format=checkstyle | cs2pr'
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 2

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

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

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.idea
.DS_Store
.php_cs.cache
.phpunit.result.cache

phpunit.xml
Expand Down
47 changes: 0 additions & 47 deletions .php-cs-fixer.dist.php

This file was deleted.

14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@
"doctrine/persistence": "^3.2",
"easycorp/easyadmin-bundle": "^4.8.5",
"endroid/qr-code": "^4.8 || ^5.0 || ^6.0",
"friendsofphp/php-cs-fixer": "^3.49.0",
"fakerphp/faker": "^1.23",
"google/recaptcha": "^1.3",
"league/flysystem-bundle": "^3.0",
"phpstan/phpstan": "^1.10.57",
"phpstan/phpstan-deprecation-rules": "^1.1.4",
"phpunit/phpunit": "^10.5.10",
"symfony/browser-kit": "^6.4 || ^7.0"
"phpstan/phpstan": "^2.1.22",
"phpstan/phpstan-deprecation-rules": "^2.0.3",
"phpunit/phpunit": "^11.5.35",
"symfony/browser-kit": "^6.4 || ^7.0",
"symplify/easy-coding-standard": "^12.5.24"
},
"config": {
"sort-packages": true
Expand All @@ -63,8 +63,8 @@
"@phpstan",
"@phpunit"
],
"cs:dry": "PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --diff --dry-run --no-interaction --ansi",
"cs:fix": "PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --ansi",
"cs:dry": "vendor/bin/ecs",
"cs:fix": "vendor/bin/ecs --fix",
"phpstan": "vendor/bin/phpstan analyse --ansi",
"phpunit": "vendor/bin/phpunit --colors=auto"
},
Expand Down
28 changes: 28 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Fixer\ControlStructure\NoUselessElseFixer;
use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer;
use PhpCsFixer\Fixer\ReturnNotation\NoUselessReturnFixer;
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
use PhpCsFixer\Fixer\Strict\StrictComparisonFixer;
use PhpCsFixer\Fixer\Strict\StrictParamFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return ECSConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withRootFiles()
->withRules([
NoUselessElseFixer::class,
NoUselessReturnFixer::class,
StrictComparisonFixer::class,
StrictParamFixer::class,
DeclareStrictTypesFixer::class,
NoUnusedImportsFixer::class,
])
->withPhpCsFixerSets(perCS20: true, symfonyRisky: true)
;
120 changes: 100 additions & 20 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,77 +1,157 @@
parameters:
ignoreErrors:
-
message: "#^Property Leapt\\\\CoreBundle\\\\Datalist\\\\Datalist\\:\\:\\$iterator \\(Iterator\\) does not accept Traversable\\<mixed, mixed\\>\\.$#"
message: '#^Property Leapt\\CoreBundle\\Datalist\\Datalist\:\:\$iterator \(Iterator\) does not accept Traversable\<mixed, mixed\>\.$#'
identifier: assign.propertyType
count: 1
path: src/Datalist/Datalist.php

-
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, Iterator given\\.$#"
message: '#^Parameter \#1 \$value of function count expects array\|Countable, Iterator given\.$#'
identifier: argument.type
count: 1
path: src/Datalist/Datasource/AbstractDatasource.php

-
message: "#^Method Leapt\\\\CoreBundle\\\\Datalist\\\\Field\\\\DatalistField\\:\\:getType\\(\\) should return Leapt\\\\CoreBundle\\\\Datalist\\\\Field\\\\Type\\\\FieldTypeInterface but returns Leapt\\\\CoreBundle\\\\Datalist\\\\TypeInterface\\.$#"
message: '#^Method Leapt\\CoreBundle\\Datalist\\Field\\DatalistField\:\:getType\(\) should return Leapt\\CoreBundle\\Datalist\\Field\\Type\\FieldTypeInterface but returns Leapt\\CoreBundle\\Datalist\\TypeInterface\.$#'
identifier: return.type
count: 1
path: src/Datalist/Field/DatalistField.php

-
message: "#^Method Leapt\\\\CoreBundle\\\\Datalist\\\\Filter\\\\DatalistFilter\\:\\:getType\\(\\) should return Leapt\\\\CoreBundle\\\\Datalist\\\\Filter\\\\Type\\\\FilterTypeInterface but returns Leapt\\\\CoreBundle\\\\Datalist\\\\TypeInterface\\.$#"
message: '#^Method Leapt\\CoreBundle\\Datalist\\Filter\\DatalistFilter\:\:getType\(\) should return Leapt\\CoreBundle\\Datalist\\Filter\\Type\\FilterTypeInterface but returns Leapt\\CoreBundle\\Datalist\\TypeInterface\.$#'
identifier: return.type
count: 1
path: src/Datalist/Filter/DatalistFilter.php

-
message: "#^Method Leapt\\\\CoreBundle\\\\Paginator\\\\DoctrineORMPaginator\\:\\:getIterator\\(\\) should return ArrayIterator but returns Traversable\\<\\(int\\|string\\), mixed\\>\\.$#"
message: '#^Method Leapt\\CoreBundle\\Paginator\\DoctrineORMPaginator\:\:getIterator\(\) should return ArrayIterator but returns Traversable\<\(int\|string\), mixed\>\.$#'
identifier: return.type
count: 1
path: src/Paginator/DoctrineORMPaginator.php

-
message: "#^Call to function method_exists\\(\\) with 'Endroid\\\\\\\\QrCode\\\\\\\\Builder\\\\\\\\Builder' and 'create' will always evaluate to false\\.$#"
message: '#^Call to method getParent\(\) of internal class Twig\\Template from outside its root namespace Twig\.$#'
identifier: method.internalClass
count: 1
path: src/Twig/Extension/DatalistExtension.php

-
message: '#^Call to method hasBlock\(\) of internal class Twig\\Template from outside its root namespace Twig\.$#'
identifier: method.internalClass
count: 1
path: src/Twig/Extension/DatalistExtension.php

-
message: '#^Call to method renderBlock\(\) of internal class Twig\\Template from outside its root namespace Twig\.$#'
identifier: method.internalClass
count: 1
path: src/Twig/Extension/DatalistExtension.php

-
message: '#^Instanceof references internal class Twig\\Template\.$#'
identifier: instanceof.internalClass
count: 1
path: src/Twig/Extension/DatalistExtension.php

-
message: '#^Call to method getParent\(\) of internal class Twig\\Template from outside its root namespace Twig\.$#'
identifier: method.internalClass
count: 1
path: src/Twig/Extension/PaginatorExtension.php

-
message: '#^Call to method hasBlock\(\) of internal class Twig\\Template from outside its root namespace Twig\.$#'
identifier: method.internalClass
count: 1
path: src/Twig/Extension/PaginatorExtension.php

-
message: '#^Call to method renderBlock\(\) of internal class Twig\\Template from outside its root namespace Twig\.$#'
identifier: method.internalClass
count: 1
path: src/Twig/Extension/PaginatorExtension.php

-
message: '#^Instanceof references internal class Twig\\Template\.$#'
identifier: instanceof.internalClass
count: 1
path: src/Twig/Extension/PaginatorExtension.php

-
message: '#^Call to function method_exists\(\) with ''Endroid\\\\QrCode\\\\Builder\\\\Builder'' and ''create'' will always evaluate to false\.$#'
identifier: function.impossibleType
count: 1
path: src/Twig/Extension/QrCodeExtension.php

-
message: """
#^Call to deprecated method getExpressionParser\\(\\) of class Twig\\\\Parser\\:
since Twig 3\\.21$#
"""
message: '''
#^Call to deprecated method getExpressionParser\(\) of class Twig\\Parser\:
since Twig 3\.21$#
'''
identifier: method.deprecated
count: 3
path: src/Twig/TokenParser/DatalistThemeTokenParser.php

-
message: "#^Call to function method_exists\\(\\) with Twig\\\\Parser and 'parseExpression' will always evaluate to true\\.$#"
message: '#^Call to function method_exists\(\) with Twig\\Parser and ''parseExpression'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 3
path: src/Twig/TokenParser/DatalistThemeTokenParser.php

-
message: """
#^Call to deprecated method getExpressionParser\\(\\) of class Twig\\\\Parser\\:
since Twig 3\\.21$#
"""
message: '''
#^Call to method parseExpression\(\) of deprecated class Twig\\ExpressionParser\:
since Twig 3\.21$#
'''
identifier: method.deprecatedClass
count: 3
path: src/Twig/TokenParser/DatalistThemeTokenParser.php

-
message: '''
#^Call to deprecated method getExpressionParser\(\) of class Twig\\Parser\:
since Twig 3\.21$#
'''
identifier: method.deprecated
count: 3
path: src/Twig/TokenParser/PaginatorThemeTokenParser.php

-
message: '#^Call to function method_exists\(\) with Twig\\Parser and ''parseExpression'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 3
path: src/Twig/TokenParser/PaginatorThemeTokenParser.php

-
message: "#^Call to function method_exists\\(\\) with Twig\\\\Parser and 'parseExpression' will always evaluate to true\\.$#"
message: '''
#^Call to method parseExpression\(\) of deprecated class Twig\\ExpressionParser\:
since Twig 3\.21$#
'''
identifier: method.deprecatedClass
count: 3
path: src/Twig/TokenParser/PaginatorThemeTokenParser.php

-
message: "#^Method Leapt\\\\CoreBundle\\\\Tests\\\\LeaptCoreTestingKernel\\:\\:configureContainer\\(\\) is unused\\.$#"
message: '#^Method Leapt\\CoreBundle\\Tests\\LeaptCoreTestingKernel\:\:configureContainer\(\) is unused\.$#'
identifier: method.unused
count: 1
path: tests/LeaptCoreTestingKernel.php

-
message: "#^Method Leapt\\\\CoreBundle\\\\Tests\\\\LeaptCoreTestingKernel\\:\\:configureRoutes\\(\\) is unused\\.$#"
message: '#^Method Leapt\\CoreBundle\\Tests\\LeaptCoreTestingKernel\:\:configureRoutes\(\) is unused\.$#'
identifier: method.unused
count: 1
path: tests/LeaptCoreTestingKernel.php

-
message: "#^Property Leapt\\\\CoreBundle\\\\Tests\\\\Listener\\\\Fixtures\\\\Entity\\\\User\\:\\:\\$id is never written, only read\\.$#"
message: '#^Property Leapt\\CoreBundle\\Tests\\Listener\\Fixtures\\Entity\\User\:\:\$id is never written, only read\.$#'
identifier: property.onlyRead
count: 1
path: tests/Listener/Fixtures/Entity/User.php

-
message: "#^Property Leapt\\\\CoreBundle\\\\Tests\\\\Paginator\\\\Entity\\\\Player\\:\\:\\$id is never written, only read\\.$#"
message: '#^Property Leapt\\CoreBundle\\Tests\\Paginator\\Entity\\Player\:\:\$id is never written, only read\.$#'
identifier: property.onlyRead
count: 1
path: tests/Paginator/Entity/Player.php
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="tests/bootstrap.php"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnPhpunitDeprecations="true"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
>
<php>
Expand Down
3 changes: 1 addition & 2 deletions src/Controller/FeedController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ public function __construct(
private FeedManager $feedManager,
private ValidatorInterface $validator,
private Environment $twig,
) {
}
) {}

public function indexAction(Request $request, string $feedName): Response
{
Expand Down
3 changes: 1 addition & 2 deletions src/Controller/SitemapController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public function __construct(
private RouterInterface $router,
private Environment $twig,
private HttpKernelInterface $httpKernel,
) {
}
) {}

public function defaultAction(Request $request): Response
{
Expand Down
4 changes: 1 addition & 3 deletions src/Datalist/Action/DatalistAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ class DatalistAction implements DatalistActionInterface
{
private DatalistInterface $datalist;

public function __construct(private DatalistActionConfig $config)
{
}
public function __construct(private DatalistActionConfig $config) {}

public function getName(): string
{
Expand Down
Loading