Skip to content

Commit

Permalink
Merge branch '7.0' into 7.1
Browse files Browse the repository at this point in the history
* 7.0:
  [AllBundles] Fix php codestyle issues
  [AllBundles] Fix phpstan errors
  • Loading branch information
acrobat committed Sep 14, 2024
2 parents 34e0c4f + 31cef67 commit 3330728
Show file tree
Hide file tree
Showing 46 changed files with 83 additions and 81 deletions.
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
;

return (new PhpCsFixer\Config())
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setRiskyAllowed(false)
->setRules([
'@Symfony' => true,
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ parameters:
- src/Kunstmaan/GeneratorBundle/Resources/SensioGeneratorBundle
- src/Kunstmaan/CookieBundle/Resources/skeleton
- src/Kunstmaan/CacheBundle # Temporary excluded for full rework
- src/Kunstmaan/FixturesBundle # Temporary excluded for full rework
# Excluded deprecated classes/files
- src/Kunstmaan/AdminBundle/Composer/ScriptHandler.php
- src/Kunstmaan/AdminBundle/EventListener/ConsoleExceptionListener.php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function __construct(
ContainerInterface $container,
AdminRouteHelper $adminRouteHelper,
array $providerKeys,
$adminFirewallName = 'main'
$adminFirewallName = 'main',
) {
$this->twig = $twig;
$this->urlGenerator = $urlGenerator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(
array $url,
$label,
$icon = null,
$template = null
$template = null,
) {
$this->url = $url;
$this->label = $label;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function __construct(
ObjectIdentityRetrievalStrategyInterface $oidRetrievalStrategy,
EventDispatcherInterface $eventDispatcher,
Shell $shellHelper,
KernelInterface $kernel
KernelInterface $kernel,
) {
$this->em = $em;
$this->tokenStorage = $tokenStorage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct(
int $cacheTimeframe,
bool $enabled,
string $projectDir,
string $websiteTitle
string $websiteTitle,
) {
$this->cache = $cache;
$this->translator = $translator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public function addFilter(
$columnName,
?FilterTypeInterface $type = null,
$filterName = null,
array $options = []
array $options = [],
) {
$this->getFilterBuilder()->add($columnName, $type, $filterName, $options);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AbstractAdminListConfiguratorTest extends TestCase

protected function setUp(): void
{
$this->adminListConfigurator = new class() extends AbstractAdminListConfigurator {
$this->adminListConfigurator = new class extends AbstractAdminListConfigurator {
public function buildFields()
{
$this->addField('hello', 'hello', true);
Expand Down Expand Up @@ -123,7 +123,7 @@ public function testGetViewUrlFor()
$this->assertEquals('999', $viewUrl['params']['id']);

// from object
$item = new class() {
$item = new class {
public function getId()
{
return 3;
Expand All @@ -145,7 +145,7 @@ public function testGetIndexUrl()

public function testGetAdminTypeExistsInEntity()
{
$entity = new class() {
$entity = new class {
public function getAdminType()
{
return 'TestType';
Expand Down Expand Up @@ -315,7 +315,7 @@ public function testGetValue()
$this->assertEquals('bar', $this->adminListConfigurator->getValue(['foo' => 'bar'], $columnName));
$this->assertEquals('', $this->adminListConfigurator->getValue(['foz' => 'bar'], $columnName));

$item = new class() {
$item = new class {
public function getFoo()
{
return 'bar';
Expand Down Expand Up @@ -350,13 +350,13 @@ public function testgetStringValue()
;

$value = new PersistentCollection($emMock, 'ClassName', new ArrayCollection());
$value->add(new class() {
$value->add(new class {
public function getName()
{
return 'bar';
}
});
$value->add(new class() {
$value->add(new class {
public function getName()
{
return 'baz';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function testGetEditUrl()
{
$abstractMock = $this->setUpAdminlistConfigurator();

$item = new class() {
$item = new class {
public function getId()
{
return 747;
Expand All @@ -93,7 +93,7 @@ public function testGetDeleteUrl()
{
$abstractMock = $this->setUpAdminlistConfigurator();

$item = new class() {
$item = new class {
public function getId()
{
return 747;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class AbstractArticleOverviewPageTest extends TestCase
{
public function testGettersAndSetters()
{
$entity = new class() extends AbstractArticleOverviewPage {
$entity = new class extends AbstractArticleOverviewPage {
public function getArticleRepository($em)
{
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class AbstractAuthorTest extends TestCase
{
public function testGettersAndSetters()
{
$entity = new class() extends AbstractAuthor {
$entity = new class extends AbstractAuthor {
};
$entity->setId(666);
$entity->setLink('https://nasa.gov');
Expand Down
2 changes: 1 addition & 1 deletion src/Kunstmaan/ConfigBundle/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __construct(
AuthorizationCheckerInterface $authorizationChecker,
EntityManagerInterface $em,
array $configuration,
FormFactoryInterface $formFactory
FormFactoryInterface $formFactory,
) {
$this->router = $router;
$this->twig = $twig;
Expand Down
2 changes: 1 addition & 1 deletion src/Kunstmaan/FixturesBundle/Builder/PageBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(
Populator $populator,
Slugifier $slugifier,
PagesConfiguration $pagesConfiguration,
string $userClass
string $userClass,
) {
$this->manager = $em;
$this->nodeRepo = $em->getRepository(Node::class);
Expand Down
2 changes: 1 addition & 1 deletion src/Kunstmaan/FormBundle/Helper/FormHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct(
?EntityManagerInterface $em,
?FormFactoryInterface $formFactory,
?RouterInterface $router,
?EventDispatcherInterface $eventDispatcher
?EventDispatcherInterface $eventDispatcher,
) {
$this->container = $container;
$this->em = $em;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ protected function updateRouting(
InputInterface $input,
OutputInterface $output,
Bundle $bundle,
$entityClass
$entityClass,
) {
$adminKey = $this->getContainer()->getParameter('kunstmaan_admin.admin_prefix');
$auto = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ protected function askForBundleName(
$objectName,
$namespace = null,
$questionMoreBundles = "\nIn which bundle do you want to create the %s",
$questionOneBundle = "The %s will be created for the <comment>%s</comment> bundle.\n"
$questionOneBundle = "The %s will be created for the <comment>%s</comment> bundle.\n",
) {
return new Sf4AppBundle($this->getContainer()->getParameter('kernel.project_dir'));
}
Expand All @@ -235,7 +235,7 @@ protected function askForSections(
BundleInterface $bundle,
$multiple = false,
$context = null,
$defaultSections = []
$defaultSections = [],
) {
$allSections = $this->getAvailableSections($bundle, $context, $defaultSections);
$sections = [];
Expand Down Expand Up @@ -589,7 +589,7 @@ protected function getEntityFields(
$maxHeight = null,
$minWidth = null,
$maxWidth = null,
$mimeTypes = null
$mimeTypes = null,
) {
$fields = [];
switch ($type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private function createUser(
array $roles = [],
array $groups = [],
$enabled = false,
$changed = false
$changed = false,
) {
$user = $this->container->get('kunstmaan_admin.user_manager')->createUser();
$user->setUsername($username);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function generate(
$template,
array $sections,
array $parentPages,
$generateFormPageParts
$generateFormPageParts,
) {
$this->bundle = $bundle;
$this->entity = $entity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function __construct(
ManagerRegistry $registry,
$skeletonDir,
CommandAssistant $assistant,
?ContainerInterface $container = null
?ContainerInterface $container = null,
) {
$this->filesystem = $filesystem;
$this->registry = $registry;
Expand Down Expand Up @@ -105,7 +105,7 @@ protected function generateEntity(
$namePrefix,
$dbPrefix,
$extendClass = null,
$withRepository = false
$withRepository = false,
) {
// configure the bundle (needed if the bundle does not contain any Entities yet)
$config = $this->registry->getManager(null)->getConfiguration();
Expand Down Expand Up @@ -187,7 +187,7 @@ protected function generateEntityAdminType(
$entityName,
$entityPrefix,
array $fields,
$extendClass = '\Symfony\Component\Form\AbstractType'
$extendClass = '\Symfony\Component\Form\AbstractType',
) {
$className = $entityName . 'AdminType';
$savePath = $bundle->getPath() . '/Form/' . $entityPrefix . '/' . $className . '.php';
Expand Down
2 changes: 1 addition & 1 deletion src/Kunstmaan/GeneratorBundle/Generator/PageGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function generate(
array $fields,
$template,
array $sections,
array $parentPages
array $parentPages,
) {
$this->bundle = $bundle;
$this->entity = $entity;
Expand Down
10 changes: 5 additions & 5 deletions src/Kunstmaan/GeneratorBundle/Generator/SearchPageGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function generate(
$prefix,
$rootDir,
$createPage,
OutputInterface $output
OutputInterface $output,
) {
$parameters = [
'namespace' => $bundle->getNamespace(),
Expand All @@ -81,7 +81,7 @@ public function generateTemplates(
BundleInterface $bundle,
array $parameters,
$rootDir,
OutputInterface $output
OutputInterface $output,
) {
$dirPath = $this->rootDir . '/templates';
$fullSkeletonDir = $this->skeletonDir . '/Resources/views';
Expand All @@ -107,7 +107,7 @@ public function generateTemplates(
public function generateEntities(
BundleInterface $bundle,
array $parameters,
OutputInterface $output
OutputInterface $output,
) {
$dirPath = sprintf(
'%s/Entity/Pages/',
Expand Down Expand Up @@ -141,7 +141,7 @@ public function generateEntities(
public function generateFixtures(
BundleInterface $bundle,
array $parameters,
OutputInterface $output
OutputInterface $output,
) {
$dirPath = $bundle->getPath() . '/DataFixtures/ORM/SearchPageGenerator/';
$skeletonDir = $this->skeletonDir . '/DataFixtures/ORM/SearchPageGenerator/';
Expand Down Expand Up @@ -173,7 +173,7 @@ private function generateSkeletonBasedClass(
$fullSkeletonDir,
$dirPath,
$className,
array $parameters
array $parameters,
) {
$classPath = sprintf('%s/%s.php', $dirPath, $className);
if (file_exists($classPath)) {
Expand Down
8 changes: 4 additions & 4 deletions src/Kunstmaan/GeneratorBundle/Helper/CommandAssistant.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function writeLine($text, $type = OutputInterface::OUTPUT_NORMAL)
public function write(
$text,
$newLine = false,
$type = OutputInterface::OUTPUT_NORMAL
$type = OutputInterface::OUTPUT_NORMAL,
) {
$this->output->write($text, $newLine, $type);
}
Expand All @@ -111,7 +111,7 @@ public function askAndValidate(
$question,
$validator,
$defaultValue = null,
?array $autoComplete = null
?array $autoComplete = null,
) {
$validationQuestion = new Question(
$this->getQuestionHelper()->getQuestion($question, $defaultValue),
Expand All @@ -131,7 +131,7 @@ public function askConfirmation(
$question,
$defaultString,
$separator = '?',
$defaultValue = true
$defaultValue = true,
) {
$confirmationQuestion = new ConfirmationQuestion(
$this->getQuestionHelper()->getQuestion(
Expand Down Expand Up @@ -167,7 +167,7 @@ public function askSelect(
$choices,
$default = null,
$multiSelect = false,
$errorMessage = 'Value "%s" is invalid'
$errorMessage = 'Value "%s" is invalid',
) {
$bundleQuestion = new ChoiceQuestion(
$this->getQuestionHelper()->getQuestion($question, $default),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct(
EntityManager $em,
MediaManager $mediaManager,
Folder $folder,
Request $request
Request $request,
) {
parent::__construct($em);

Expand Down
2 changes: 1 addition & 1 deletion src/Kunstmaan/MediaBundle/Controller/FolderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct(
AdminListFactory $adminListFactory,
RequestStack $requestStack,
TranslatorInterface $translator,
EntityManagerInterface $em
EntityManagerInterface $em,
) {
$this->mediaManager = $mediaManager;
$this->folderManager = $folderManager;
Expand Down
4 changes: 2 additions & 2 deletions src/Kunstmaan/MediaBundle/Repository/FolderRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public function childrenQueryBuilder(
$direct = false,
$sortByField = null,
$direction = 'ASC',
$includeNode = false
$includeNode = false,
) {
/** @var QueryBuilder $qb */
$qb = parent::childrenQueryBuilder($node, $direct, $sortByField, $direction, $includeNode);
Expand Down Expand Up @@ -241,7 +241,7 @@ public function getNodesHierarchyQueryBuilder(
$node = null,
$direct = false,
array $options = [],
$includeNode = false
$includeNode = false,
) {
/** @var QueryBuilder $qb */
$qb = parent::getNodesHierarchyQueryBuilder($node, $direct, $options, $includeNode);
Expand Down
2 changes: 1 addition & 1 deletion src/Kunstmaan/MediaBundle/Validator/Constraints/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function __construct(
?string $maxHeightMessage = null,
?string $minWidthMessage = null,
?string $maxWidthMessage = null,
?string $mimeTypesMessage = null
?string $mimeTypesMessage = null,
) {
parent::__construct($options, $groups, $payload);

Expand Down
Loading

0 comments on commit 3330728

Please sign in to comment.