Skip to content

Commit afc899d

Browse files
committed
minor #1760 [Turbo] fix sca (kbond)
This PR was merged into the 2.x branch. Discussion ---------- [Turbo] fix sca | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Issues | n/a | License | MIT Not sure how to fix the failing test. Commits ------- 4360620 [Turbo] fix sca
2 parents e208f7e + 4360620 commit afc899d

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

src/Turbo/phpstan.neon.dist

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,13 @@ parameters:
3535
message: "#^Parameter \\$stimulus of method Symfony\\\\UX\\\\Turbo\\\\Bridge\\\\Mercure\\\\TurboStreamListenRenderer\\:\\:__construct\\(\\) has invalid type Symfony\\\\WebpackEncoreBundle\\\\Twig\\\\StimulusTwigExtension\\.$#"
3636
count: 1
3737
path: src/Bridge/Mercure/TurboStreamListenRenderer.php
38+
39+
-
40+
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\Event\\\\OnFlushEventArgs\\:\\:getEntityManager\\(\\)\\.$#"
41+
count: 1
42+
path: src/Doctrine/BroadcastListener.php
43+
44+
-
45+
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\Event\\\\PostFlushEventArgs\\:\\:getEntityManager\\(\\)\\.$#"
46+
count: 1
47+
path: src/Doctrine/BroadcastListener.php

src/Turbo/src/Doctrine/BroadcastListener.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ private function storeEntitiesToPublish(EntityManagerInterface $em, object $enti
130130

131131
if (!isset($this->broadcastedClasses[$class])) {
132132
$this->broadcastedClasses[$class] = [];
133-
$r = null;
133+
$r = new \ReflectionClass($class);
134134

135-
if ($options = ($r = new \ReflectionClass($class))->getAttributes(Broadcast::class)) {
135+
if ($options = $r->getAttributes(Broadcast::class)) {
136136
foreach ($options as $option) {
137137
$this->broadcastedClasses[$class][] = $option->newInstance()->options;
138138
}
139-
} elseif ($this->annotationReader && $options = $this->annotationReader->getClassAnnotations($r ?? new \ReflectionClass($class))) {
139+
} elseif ($this->annotationReader && $options = $this->annotationReader->getClassAnnotations($r)) {
140140
foreach ($options as $option) {
141141
if ($option instanceof Broadcast) {
142142
$this->broadcastedClasses[$class][] = $option->options;

src/Turbo/src/Doctrine/ClassUtil.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
*/
2020
final class ClassUtil
2121
{
22+
/**
23+
* @return class-string
24+
*/
2225
public static function getEntityClass(object $entity): string
2326
{
2427
if ($entity instanceof LazyObjectInterface) {

0 commit comments

Comments
 (0)