Skip to content

Commit

Permalink
Fixed deprecations and setup CI
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed May 31, 2024
1 parent 80360a2 commit 3aada63
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 15 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: CI

on:
push: ~
pull_request: ~

permissions: read-all

jobs:
ci:
uses: 'terminal42/contao-build-tools/.github/workflows/build-tools.yml@main'
13 changes: 13 additions & 0 deletions composer-dependency-analyser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
use ShipMonk\ComposerDependencyAnalyser\Config\ErrorType;

return (new Configuration())
->ignoreErrorsOnPackage('symfony/config', [ErrorType::SHADOW_DEPENDENCY])
->ignoreErrorsOnPackage('symfony/dependency-injection', [ErrorType::SHADOW_DEPENDENCY])
->ignoreErrorsOnPackage('symfony/http-foundation', [ErrorType::SHADOW_DEPENDENCY])
->ignoreErrorsOnPackage('symfony/http-kernel', [ErrorType::SHADOW_DEPENDENCY])
->ignoreErrorsOnPackage('symfony/security-core', [ErrorType::SHADOW_DEPENDENCY])
->ignoreErrorsOnPackage('symfony/service-contracts', [ErrorType::SHADOW_DEPENDENCY])
;
8 changes: 8 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,13 @@
},
"extra": {
"contao-manager-plugin": "Terminal42\\FolderpageBundle\\ContaoManager\\Plugin"
},
"config": {
"allow-plugins": {
"contao-components/installer": false,
"php-http/discovery": false,
"contao/manager-plugin": false,
"terminal42/contao-build-tools": true
}
}
}
2 changes: 1 addition & 1 deletion src/DependencyInjection/Compiler/ConfigureVoterPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class ConfigureVoterPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
if (!$container->has('contao.security.data_container.page_type_access_voter')) {
$container->removeDefinition(PageTypeAccessVoter::class);
Expand Down
7 changes: 1 addition & 6 deletions src/EventListener/PageBreadcrumbListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private function addBreadcrumb(): void
$objSession = $this->requestStack->getSession()->getBag('contao_backend');

// Set a new node
if (Input::get('pn') !== null) {
if (null !== Input::get('pn')) {
// Check the path (thanks to Arnaud Buchoux)
if (Validator::isInsecurePath(Input::get('pn', true))) {
throw new \RuntimeException('Insecure path '.Input::get('pn', true));
Expand All @@ -72,11 +72,6 @@ private function addBreadcrumb(): void
return;
}

// Check the path (thanks to Arnaud Buchoux)
if (Validator::isInsecurePath($intNode)) {
throw new \RuntimeException('Insecure path '.$intNode);
}

$arrIds = [];
$arrLinks = [];
$objUser = $this->security->getUser();
Expand Down
2 changes: 1 addition & 1 deletion src/Terminal42FolderpageBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function getPath(): string
return \dirname(__DIR__);
}

public function build(ContainerBuilder $container)
public function build(ContainerBuilder $container): void
{
$container->addCompilerPass(new ConfigureVoterPass());
}
Expand Down
14 changes: 7 additions & 7 deletions src/Voter/PageTypeAccessVoter.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ public function vote(TokenInterface $token, $subject, array $attributes): int
return $result;
}

public function reset(): void
{
if ($this->inner instanceof ResetInterface) {
$this->inner->reset();
}
}

private function validateCreateOrUpdateFolder(TokenInterface $token, CreateAction|UpdateAction $subject): bool
{
$types = [];
Expand Down Expand Up @@ -79,11 +86,4 @@ private function validateMoveToFolder(CreateAction|UpdateAction $subject): bool

return 'folder' === $this->connection->fetchOne('SELECT type FROM tl_page WHERE id=?', [$subject->getNewPid()]);
}

public function reset(): void
{
if ($this->inner instanceof ResetInterface) {
$this->inner->reset();
}
}
}

0 comments on commit 3aada63

Please sign in to comment.