Skip to content

Commit

Permalink
allow installation with symfony 6
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Feb 18, 2024
1 parent 43c99e0 commit af3ca96
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 61 deletions.
27 changes: 10 additions & 17 deletions .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,16 @@ jobs:
fail-fast: false
matrix:
include:
- php-version: '7.4'
- php-version: '8.1'
dependencies: 'lowest'
- php-version: '7.4'
symfony-version: 4.4.*
test-installation: true
- php-version: '7.4'
symfony-version: 5.0.*
test-installation: true
- php-version: '8.0'
symfony-version: 5.1.*
test-installation: true
- php-version: '8.1'
- php-version: '8.2'
- php-version: '8.3'
symfony-version: 6.4.*

steps:
- name: Checkout project
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install and configure PHP
uses: shivammathur/setup-php@v2
Expand All @@ -45,17 +40,15 @@ jobs:
tools: 'composer:v2'

- name: Install Symfony Flex
run: composer global require --no-progress --no-scripts --no-plugins symfony/flex
run: |
composer global require --no-progress --no-scripts --no-plugins symfony/flex
composer global config --no-plugins allow-plugins.symfony/flex true
- name: Install dependencies with Composer
uses: ramsey/composer-install@v1
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: --prefer-dist

- name: Execute test cases
run: make test

- name: Test installation
if: ${{ matrix.test-installation == true }}
run: make test
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog
3.0.0 (unreleased)
-----

* Support Symfony 6
* Adjust to doctrine and twig BC breaks. If you extended classes or customized services, check for old `Twig_*` classes or `Doctrine\Common\Persistence` namespace.
* Drop support for old Symfony versions
* Drop support for old PHP versions
Expand Down Expand Up @@ -41,7 +42,7 @@ Released 2.0.0
2.0.0-RC1
---------

* **2017-01-17**: [BC BREAK] Removed DoctrineOrmMappingsPass - all active Doctrine versions contain the mapping pass. Use `Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass` instead.
* **2017-01-17**: [BC BREAK] Removed DoctrineOrmMappingsPass - all active Doctrine versions contain the mapping pass. Use `Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass` instead.
* **2017-01-13**: [BC BREAK] Removed the `Slugifier` classes and the
dependency on `symfony-cmf/slugifier-api`.
* **2016-12-03**: [BC BREAK] Moved sonata admin related classes and
Expand Down
48 changes: 23 additions & 25 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,37 @@
}
],
"require": {
"php": "^7.4 || ^8.0",
"symfony/framework-bundle": "^4.4 || ^5.0",
"symfony/security-core": "^4.4 || ^5.0"
"php": "^8.1",
"symfony/framework-bundle": "^6.4",
"symfony/security-core": "^6.4"
},
"require-dev": {
"jackalope/jackalope-doctrine-dbal": "^1.3",
"symfony/security-bundle": "^4.4 || ^5.0",
"symfony/phpunit-bridge": "^4.4.34 || ^5.0",
"jackalope/jackalope-doctrine-dbal": "^1.3 || ^2.0",
"mockery/mockery": "^1.4.1",
"symfony-cmf/routing-bundle": "^2.1.0",
"symfony-cmf/routing-bundle": "dev-sf7 as 3.1.0",
"symfony-cmf/testing": "^4.0.0",
"doctrine/dbal": "^2.5",
"doctrine/dbal": "^3.8.1 || ^4.0",
"doctrine/doctrine-bundle": "^2.0",
"doctrine/phpcr-odm": "^1.4|^2.0 ",
"doctrine/phpcr-bundle": "^2.3.0",
"symfony/browser-kit": "^4.4 || ^5.0",
"symfony/form": "^4.4 || ^5.0",
"symfony/monolog-bridge": "^4.4 || ^5.0",
"doctrine/phpcr-bundle": "^3.0",
"doctrine/phpcr-odm": "^1.4 || ^2.0 ",
"symfony/browser-kit": "^6.4",
"symfony/form": "^6.4",
"symfony/monolog-bridge": "^6.4",
"symfony/monolog-bundle": "^3.0",
"symfony/templating": "^4.4 || ^5.0",
"symfony/translation": "^4.4 || ^5.0",
"symfony/twig-bundle": "^4.4 || ^5.0",
"symfony/validator": "^4.4 || ^5.0",
"symfony/yaml": "^4.4 || ^5.0",
"symfony/asset": "^4.4 || ^5.0"
"symfony/phpunit-bridge": "^7.0.3",
"symfony/security-bundle": "^6.4",
"symfony/templating": "^6.4",
"symfony/translation": "^6.4",
"symfony/twig-bundle": "^6.4",
"symfony/validator": "^6.4",
"symfony/yaml": "^6.4",
"symfony/asset": "^6.4"
},
"suggest": {
"symfony/twig-bundle": "To get access to the CMF twig extension (^4.4 || ^5.0)",
"doctrine/phpcr-bundle": "To be able to use the CMF twig extension (^1.0)",
"doctrine/phpcr-odm": "To be able to use the CMF twig extension (^1.0)",
"symfony/security-bundle": "To be able to use the publish workflow system (^4.4 || ^5.0)",
"symfony-cmf/routing": "To be able to use the CMF twig extension functions cmf_prev_linkable/cmf_next_linkable (^2.1)",
"symfony-cmf/routing-bundle": "To be able to enable the publish_workflow_listener (^2.1)",
"symfony/twig-bundle": "To get access to the CMF twig extension",
"symfony/security-bundle": "To be able to use the publish workflow system",
"symfony-cmf/routing": "To be able to use the CMF twig extension functions cmf_prev_linkable/cmf_next_linkable",
"symfony-cmf/routing-bundle": "To be able to enable the publish_workflow_listener",
"symfony-cmf/sonata-admin-integration-bundle": "To provide an admin interface for the PHPCR ODM documents."
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Phpcr/NonTranslatableMetadataListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function getSubscribedEvents()
*/
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
{
/** @var $meta ClassMetadata */
/** @var ClassMetadata $meta */
$meta = $eventArgs->getClassMetadata();

if (!$meta->translator) {
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Phpcr/TranslatableMetadataListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function getSubscribedEvents()
*/
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
{
/** @var $meta ClassMetadata */
/** @var ClassMetadata $meta */
$meta = $eventArgs->getClassMetadata();

if ($meta->getReflectionClass()->implementsInterface(TranslatableInterface::class)) {
Expand Down
36 changes: 20 additions & 16 deletions src/Templating/Helper/Cmf.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private function getDocument($document, ?bool $ignoreRole = false, ?string $clas
try {
$document = $this->getDm()->find(null, $document);
} catch (MissingTranslationException $e) {
return;
return null;
}
}

Expand All @@ -188,7 +188,7 @@ private function getDocument($document, ?bool $ignoreRole = false, ?string $clas
|| (true === $ignoreRole && !$this->publishWorkflowChecker->isGranted(PublishWorkflowChecker::VIEW_ANONYMOUS_ATTRIBUTE, $document))
|| (null !== $class && !($document instanceof $class))
) {
return;
return null;
}

return $document;
Expand Down Expand Up @@ -234,7 +234,7 @@ public function findMany(array $paths = [], $limit = false, $offset = false, ?bo
* If you need the bypass role, you will have a firewall configured and can
* simply use {{ is_granted('VIEW', document) }}
*
* @param object $document
* @param ?object $document
*/
public function isPublished($document): bool
{
Expand Down Expand Up @@ -426,12 +426,12 @@ public function isLinkable($document): bool
*/
private function getChildrenPaths(string $path, array &$children, ?int $depth)
{
if (null !== $depth && $depth < 1) {
return;
if (null !== $depth) {
if ($depth-- < 1) {
return;
}
}

--$depth;

$node = $this->getDm()->getPhpcrSession()->getNode($path);
$names = (array) $node->getNodeNames();
foreach ($names as $name) {
Expand Down Expand Up @@ -485,7 +485,7 @@ private function checkChildren(array $childNames, string $path, ?bool $ignoreRol
}
}

return;
return null;
}

/**
Expand Down Expand Up @@ -515,7 +515,7 @@ private function traversePrevDepth(?int $depth, int $anchorDepth, array $childNa
}
}

return;
return null;
}

/**
Expand All @@ -536,7 +536,7 @@ private function searchDepthPrev($path, $anchor, ?int $depth = null, ?bool $igno
}

if (null === $path || '/' === $path) {
return;
return null;
}

$node = $this->getDm()->getPhpcrSession()->getNode($path);
Expand All @@ -550,7 +550,7 @@ private function searchDepthPrev($path, $anchor, ?int $depth = null, ?bool $igno
}

if ($path === $anchor) {
return;
return null;
}

$parent = $node->getParent();
Expand Down Expand Up @@ -592,7 +592,7 @@ private function searchDepthPrev($path, $anchor, ?int $depth = null, ?bool $igno
}
}

return;
return null;
}

/**
Expand All @@ -613,7 +613,7 @@ private function searchDepthNext($path, $anchor, ?int $depth = null, ?bool $igno
}

if (null === $path || '/' === $path) {
return;
return null;
}

$node = $this->getDm()->getPhpcrSession()->getNode($path);
Expand Down Expand Up @@ -653,7 +653,7 @@ private function searchDepthNext($path, $anchor, ?int $depth = null, ?bool $igno
while ('/' !== $parentPath) {
$parent = $parent->getParent();
if (false === strpos($parent->getPath(), $anchor)) {
return;
return null;
}

$childNames = $parent->getNodeNames()->getArrayCopy();
Expand All @@ -666,7 +666,7 @@ private function searchDepthNext($path, $anchor, ?int $depth = null, ?bool $igno
}
}

return;
return null;
}

/**
Expand All @@ -686,7 +686,7 @@ private function search($path, ?bool $reverse = false, ?bool $ignoreRole = false
}

if (null === $path || '/' === $path) {
return;
return null;
}

$node = $this->getDm()->getPhpcrSession()->getNode($path);
Expand Down Expand Up @@ -770,6 +770,8 @@ public function getPrevLinkable($current, $anchor = null, ?int $depth = null, ?b

$current = $candidate;
}

return null;
}

/**
Expand Down Expand Up @@ -800,5 +802,7 @@ public function getNextLinkable($current, $anchor = null, ?int $depth = null, ?b

$current = $candidate;
}

return null;
}
}
1 change: 1 addition & 0 deletions tests/Functional/Form/CheckboxUrlLabelFormTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,6 @@ protected function assertMatchesXpath($html, $expression, $count = 1)
substr($dom->saveHTML(), 6, -8)
));
}
$this->addToAssertionCount(1);
}
}

0 comments on commit af3ca96

Please sign in to comment.