Skip to content

Commit

Permalink
Merge pull request #2 from core23/fix-ci
Browse files Browse the repository at this point in the history
Fix CI
  • Loading branch information
core23 committed Jan 16, 2022
2 parents dacab2a + 34e1fef commit 726b394
Show file tree
Hide file tree
Showing 15 changed files with 254 additions and 211 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/continuous-integration.yml
Expand Up @@ -12,7 +12,7 @@ jobs:
run:
uses: "nucleos/actions/.github/workflows/continuous-integration.yml@main"
with:
PHP_EXTENSIONS: "mbstring, json, mongodb"
SYMFONY_KERNEL: "Nucleos\\SonataAutoConfigureBundle\\Tests\\App\\AppKernel"
PHP_EXTENSIONS: "mbstring"
SYMFONY_VERSIONS: "5.4"
secrets:
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
21 changes: 1 addition & 20 deletions Makefile
Expand Up @@ -5,32 +5,13 @@ default: lint
fix: cs-fix lint-fix

.PHONY: lint
lint: lint-composer lint-symfony
lint: lint-composer

.PHONY: lint-composer
lint-composer:
composer validate --strict
composer normalize --dry-run

.PHONY: lint-symfony
lint-symfony: lint-symfony-container lint-symfony-twig lint-symfony-xliff lint-symfony-yaml

.PHONY: lint-symfony-container
lint-symfony-container:
tools/console lint:container

.PHONY: lint-symfony-twig
lint-symfony-twig:
tools/console lint:twig src tests

.PHONY: lint-symfony-xliff
lint-symfony-xliff:
tools/console lint:xliff src tests

.PHONY: lint-symfony-yaml
lint-symfony-yaml:
tools/console lint:yaml src tests

.PHONY: test
test: vendor-bin/tools/vendor
vendor/bin/phpunit --colors=always
Expand Down
70 changes: 70 additions & 0 deletions phpstan-baseline.neon
@@ -1,2 +1,72 @@
parameters:
ignoreErrors:
-
message: "#^Implicit array creation is not allowed \\- variable \\$annotationDefaults does not exist\\.$#"
count: 1
path: src/DependencyInjection/Compiler/AutoConfigureAdminClassesCompilerPass.php

-
message: "#^Method Nucleos\\\\SonataAutoConfigureBundle\\\\DependencyInjection\\\\Compiler\\\\AutoConfigureAdminClassesCompilerPass\\:\\:findEntity\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/DependencyInjection/Compiler/AutoConfigureAdminClassesCompilerPass.php

-
message: "#^Method Nucleos\\\\SonataAutoConfigureBundle\\\\DependencyInjection\\\\Compiler\\\\AutoConfigureAdminClassesCompilerPass\\:\\:setDefaultValuesForAnnotation\\(\\) has parameter \\$defaults with no value type specified in iterable type array\\.$#"
count: 1
path: src/DependencyInjection/Compiler/AutoConfigureAdminClassesCompilerPass.php

-
message: "#^Parameter \\#1 \\$objectOrClass of class ReflectionClass constructor expects class\\-string\\<T of object\\>\\|T of object, string\\|null given\\.$#"
count: 1
path: src/DependencyInjection/Compiler/AutoConfigureAdminClassesCompilerPass.php

-
message: "#^Parameter \\#2 \\$string of function explode expects string, string\\|null given\\.$#"
count: 1
path: src/DependencyInjection/Compiler/AutoConfigureAdminClassesCompilerPass.php

-
message: "#^Parameter \\#3 \\$name of method Nucleos\\\\SonataAutoConfigureBundle\\\\DependencyInjection\\\\Compiler\\\\AutoConfigureAdminClassesCompilerPass\\:\\:setDefaultValuesForAnnotation\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: src/DependencyInjection/Compiler/AutoConfigureAdminClassesCompilerPass.php

-
message: "#^Part \\$adminSuffix \\(array\\|bool\\|float\\|int\\|string\\) of encapsed string cannot be cast to string\\.$#"
count: 1
path: src/DependencyInjection/Compiler/AutoConfigureAdminClassesCompilerPass.php

-
message: "#^Property Nucleos\\\\SonataAutoConfigureBundle\\\\DependencyInjection\\\\Compiler\\\\AutoConfigureAdminClassesCompilerPass\\:\\:\\$controllerNamespaces \\(array\\<string\\>\\) does not accept array\\|bool\\|float\\|int\\|string\\|null\\.$#"
count: 1
path: src/DependencyInjection/Compiler/AutoConfigureAdminClassesCompilerPass.php

-
message: "#^Property Nucleos\\\\SonataAutoConfigureBundle\\\\DependencyInjection\\\\Compiler\\\\AutoConfigureAdminClassesCompilerPass\\:\\:\\$controllerSuffix \\(string\\) does not accept array\\|bool\\|float\\|int\\|string\\|null\\.$#"
count: 1
path: src/DependencyInjection/Compiler/AutoConfigureAdminClassesCompilerPass.php

-
message: "#^Property Nucleos\\\\SonataAutoConfigureBundle\\\\DependencyInjection\\\\Compiler\\\\AutoConfigureAdminClassesCompilerPass\\:\\:\\$entityNamespaces \\(array\\) does not accept array\\|bool\\|float\\|int\\|string\\|null\\.$#"
count: 1
path: src/DependencyInjection/Compiler/AutoConfigureAdminClassesCompilerPass.php

-
message: "#^Property Nucleos\\\\SonataAutoConfigureBundle\\\\DependencyInjection\\\\Compiler\\\\AutoConfigureAdminClassesCompilerPass\\:\\:\\$managerType \\(string\\) does not accept array\\|bool\\|float\\|int\\|string\\|null\\.$#"
count: 1
path: src/DependencyInjection/Compiler/AutoConfigureAdminClassesCompilerPass.php

-
message: "#^Argument of an invalid type array\\<string\\>\\|null supplied for foreach, only iterables are supported\\.$#"
count: 1
path: src/DependencyInjection/Compiler/AutoConfigureAdminExtensionsCompilerPass.php

-
message: "#^Implicit array creation is not allowed \\- variable \\$attributes does not exist\\.$#"
count: 1
path: src/DependencyInjection/Compiler/AutoConfigureAdminExtensionsCompilerPass.php

-
message: "#^Parameter \\#1 \\$objectOrClass of class ReflectionClass constructor expects class\\-string\\<T of object\\>\\|T of object, string\\|null given\\.$#"
count: 1
path: src/DependencyInjection/Compiler/AutoConfigureAdminExtensionsCompilerPass.php

8 changes: 7 additions & 1 deletion psalm-baseline.xml
@@ -1,3 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="v4.15.0@a1b5e489e6fcebe40cb804793d964e99fc347820">
<files psalm-version="4.18.1@dda05fa913f4dc6eb3386f2f7ce5a45d37a71bcb">
<file src="src/DependencyInjection/Compiler/AutoConfigureAdminClassesCompilerPass.php">
<InvalidPropertyAssignmentValue occurrences="2">
<code>$container-&gt;getParameter('sonata.auto_configure.admin.manager_type')</code>
<code>$container-&gt;getParameter('sonata.auto_configure.controller.suffix')</code>
</InvalidPropertyAssignmentValue>
</file>
</files>
1 change: 1 addition & 0 deletions psalm.xml
Expand Up @@ -5,6 +5,7 @@
</issueHandlers>
<plugins>
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
<pluginClass class="Psalm\SymfonyPsalmPlugin\Plugin"/>
</plugins>
<projectFiles>
<directory name="src"/>
Expand Down
91 changes: 23 additions & 68 deletions src/Annotation/Admin.php
Expand Up @@ -19,96 +19,51 @@
*/
final class Admin
{
/**
* @var string
*/
public $label;
public ?string $label = null;

/**
* @var string
*/
public $managerType;
public ?string $managerType = null;

/**
* @var string
*/
public $group;
public ?string $group = null;

/**
* @var bool
*/
public $showInDashboard;
public ?bool $showInDashboard = null;

/**
* @var bool
*/
public $showMosaicButton;
public ?bool $showMosaicButton = null;

/**
* @var bool
*/
public $keepOpen;
public ?bool $keepOpen = null;

/**
* @var bool
*/
public $onTop;
public ?bool $onTop = null;

/**
* @var string
*/
public $icon;
public ?string $icon = null;

/**
* @var string
*/
public $labelTranslatorStrategy;
public ?string $labelTranslatorStrategy = null;

/**
* @var string
*/
public $labelCatalogue;
public ?string $labelCatalogue = null;

/**
* @var string
*/
public $translationDomain;
public ?string $translationDomain = null;

/**
* @var string
*/
public $pagerType;
public ?string $pagerType = null;

/**
* @var string
*/
public $adminCode;
public ?string $adminCode = null;

/**
* @var string
*/
public $entity;
public ?string $entity = null;

/**
* @var string
*/
public $controller;
public ?string $controller = null;

public ?bool $autowireEntity = true;

/**
* @var bool
* @var array<string, string>|null
*/
public $autowireEntity = true;
public ?array $templates = [];

/**
* @var array<string, string>
* @var string[]|null
*/
public $templates = [];
public ?array $children = [];

/**
* @var string[]
* @return array<string, mixed>
*/
public $children = [];

public function getOptions(): array
{
return array_filter(
Expand All @@ -125,7 +80,7 @@ public function getOptions(): array
'label_catalogue' => $this->labelCatalogue,
'pager_type' => $this->pagerType,
],
static function ($value): bool {
static function (mixed $value): bool {
return null !== $value;
}
);
Expand Down
17 changes: 7 additions & 10 deletions src/Annotation/AdminExtension.php
Expand Up @@ -19,21 +19,18 @@
*/
final class AdminExtension
{
/**
* @var bool
*/
public $global;
public ?bool $global = null;

public ?int $priority = null;

/**
* @var int
* @var string[]|null
*/
public $priority;
public ?array $target = null;

/**
* @var string[]
* @return array<string, mixed>
*/
public $target;

public function getOptions(): array
{
return array_filter(
Expand All @@ -42,7 +39,7 @@ public function getOptions(): array
'priority' => $this->priority,
'target' => $this->target,
],
static function ($value): bool {
static function (mixed $value): bool {
return null !== $value;
}
);
Expand Down

0 comments on commit 726b394

Please sign in to comment.