Skip to content

Commit 8fd5ad6

Browse files
authored
Merge 4.1 into main
2 parents a42034d + 05a2101 commit 8fd5ad6

File tree

49 files changed

+386
-1795
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+386
-1795
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: CI
33
on:
44
push:
55
pull_request:
6+
pull_request_target:
7+
types: [opened, reopened, synchronize]
68

79
concurrency:
810
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -14,24 +16,22 @@ env:
1416

1517
jobs:
1618
commitlint:
17-
if: github.event_name == 'pull_request'
18-
env:
19-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
if: github.event_name == 'pull_request_target'
2020
runs-on: ubuntu-latest
2121
steps:
2222
- uses: actions/checkout@v4
2323
with:
2424
fetch-depth: 0
2525
- name: Run commitlint
2626
run: |
27-
commit=$(gh api \
28-
/repos/${{ github.repository }}/pulls/${{github.event.number}}/commits \
29-
| jq -r '.[0].commit.message' \
30-
| head -n 1)
27+
base_sha="${{ github.event.pull_request.base.sha }}"
28+
head_sha="${{ github.event.pull_request.head.sha }}"
29+
first_commit_sha=$(git rev-list --no-merges --reverse $base_sha..$head_sha | head -n 1)
30+
commit_message=$(git log -1 --pretty=%B $first_commit_sha)
3131
# we can't use npx see https://github.com/conventional-changelog/commitlint/issues/613
3232
echo '{}' > package.json
3333
npm install --no-fund --no-audit @commitlint/config-conventional @commitlint/cli
34-
echo $commit | ./node_modules/.bin/commitlint -g .commitlintrc
34+
echo "$commit_message" | ./node_modules/.bin/commitlint -g .commitlintrc
3535
3636
architecture:
3737
name: Check components interdependencies
@@ -1050,7 +1050,7 @@ jobs:
10501050
strategy:
10511051
matrix:
10521052
php:
1053-
- '8.3'
1053+
- '8.4'
10541054
fail-fast: false
10551055
env:
10561056
APP_ENV: sqlite
@@ -1063,20 +1063,13 @@ jobs:
10631063
with:
10641064
php-version: ${{ matrix.php }}
10651065
tools: pecl, composer
1066-
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, fileinfo
1066+
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, fileinfo, mongodb
10671067
coverage: none
10681068
ini-values: memory_limit=-1
1069-
# Not in pecl
1070-
- name: Setup mongodb
1071-
run: |
1072-
curl -sLO https://github.com/mongodb/mongo-php-driver/releases/download/1.17.2/php_mongodb-1.17.2-8.3-nts-x64.zip
1073-
unzip -q php_mongodb-1.17.2-8.3-nts-x64.zip php_mongodb.dll
1074-
mv php_mongodb.dll C:\tools\php\ext
1075-
echo "extension=php_mongodb.dll" >> C:\tools\php\php.ini
10761069
- name: Get composer cache directory
10771070
id: composercache
1078-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
10791071
shell: bash
1072+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
10801073
- name: Cache dependencies
10811074
uses: actions/cache@v4
10821075
with:
@@ -1085,18 +1078,22 @@ jobs:
10851078
restore-keys: ${{ runner.os }}-composer-
10861079
- name: Keep windows path
10871080
id: get-cwd
1081+
shell: bash
10881082
run: |
10891083
cwd=$(php -r 'echo(str_replace("\\", "\\\\", $_SERVER["argv"][1]));' '${{ github.workspace }}')
10901084
echo cwd=$cwd >> $GITHUB_OUTPUT
1091-
shell: bash
10921085
- name: Update project dependencies
1086+
shell: bash
10931087
run: |
1088+
php -m
10941089
composer global require soyuka/pmu
10951090
composer global config allow-plugins.soyuka/pmu true --no-interaction
10961091
composer global link . --working-directory='${{ steps.get-cwd.outputs.cwd }}'
10971092
- name: Clear test app cache
1093+
shell: bash
10981094
run: tests/Fixtures/app/console cache:clear --ansi
10991095
- name: Run Behat tests
1096+
shell: bash
11001097
run: vendor/bin/behat --out=std --format=progress --profile=default --no-interaction
11011098

11021099
phpunit-symfony-lowest:

features/doctrine/issue6039/entity_class_option.feature

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/Doctrine/Odm/State/LinksHandlerTrait.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,8 @@ private function handleLinks(Builder $aggregationBuilder, array $identifiers, ar
5959
/**
6060
* @throws RuntimeException
6161
*/
62-
private function buildAggregation(string $toClass, array $links, array $identifiers, array $context, array $executeOptions, string $previousAggregationClass, Builder $previousAggregationBuilder, ?Operation $operation = null): Builder
62+
private function buildAggregation(string $toClass, array $links, array $identifiers, array $context, array $executeOptions, string $previousAggregationClass, Builder $previousAggregationBuilder, Operation $operation): Builder
6363
{
64-
if (!$operation) {
65-
trigger_deprecation('api-platform/core', '3.2', 'In API Platform 4 the last argument "operation" will be required and this trait will be internal. Use the "handleLinks" feature instead.');
66-
}
67-
6864
if (\count($links) <= 0) {
6965
return $previousAggregationBuilder;
7066
}
@@ -88,10 +84,8 @@ private function buildAggregation(string $toClass, array $links, array $identifi
8884

8985
$manager = $this->managerRegistry->getManagerForClass($aggregationClass);
9086
if (!$manager instanceof DocumentManager) {
91-
if ($operation) {
92-
$aggregationClass = $this->getLinkFromClass($link, $operation);
93-
$manager = $this->managerRegistry->getManagerForClass($aggregationClass);
94-
}
87+
$aggregationClass = $this->getLinkFromClass($link, $operation);
88+
$manager = $this->managerRegistry->getManagerForClass($aggregationClass);
9589

9690
if (!$manager instanceof DocumentManager) {
9791
throw new RuntimeException(\sprintf('The manager for "%s" must be an instance of "%s".', $aggregationClass, DocumentManager::class));

src/GraphQl/Action/EntrypointAction.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,10 @@ public function __construct(
4141
private readonly SchemaBuilderInterface $schemaBuilder,
4242
private readonly ExecutorInterface $executor,
4343
private readonly ?GraphiQlAction $graphiQlAction,
44-
private readonly ?GraphQlPlaygroundAction $graphQlPlaygroundAction,
4544
private readonly NormalizerInterface $normalizer,
4645
private readonly ErrorHandlerInterface $errorHandler,
4746
bool $debug = false,
4847
private readonly bool $graphiqlEnabled = false,
49-
private readonly bool $graphQlPlaygroundEnabled = false,
5048
private readonly ?string $defaultIde = null,
5149
?Negotiator $negotiator = null,
5250
) {
@@ -64,10 +62,6 @@ public function __invoke(Request $request): Response
6462
if ('graphiql' === $this->defaultIde && $this->graphiqlEnabled && $this->graphiQlAction) {
6563
return ($this->graphiQlAction)($request);
6664
}
67-
68-
if ('graphql-playground' === $this->defaultIde && $this->graphQlPlaygroundEnabled && $this->graphQlPlaygroundAction) {
69-
return ($this->graphQlPlaygroundAction)($request);
70-
}
7165
}
7266

7367
[$query, $operationName, $variables] = $this->parseRequest($request);

src/GraphQl/Action/GraphQlPlaygroundAction.php

Lines changed: 0 additions & 45 deletions
This file was deleted.

src/GraphQl/Tests/Action/EntrypointActionTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
use ApiPlatform\GraphQl\Action\EntrypointAction;
1717
use ApiPlatform\GraphQl\Action\GraphiQlAction;
18-
use ApiPlatform\GraphQl\Action\GraphQlPlaygroundAction;
1918
use ApiPlatform\GraphQl\Error\ErrorHandler;
2019
use ApiPlatform\GraphQl\ExecutorInterface;
2120
use ApiPlatform\GraphQl\Serializer\Exception\ErrorNormalizer;
@@ -270,8 +269,7 @@ private function getEntrypointAction(array $variables = ['graphqlVariable']): En
270269
$routerProphecy->generate('api_graphql_entrypoint')->willReturn('/graphiql');
271270

272271
$graphiQlAction = new GraphiQlAction($twigProphecy->reveal(), $routerProphecy->reveal(), true);
273-
$graphQlPlaygroundAction = new GraphQlPlaygroundAction($twigProphecy->reveal(), $routerProphecy->reveal(), true);
274272

275-
return new EntrypointAction($schemaBuilderProphecy->reveal(), $executorProphecy->reveal(), $graphiQlAction, $graphQlPlaygroundAction, $normalizer, $errorHandler, false, true, true, 'graphiql');
273+
return new EntrypointAction($schemaBuilderProphecy->reveal(), $executorProphecy->reveal(), $graphiQlAction, $normalizer, $errorHandler, false, true, 'graphiql');
276274
}
277275
}

src/GraphQl/Tests/Action/GraphQlPlaygroundActionTest.php

Lines changed: 0 additions & 60 deletions
This file was deleted.

src/JsonSchema/SchemaFactory.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,11 @@ private function buildLegacyPropertySchema(Schema $schema, string $definitionNam
246246
$subDefinitionName = $this->definitionNameFactory->create($className, $format, $className, null, $serializerContext);
247247

248248
if (isset($subSchema->getDefinitions()[$subDefinitionName])) {
249-
unset($subSchema->getDefinitions()[$subDefinitionName]['properties']['@id']);
249+
// @see https://github.com/api-platform/core/issues/7162
250+
// Need to rebuild the definition without @id property and set it back to the sub-schema
251+
$subSchemaDefinition = $subSchema->getDefinitions()[$subDefinitionName]->getArrayCopy();
252+
unset($subSchemaDefinition['properties']['@id']);
253+
$subSchema->getDefinitions()[$subDefinitionName] = new \ArrayObject($subSchemaDefinition);
250254
}
251255
}
252256

src/Laravel/ApiPlatformProvider.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@
158158
use Illuminate\Routing\Router;
159159
use Illuminate\Support\ServiceProvider;
160160
use Negotiation\Negotiator;
161-
use phpDocumentor\Reflection\DocBlockFactory;
161+
use PHPStan\PhpDocParser\Parser\PhpDocParser;
162162
use Psr\Log\LoggerInterface;
163163
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
164-
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
164+
use Symfony\Component\PropertyInfo\Extractor\PhpStanExtractor;
165165
use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor;
166166
use Symfony\Component\PropertyInfo\PropertyInfoExtractor;
167167
use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface;
@@ -196,13 +196,13 @@ public function register(): void
196196
$this->mergeConfigFrom(__DIR__.'/config/api-platform.php', 'api-platform');
197197

198198
$this->app->singleton(PropertyInfoExtractorInterface::class, function () {
199-
$phpDocExtractor = class_exists(DocBlockFactory::class) ? new PhpDocExtractor() : null;
199+
$phpstanExtractor = class_exists(PhpDocParser::class) ? new PhpStanExtractor() : null;
200200
$reflectionExtractor = new ReflectionExtractor();
201201

202202
return new PropertyInfoExtractor(
203203
[$reflectionExtractor],
204-
$phpDocExtractor ? [$phpDocExtractor, $reflectionExtractor] : [$reflectionExtractor],
205-
$phpDocExtractor ? [$phpDocExtractor] : [],
204+
$phpstanExtractor ? [$phpstanExtractor, $reflectionExtractor] : [$reflectionExtractor],
205+
[],
206206
[$reflectionExtractor],
207207
[$reflectionExtractor]
208208
);

src/Laravel/Eloquent/PropertyAccess/PropertyAccessor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ public function __construct(
3232
}
3333

3434
/**
35-
* @param array<mixed, mixed>|object $objectOrArray
35+
* @param object|array<mixed, mixed> $objectOrArray
36+
*
37+
* @param-out object|array<mixed, mixed> $objectOrArray
3638
*/
3739
public function setValue(object|array &$objectOrArray, string|PropertyPathInterface $propertyPath, mixed $value): void
3840
{

0 commit comments

Comments
 (0)