Skip to content

Commit 4f4230a

Browse files
Fix: Lock Symfony dependencies to compatible versions (#457)
* Fix: Lock Symfony dependencies to compatible versions * Fix: Resolve ArgumentCountError in PropertyAccessor tests * Fixes PHPCS
1 parent ae9e56f commit 4f4230a

File tree

2 files changed

+200
-7
lines changed

2 files changed

+200
-7
lines changed

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
"php-http/message-factory": "^1.0",
2929
"phpdocumentor/reflection-docblock": "^5.0",
3030
"psr/http-message": "^1.0 || ^2.0",
31-
"symfony/options-resolver": "^7.2.0",
32-
"symfony/property-access": "^7.2.3",
33-
"symfony/property-info": "^7.2.3",
34-
"symfony/serializer": "^7.2.3"
31+
"symfony/options-resolver": "^7.3.0",
32+
"symfony/property-access": "^7.3.0",
33+
"symfony/property-info": "^7.3.0",
34+
"symfony/serializer": "^7.3.0"
3535
},
3636
"require-dev": {
3737
"dms/phpunit-arraysubset-asserts": "^0.4.0",
@@ -46,9 +46,9 @@
4646
"phpmetrics/phpmetrics": "^2.7",
4747
"phpunit/phpunit": "^9.6",
4848
"sebastian/comparator": "^4.0.5",
49-
"symfony/cache": "^7.2.3",
50-
"symfony/type-info": "^7.2.2",
51-
"symfony/var-exporter": "^7.2.0",
49+
"symfony/cache": "^7.3.0",
50+
"symfony/type-info": "^7.3.0",
51+
"symfony/var-exporter": "^7.3.0",
5252
"vimeo/psalm": "^5.20"
5353
},
5454
"autoload": {

tests/PropertyAccess/PropertyAccessorDecoratorTest.php

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,4 +214,197 @@ public function exceptionsToGetOnSetValue(): array
214214
];
215215
}
216216
}
217+
218+
/* * COMPATIBILITY OVERRIDES (PHPUnit 9+ vs Symfony 7.4+) *
219+
*
220+
* Note: We use `object|array` type hint because Symfony 7.4+ enforces it.
221+
* We use `$value = null` (optional) because some tests in 7.4 don't pass the 3rd argument.
222+
* We use `...func_get_args()` to pass exactly the arguments received to the parent.
223+
*/
224+
225+
/**
226+
* @dataProvider getValidReadPropertyPaths
227+
*/
228+
public function testGetValue(object|array $objectOrArray, string $path, $value = null): void
229+
{
230+
parent::testGetValue(...func_get_args());
231+
}
232+
233+
/**
234+
* @dataProvider getPathsWithMissingProperty
235+
*/
236+
public function testGetValueThrowsExceptionIfPropertyNotFound(object|array $objectOrArray, string $path): void
237+
{
238+
parent::testGetValueThrowsExceptionIfPropertyNotFound(...func_get_args());
239+
}
240+
241+
/**
242+
* @dataProvider getPathsWithMissingProperty
243+
*/
244+
public function testGetValueReturnsNullIfPropertyNotFoundAndExceptionIsDisabled(object|array $objectOrArray, string $path): void
245+
{
246+
parent::testGetValueReturnsNullIfPropertyNotFoundAndExceptionIsDisabled(...func_get_args());
247+
}
248+
249+
/**
250+
* @dataProvider getPathsWithMissingIndex
251+
*/
252+
public function testGetValueThrowsNoExceptionIfIndexNotFound(object|array $objectOrArray, string $path): void
253+
{
254+
parent::testGetValueThrowsNoExceptionIfIndexNotFound(...func_get_args());
255+
}
256+
257+
/**
258+
* @dataProvider getPathsWithMissingIndex
259+
*/
260+
public function testGetValueThrowsExceptionIfIndexNotFoundAndIndexExceptionsEnabled(object|array $objectOrArray, string $path): void
261+
{
262+
parent::testGetValueThrowsExceptionIfIndexNotFoundAndIndexExceptionsEnabled(...func_get_args());
263+
}
264+
265+
/**
266+
* @dataProvider getValidWritePropertyPaths
267+
*/
268+
public function testSetValue(object|array $objectOrArray, string $path, $value = null): void
269+
{
270+
parent::testSetValue(...func_get_args());
271+
}
272+
273+
/**
274+
* @dataProvider getPathsWithMissingProperty
275+
*/
276+
public function testSetValueThrowsExceptionIfPropertyNotFound(object|array $objectOrArray, string $path): void
277+
{
278+
parent::testSetValueThrowsExceptionIfPropertyNotFound(...func_get_args());
279+
}
280+
281+
/**
282+
* @dataProvider getPathsWithMissingIndex
283+
*/
284+
public function testSetValueThrowsNoExceptionIfIndexNotFound(object|array $objectOrArray, string $path): void
285+
{
286+
parent::testSetValueThrowsNoExceptionIfIndexNotFound(...func_get_args());
287+
}
288+
289+
/**
290+
* @dataProvider getPathsWithMissingIndex
291+
*/
292+
public function testSetValueThrowsNoExceptionIfIndexNotFoundAndIndexExceptionsEnabled(object|array $objectOrArray, string $path): void
293+
{
294+
parent::testSetValueThrowsNoExceptionIfIndexNotFoundAndIndexExceptionsEnabled(...func_get_args());
295+
}
296+
297+
/**
298+
* @dataProvider getValidReadPropertyPaths
299+
*/
300+
public function testIsReadable(object|array $objectOrArray, string $path, $value = null): void
301+
{
302+
parent::testIsReadable(...func_get_args());
303+
}
304+
305+
/**
306+
* @dataProvider getPathsWithMissingProperty
307+
*/
308+
public function testIsReadableReturnsFalseIfPropertyNotFound(object|array $objectOrArray, string $path): void
309+
{
310+
parent::testIsReadableReturnsFalseIfPropertyNotFound(...func_get_args());
311+
}
312+
313+
/**
314+
* @dataProvider getPathsWithMissingIndex
315+
*/
316+
public function testIsReadableReturnsTrueIfIndexNotFound(object|array $objectOrArray, string $path): void
317+
{
318+
parent::testIsReadableReturnsTrueIfIndexNotFound(...func_get_args());
319+
}
320+
321+
/**
322+
* @dataProvider getPathsWithMissingIndex
323+
*/
324+
public function testIsReadableReturnsFalseIfIndexNotFoundAndIndexExceptionsEnabled(object|array $objectOrArray, string $path): void
325+
{
326+
parent::testIsReadableReturnsFalseIfIndexNotFoundAndIndexExceptionsEnabled(...func_get_args());
327+
}
328+
329+
/**
330+
* @dataProvider getValidWritePropertyPaths
331+
*/
332+
public function testIsWritable(object|array $objectOrArray, string $path, $value = null): void
333+
{
334+
parent::testIsWritable(...func_get_args());
335+
}
336+
337+
/**
338+
* @dataProvider getPathsWithMissingProperty
339+
*/
340+
public function testIsWritableReturnsFalseIfPropertyNotFound(object|array $objectOrArray, string $path): void
341+
{
342+
parent::testIsWritableReturnsFalseIfPropertyNotFound(...func_get_args());
343+
}
344+
345+
/**
346+
* @dataProvider getPathsWithMissingIndex
347+
*/
348+
public function testIsWritableReturnsTrueIfIndexNotFound(object|array $objectOrArray, string $path): void
349+
{
350+
parent::testIsWritableReturnsTrueIfIndexNotFound(...func_get_args());
351+
}
352+
353+
/**
354+
* @dataProvider getPathsWithMissingIndex
355+
*/
356+
public function testIsWritableReturnsTrueIfIndexNotFoundAndIndexExceptionsEnabled(object|array $objectOrArray, string $path): void
357+
{
358+
parent::testIsWritableReturnsTrueIfIndexNotFoundAndIndexExceptionsEnabled(...func_get_args());
359+
}
360+
361+
/**
362+
* @dataProvider getNullSafeIndexPaths
363+
*/
364+
public function testNullSafeIndexWithThrowOnInvalidIndex(object|array $objectOrArray, string $path, $value = null): void
365+
{
366+
parent::testNullSafeIndexWithThrowOnInvalidIndex(...func_get_args());
367+
}
368+
369+
/**
370+
* @dataProvider getReferenceChainObjectsForSetValue
371+
*/
372+
public function testSetValueForReferenceChainIssue($object, $path, $value): void
373+
{
374+
parent::testSetValueForReferenceChainIssue($object, $path, $value);
375+
}
376+
377+
/**
378+
* @dataProvider getReferenceChainObjectsForIsWritable
379+
*/
380+
public function testIsWritableForReferenceChainIssue($object, $path, $value): void
381+
{
382+
parent::testIsWritableForReferenceChainIssue($object, $path, $value);
383+
}
384+
385+
/* * PHP 8.4 SKIPS * */
386+
387+
public function testIsWritableWithAsymmetricVisibility(): void
388+
{
389+
if (PHP_VERSION_ID < 80400) {
390+
$this->markTestSkipped('Requires PHP 8.4');
391+
}
392+
parent::testIsWritableWithAsymmetricVisibility();
393+
}
394+
395+
public function testIsReadableWithAsymmetricVisibility(): void
396+
{
397+
if (PHP_VERSION_ID < 80400) {
398+
$this->markTestSkipped('Requires PHP 8.4');
399+
}
400+
parent::testIsReadableWithAsymmetricVisibility();
401+
}
402+
403+
public function testSetValueWithAsymmetricVisibility(string $propertyPath = '', ?string $expectedException = null): void
404+
{
405+
if (PHP_VERSION_ID < 80400) {
406+
$this->markTestSkipped('Requires PHP 8.4');
407+
}
408+
parent::testSetValueWithAsymmetricVisibility($propertyPath, $expectedException);
409+
}
217410
}

0 commit comments

Comments
 (0)