8000 minor #13326 [EventDispatcher] fixed deprecation notices in the Event… · symfony/symfony@dcfc338 · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dcfc338

Browse files
committed
minor #13326 [EventDispatcher] fixed deprecation notices in the EventDispatcher Component (fabpot)
This PR was merged into the 2.7 branch. Discussion ---------- [EventDispatcher] fixed deprecation notices in the EventDispatcher Component | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Commits ------- 98047ae [EventDispatcher] fixed deprecation notices in the EventDispatcher Component
2 parents e52754f + 98047ae commit dcfc338

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/Symfony/Component/EventDispatcher/GenericEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function getArgument($key)
7171
return $this->arguments[$key];
7272
}
7373

74-
throw new \InvalidArgumentException(sprintf('%s not found in %s', $key, $this->getName()));
74+
throw new \InvalidArgumentException(sprintf('Argument "%s" not found.', $key));
7575
}
7676

7777
/**

src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,18 @@ public function testDispatch()
118118
$this->assertInstanceOf('Symfony\Component\EventDispatcher\Event', $this->dispatcher->dispatch(self::preFoo));
119119
$event = new Event();
120120
$return = $this->dispatcher->dispatch(self::preFoo, $event);
121-
$this->assertEquals('pre.foo', $event->getName());
122121
$this->assertSame($event, $return);
123122
}
124123

124+
public function testLegacyDispatch()
125+
{
126+
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
127+
128+
$event = new Event();
129+
$return = $this->dispatcher->dispatch(self::preFoo, $event);
130+
$this->assertEquals('pre.foo', $event->getName());
131+
}
132+
125133
public function testDispatchForClosure()
126134
{
127135
$invoked = 0;
@@ -239,8 +247,10 @@ public function testRemoveSubscriberWithMultipleListeners()
239247
$this->assertFalse($this->dispatcher->hasListeners(self::preFoo));
240248
}
241249

242-
public function testEventReceivesTheDispatcherInstance()
250+
public function testLegacyEventReceivesTheDispatcherInstance()
243251
{
252+
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
253+
244254
$dispatcher = null;
245255
$this->dispatcher->addListener('test', function ($event) use (&$dispatcher) {
246256
$dispatcher = $event->getDispatcher();

0 commit comments

Comments
 (0)
0