Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,26 @@ jobs:
can-fail: false
symfony-require: "7.0.*"
remove-sensio-bundle: yes # SensioFrameworkExtraBundle is not compatible with Symfony 7.0 or later
- php-version: "8.3"
composer-flags: ""
can-fail: false
symfony-require: "7.0.*"
remove-sensio-bundle: yes # SensioFrameworkExtraBundle is not compatible with Symfony 7.0 or later
- php-version: "8.4"
composer-flags: ""
can-fail: false
symfony-require: "7.0.*"
remove-sensio-bundle: yes # SensioFrameworkExtraBundle is not compatible with Symfony 7.0 or later
- php-version: "8.4"
composer-flags: ""
can-fail: false
symfony-require: "7.4.*"
remove-sensio-bundle: yes # SensioFrameworkExtraBundle is not compatible with Symfony 7.0 or later
- php-version: "8.4"
composer-flags: ""
can-fail: false
symfony-require: "8.0.*"
remove-sensio-bundle: yes # SensioFrameworkExtraBundle is not compatible with Symfony 7.0 or later
- php-version: "8.3"
composer-flags: ""
can-fail: true # we don't want to fail the build if we are incompatible with the next (unstable) Symfony version
Expand Down
4 changes: 2 additions & 2 deletions EventListener/AllowedMethodsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ public function onKernelResponse(ResponseEvent $event): void

$allowedMethods = $this->loader->getAllowedMethods();

if (isset($allowedMethods[$event->getRequest()->get('_route')])) {
if (isset($allowedMethods[$event->getRequest()->attributes->get('_route')])) {
$event->getResponse()
->headers
->set('Allow', implode(', ', $allowedMethods[$event->getRequest()->get('_route')]));
->set('Allow', implode(', ', $allowedMethods[$event->getRequest()->attributes->get('_route')]));
}
}
}
16 changes: 8 additions & 8 deletions Tests/Controller/Annotations/AbstractScalarParamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ public function testScalarRequirements()
$this->param->requirements = 'foo %bar% %%';
$this->assertEquals([
new NotNull(),
new Regex([
'pattern' => '#^(?:foo %bar% %%)$#xsu',
'message' => "Parameter 'bar' value, does not match requirements 'foo %bar% %%'",
]),
new Regex(
'#^(?:foo %bar% %%)$#xsu',
"Parameter 'bar' value, does not match requirements 'foo %bar% %%'",
),
], $this->param->getConstraints());
}

Expand All @@ -95,10 +95,10 @@ public function testArrayRequirements()
];
$this->assertEquals([
new NotNull(),
new Regex([
'pattern' => '#^(?:foo)$#xsu',
'message' => 'bar',
]),
new Regex(
'#^(?:foo)$#xsu',
'bar',
),
], $this->param->getConstraints());
}

Expand Down
18 changes: 17 additions & 1 deletion Tests/Fixtures/Annotations/IdenticalToRequestParam.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace FOS\RestBundle\Tests\Fixtures\Annotations;

use Composer\InstalledVersions;
use FOS\RestBundle\Controller\Annotations\RequestParam;
use Symfony\Component\Validator\Constraints\IdenticalTo;

Expand Down Expand Up @@ -41,6 +42,21 @@ public function __construct(
bool $nullable = false,
bool $allowBlank = true
) {
parent::__construct($name, $key, null !== $identicalTo ? new IdenticalTo($identicalTo) : null, $default, $description, $incompatibles, $strict, $map, $nullable, $allowBlank);
$validatorSupportsArrayConfig = true;
if (class_exists(InstalledVersions::class)) {
$validatorVersion = InstalledVersions::getVersion('symfony/validator');

$validatorSupportsArrayConfig = version_compare($validatorVersion, '8.0', '<');
}

if (null === $identicalTo) {
$options = null;
} elseif ($validatorSupportsArrayConfig) {
$options = $identicalTo;
} else {
$options = $identicalTo['value'];
}

parent::__construct($name, $key, null !== $options ? new IdenticalTo($options) : null, $default, $description, $incompatibles, $strict, $map, $nullable, $allowBlank);
}
}
40 changes: 20 additions & 20 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
"require": {
"php": "^7.4|^8.0",
"symfony/config": "^5.4|^6.4|^7.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like I forgot to adjust this version constraint 🤦‍♂️

I'm going to create PR to fix this.

"symfony/dependency-injection": "^5.4|^6.4|^7.0",
"symfony/dependency-injection": "^5.4|^6.4|^7.0|^8.0",
"symfony/deprecation-contracts": "^2.1|^3.0",
"symfony/event-dispatcher": "^5.4|^6.4|^7.0",
"symfony/framework-bundle": "^5.4|^6.4|^7.0",
"symfony/http-foundation": "^5.4|^6.4|^7.0",
"symfony/http-kernel": "^5.4|^6.4|^7.0",
"symfony/routing": "^5.4|^6.4|^7.0",
"symfony/security-core": "^5.4|^6.4|^7.0",
"symfony/event-dispatcher": "^5.4|^6.4|^7.0|^8.0",
"symfony/framework-bundle": "^5.4|^6.4|^7.0|^8.0",
"symfony/http-foundation": "^5.4|^6.4|^7.0|^8.0",
"symfony/http-kernel": "^5.4|^6.4|^7.0|^8.0",
"symfony/routing": "^5.4|^6.4|^7.0|^8.0",
"symfony/security-core": "^5.4|^6.4|^7.0|^8.0",
"willdurand/jsonp-callback-validator": "^1.0|^2.0",
"willdurand/negotiation": "^2.0|^3.0"
},
Expand All @@ -50,19 +50,19 @@
"psr/http-message": "^1.0",
"psr/log": "^1.0|^2.0|^3.0",
"sensio/framework-extra-bundle": "^6.1",
"symfony/asset": "^5.4|^6.4|^7.0",
"symfony/browser-kit": "^5.4|^6.4|^7.0",
"symfony/css-selector": "^5.4|^6.4|^7.0",
"symfony/expression-language": "^5.4|^6.4|^7.0",
"symfony/form": "^5.4|^6.4|^7.0",
"symfony/mime": "^5.4|^6.4|^7.0",
"symfony/phpunit-bridge": "^7.0.1",
"symfony/security-bundle": "^5.4|^6.4|^7.0",
"symfony/serializer": "^5.4|^6.4|^7.0",
"symfony/twig-bundle": "^5.4|^6.4|^7.0",
"symfony/validator": "^5.4|^6.4|^7.0",
"symfony/web-profiler-bundle": "^5.4|^6.4|^7.0",
"symfony/yaml": "^5.4|^6.4|^7.0"
"symfony/asset": "^5.4|^6.4|^7.0|^8.0",
"symfony/browser-kit": "^5.4|^6.4|^7.0|^8.0",
"symfony/css-selector": "^5.4|^6.4|^7.0|^8.0",
"symfony/expression-language": "^5.4|^6.4|^7.0|^8.0",
"symfony/form": "^5.4|^6.4|^7.0|^8.0",
"symfony/mime": "^5.4|^6.4|^7.0|^8.0",
"symfony/phpunit-bridge": "^7.0.1|^8.0",
"symfony/security-bundle": "^5.4|^6.4|^7.0|^8.0",
"symfony/serializer": "^5.4|^6.4|^7.0|^8.0",
"symfony/twig-bundle": "^5.4|^6.4|^7.0|^8.0",
"symfony/validator": "^5.4|^6.4|^7.0|^8.0",
"symfony/web-profiler-bundle": "^5.4|^6.4|^7.0|^8.0",
"symfony/yaml": "^5.4|^6.4|^7.0|^8.0"
},
"suggest": {
"jms/serializer-bundle": "Add support for advanced serialization capabilities, recommended",
Expand Down