Skip to content

Commit

Permalink
phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpapst committed Nov 22, 2024
1 parent bd08b04 commit c80b100
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion DependencyInjection/DemoExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
class DemoExtension extends AbstractPluginExtension implements PrependExtensionInterface
{
/**
* @param array<string, mixed> $configs
* @param array<mixed> $configs
* @throws \Exception
*/
public function load(array $configs, ContainerBuilder $container): void
Expand Down
4 changes: 2 additions & 2 deletions Invoice/DemoSortActivityInvoiceCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected function mergeSumInvoiceItem(InvoiceItem $invoiceItem, ExportableItem
public function getEntries(): array
{
$entries = $this->model->getEntries();
if (empty($entries)) {
if (\count($entries) === 0) {
return [];
}

Expand All @@ -68,7 +68,7 @@ public function getEntries(): array
$compare_a = $a->getActivity()?->getName();
$compare_b = $b->getActivity()?->getName();

if ($compare_a == $compare_b) {
if ($compare_a === $compare_b) {
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions Widget/DemoWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class DemoWidget extends AbstractWidget
{
public function __construct(private UserRepository $repository)
public function __construct(private readonly UserRepository $repository)
{
}

Expand All @@ -41,7 +41,7 @@ public function getOptions(array $options = []): array
}

/**
* @param array<string, string|bool|int|null> $options
* @param array<string, string|bool|int|null|array<string, mixed>> $options
*/
public function getData(array $options = []): mixed
{
Expand Down
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@
"friendsofphp/php-cs-fixer": "^3.0",
"kimai/kimai": "dev-main",
"phpstan/phpstan": "^2.0",
"phpstan/phpstan-deprecation-rules": "^2.0",
"phpstan/phpstan-doctrine": "^2.0",
"phpstan/phpstan-strict-rules": "^2.0",
"phpstan/phpstan-symfony": "^2.0",
"symfony/console": "^6.0",
"symfony/event-dispatcher": "^6.0"
Expand Down
24 changes: 14 additions & 10 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
includes:
- %rootDir%/../phpstan-symfony/extension.neon
- %rootDir%/../phpstan-symfony/rules.neon
- %rootDir%/../phpstan-doctrine/extension.neon
- %rootDir%/../phpstan-doctrine/rules.neon
- %rootDir%/../phpstan/conf/bleedingEdge.neon
- %rootDir%/../phpstan-symfony/extension.neon
- %rootDir%/../phpstan-symfony/rules.neon
- %rootDir%/../phpstan-doctrine/extension.neon
- %rootDir%/../phpstan-doctrine/rules.neon
- %rootDir%/../phpstan-deprecation-rules/rules.neon
- %rootDir%/../phpstan-strict-rules/rules.neon
- %rootDir%/../phpstan/conf/bleedingEdge.neon

parameters:
level: 9
excludePaths:
- vendor/(?)
treatPhpDocTypesAsCertain: false
inferPrivatePropertyTypeFromConstructor: true
level: 9
excludePaths:
- vendor/(?)
treatPhpDocTypesAsCertain: false
inferPrivatePropertyTypeFromConstructor: true
doctrine:
allowNullablePropertyForRequiredField: true

0 comments on commit c80b100

Please sign in to comment.