Skip to content

Commit 080c49f

Browse files
Merge branch '5.4' into 6.0
* 5.4: (21 commits) Add missing license header [Workflow] Catch error when trying to get an uninitialized marking Add missing license header Allow usage of Provider domains if possible Use reference date in reverse transform Fixes #40997 Fix env resolution in lock configuration Fix Symfony not working on SMB share #45990 [Messenger] DoctrineTransportFactory works with notify and decorated PostgreSQL driver [Cache] make LockRegistry use static properties instead of static variables fix: return-path has higher priority for envelope address than from address (fixes #41322) [HttpClient] Fix sending content-length when streaming the body [Console] Header with column max width is now well wrap with separator Fix use_cookies framework session configuration [FrameworkBundle] [Command] Fix `debug:router --no-interaction` error … [Intl] Update the ICU data to 71.1 - 5.4 [Intl] Update the ICU data to 71.1 - 4.4 Add tests to messenger connection get for OraclePlatform [RateLimiter] Adding default empty value [DependencyInjection] Add TaggedIteratorArgument unit tests [Process] Fix Process::getEnv() when setEnv() hasn't been called before ...
2 parents 962965e + 3423025 commit 080c49f

21 files changed

+235
-1
lines changed

MarkingStore/MethodMarkingStore.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,15 @@ public function getMarking(object $subject): Marking
5454
throw new LogicException(sprintf('The method "%s::%s()" does not exist.', get_debug_type($subject), $method));
5555
}
5656

57-
$marking = $subject->{$method}();
57+
$marking = null;
58+
try {
59+
$marking = $subject->{$method}();
60+
} catch (\Error $e) {
61+
$unInitializedPropertyMassage = sprintf('Typed property %s::$%s must not be accessed before initialization', get_debug_type($subject), $this->property);
62+
if ($e->getMessage() !== $unInitializedPropertyMassage) {
63+
throw $e;
64+
}
65+
}
5866

5967
if (null === $marking) {
6068
return new Marking();

Tests/DefinitionBuilderTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Workflow\Tests;
413

514
use PHPUnit\Framework\TestCase;

Tests/DefinitionTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Workflow\Tests;
413

514
use PHPUnit\Framework\TestCase;

Tests/Dumper/GraphvizDumperTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Workflow\Tests\Dumper;
413

514
use PHPUnit\Framework\TestCase;

Tests/Dumper/PlantUmlDumperTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/*
34
* This file is part of the Symfony package.
45
*

Tests/Dumper/StateMachineGraphvizDumperTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Workflow\Tests\Dumper;
413

514
use PHPUnit\Framework\TestCase;

Tests/EventListener/AuditTrailListenerTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Workflow\Tests\EventListener;
413

514
use PHPUnit\Framework\TestCase;

Tests/EventListener/GuardListenerTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Workflow\Tests\EventListener;
413

514
use PHPUnit\Framework\TestCase;

Tests/MarkingStore/MethodMarkingStoreTest.php

+39
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Workflow\Tests\MarkingStore;
413

514
use PHPUnit\Framework\TestCase;
@@ -78,6 +87,36 @@ public function testGetMarkingWithValueObject()
7887
$this->assertSame('first_place', (string) $subject->getMarking());
7988
}
8089

90+
/**
91+
* @requires PHP 7.4
92+
*/
93+
public function testGetMarkingWithUninitializedProperty()
94+
{
95+
$subject = new SubjectWithType();
96+
97+
$markingStore = new MethodMarkingStore(true);
98+
99+
$marking = $markingStore->getMarking($subject);
100+
101+
$this->assertInstanceOf(Marking::class, $marking);
102+
$this->assertCount(0, $marking->getPlaces());
103+
}
104+
105+
/**
106+
* @requires PHP 7.4
107+
*/
108+
public function testGetMarkingWithUninitializedProperty2()
109+
{
110+
$subject = new SubjectWithType();
111+
112+
$markingStore = new MethodMarkingStore(true, 'marking2');
113+
114+
$this->expectException(\Error::class);
115+
$this->expectExceptionMessage('Typed property Symfony\Component\Workflow\Tests\MarkingStore\SubjectWithType::$marking must not be accessed before initialization');
116+
117+
$markingStore->getMarking($subject);
118+
}
119+
81120
private function createValueObject(string $markingValue)
82121
{
83122
return new class($markingValue) {
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Workflow\Tests\MarkingStore;
13+
14+
class SubjectWithType
15+
{
16+
private string $marking;
17+
18+
public function getMarking(): string
19+
{
20+
return $this->marking;
21+
}
22+
23+
public function setMarking(string $type): void
24+
{
25+
$this->marking = $type;
26+
}
27+
28+
public function getMarking2(): string
29+
{
30+
// Typo made on purpose!
31+
return $this->marking;
32+
}
33+
}

Tests/MarkingTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Workflow\Tests;
413

514
use PHPUnit\Framework\TestCase;

Tests/Metadata/InMemoryMetadataStoreTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Workflow\Tests\Metadata;
413

514
use PHPUnit\Framework\TestCase;

Tests/RegistryTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Workflow\Tests;
413

514
use PHPUnit\Framework\TestCase;

Tests/StateMachineTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Workflow\Tests;
413

514
use PHPUnit\Framework\TestCase;

Tests/Subject.php

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Workflow\Tests;
413

514
final class Subject

Tests/SupportStrategy/InstanceOfSupportStrategyTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Workflow\Tests\SupportStrategy;
413

514
use PHPUnit\Framework\TestCase;

Tests/TransitionTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Workflow\Tests;
413

514
use PHPUnit\Framework\TestCase;

Tests/Validator/StateMachineValidatorTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Workflow\Tests\Validator;
413

514
use PHPUnit\Framework\TestCase;

Tests/Validator/WorkflowValidatorTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Workflow\Tests\Validator;
413

514
use PHPUnit\Framework\TestCase;

Tests/WorkflowBuilderTrait.php

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Workflow\Tests;
413

514
use Symfony\Component\Workflow\Definition;

Tests/WorkflowTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Workflow\Tests;
413

514
use PHPUnit\Framework\TestCase;

0 commit comments

Comments
 (0)