Skip to content

Commit ff5cf46

Browse files
tooonijean-gui
andauthored
Fixed deprecations, updated requirements (#13)
* Fixed deprecations, updated requirements * Update MockUpdate namespace Co-authored-by: Jean-Gui <jean-gui@w3.org>
1 parent 0455cd4 commit ff5cf46

16 files changed

+57
-60
lines changed

.travis.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ sudo: false
33
language: php
44

55
php:
6-
- 5.6
7-
- 7.0
8-
- 7.1
9-
- hhvm
6+
- 7.4
107

118
env:
129
global:
@@ -15,12 +12,8 @@ env:
1512
matrix:
1613
fast_finish: true
1714
include:
18-
- php: 7.0
19-
- php: 5.6
20-
- php: 7.1
15+
- php: 7.4
2116
env: DEPENDENCIES=beta
22-
allow_failures:
23-
- php: hhvm
2417

2518
before_install:
2619
- if [ "$DEPENDENCIES" = "beta" ]; then composer config minimum-stability beta; fi;

Services/LifecycleEventsDispatcher.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace W3C\LifecycleEventsBundle\Services;
44

5-
use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
6-
use Doctrine\Common\Persistence\Event\PreUpdateEventArgs;
5+
use Doctrine\Persistence\Event\LifecycleEventArgs;
6+
use Doctrine\Persistence\Event\PreUpdateEventArgs;
77
use Doctrine\Common\Util\ClassUtils;
88
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
99
use W3C\LifecycleEventsBundle\Annotation\Change;
@@ -110,7 +110,7 @@ private function dispatchCreationEvents()
110110
$eventArgs = $creation[1];
111111
$entity = $eventArgs->getObject();
112112

113-
$this->dispatcher->dispatch($annotation->event, new $annotation->class($entity));
113+
$this->dispatcher->dispatch(new $annotation->class($entity), $annotation->event);
114114
}
115115
}
116116

@@ -129,7 +129,7 @@ private function dispatchDeletionEvents()
129129
$identifier = $deletion[2];
130130
$entity = $eventArgs->getObject();
131131

132-
$this->dispatcher->dispatch($annotation->event, new $annotation->class($entity, $identifier));
132+
$this->dispatcher->dispatch(new $annotation->class($entity, $identifier), $annotation->event);
133133
}
134134
}
135135

@@ -145,8 +145,8 @@ private function dispatchUpdateEvents()
145145
list($annotation, $entity, $propertiesChanges, $collectionsChanges) = $update;
146146

147147
$this->dispatcher->dispatch(
148+
new $annotation->class($entity, $propertiesChanges, $collectionsChanges),
148149
$annotation->event,
149-
new $annotation->class($entity, $propertiesChanges, $collectionsChanges)
150150
);
151151
}
152152
}
@@ -163,8 +163,8 @@ private function dispatchPropertyChangeEvents()
163163
list($annotation, $entity, $property, $oldValue, $newValue) = $propertyChange;
164164

165165
$this->dispatcher->dispatch(
166+
new $annotation->class($entity, $property, $oldValue, $newValue),
166167
$annotation->event,
167-
new $annotation->class($entity, $property, $oldValue, $newValue)
168168
);
169169
}
170170
}
@@ -187,8 +187,8 @@ private function dispatchCollectionChangeEvents()
187187
}
188188

189189
$this->dispatcher->dispatch(
190+
new $annotation->class($entity, $property, $deleted, $added),
190191
$annotation->event,
191-
new $annotation->class($entity, $property, $deleted, $added)
192192
);
193193
}
194194
}
@@ -330,6 +330,6 @@ public function setAutoDispatch($autoDispatch)
330330
*/
331331
public function preAutoDispatch()
332332
{
333-
$this->dispatcher->dispatch('w3c.lifecycle.preAutoDispatch', new PreAutoDispatchEvent($this));
333+
$this->dispatcher->dispatch(new PreAutoDispatchEvent($this), 'w3c.lifecycle.preAutoDispatch');
334334
}
335335
}

Tests/Annotation/ChangeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ChangeTest extends TestCase
2424
*/
2525
private $reader;
2626

27-
public function setUp()
27+
public function setUp() : void
2828
{
2929
$loader = require __DIR__ . '/../../vendor/autoload.php';
3030
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));

Tests/Annotation/CreateTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class CreateTest extends TestCase
2424
*/
2525
private $reader;
2626

27-
public function setUp()
27+
public function setUp() : void
2828
{
2929
$loader = require __DIR__ . '/../../vendor/autoload.php';
3030
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));

Tests/Annotation/DeleteTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class DeleteTest extends TestCase
2424
*/
2525
private $reader;
2626

27-
public function setUp()
27+
public function setUp() : void
2828
{
2929
$loader = require __DIR__ . '/../../vendor/autoload.php';
3030
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));

Tests/Annotation/IgnoreTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class IgnoreTest extends TestCase
2222
*/
2323
private $reader;
2424

25-
public function setUp()
25+
public function setUp() : void
2626
{
2727
$loader = require __DIR__ . '/../../vendor/autoload.php';
2828
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));

Tests/Annotation/UpdateTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class UpdateTest extends TestCase
2424
*/
2525
private $reader;
2626

27-
public function setUp()
27+
public function setUp() : void
2828
{
2929
$loader = require __DIR__ . '/../../vendor/autoload.php';
3030
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));

Tests/Event/LifecycleUpdateEventTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class LifecycleUpdateEventTest extends TestCase
2020
*/
2121
private $event;
2222

23-
public function setUp()
23+
public function setUp() : void
2424
{
2525
$entity = new User();
2626
$this->propertyChanges = ['name' => ['old' => 'foo', 'new' => 'bar']];

Tests/EventListener/LifecycleEventsListenerInverseNoMonitorTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
use Doctrine\ORM\Event\PreUpdateEventArgs;
1212
use Doctrine\ORM\Mapping\ClassMetadata;
1313
use Doctrine\ORM\UnitOfWork;
14-
use PHPUnit_Framework_MockObject_MockObject as MockObject;
14+
use PHPUnit\Framework\TestCase;
15+
use PHPUnit\Framework\MockObject\MockObject;
1516
use W3C\LifecycleEventsBundle\Annotation\Update;
1617
use W3C\LifecycleEventsBundle\EventListener\LifecycleEventsListener;
1718
use W3C\LifecycleEventsBundle\Services\AnnotationGetter;
@@ -21,7 +22,7 @@
2122
/**
2223
* @author Jean-Guilhem Rouel <jean-gui@w3.org>
2324
*/
24-
class LifecycleEventsListenerInverseNoMonitorTest extends \PHPUnit_Framework_TestCase
25+
class LifecycleEventsListenerInverseNoMonitorTest extends TestCase
2526
{
2627
/**
2728
* @var LifecycleEventsListener
@@ -54,7 +55,7 @@ class LifecycleEventsListenerInverseNoMonitorTest extends \PHPUnit_Framework_Tes
5455
private $friend1;
5556
private $friend2;
5657

57-
public function setUp()
58+
public function setUp() : void
5859
{
5960
parent::setUp();
6061

Tests/EventListener/LifecycleEventsListenerInverseTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
use Doctrine\ORM\Event\PreUpdateEventArgs;
1212
use Doctrine\ORM\Mapping\ClassMetadata;
1313
use Doctrine\ORM\UnitOfWork;
14-
use PHPUnit_Framework_MockObject_MockObject as MockObject;
14+
use PHPUnit\Framework\TestCase;
15+
use PHPUnit\Framework\MockObject\MockObject;
1516
use W3C\LifecycleEventsBundle\Annotation\Change;
1617
use W3C\LifecycleEventsBundle\Annotation\Update;
1718
use W3C\LifecycleEventsBundle\EventListener\LifecycleEventsListener;
@@ -22,7 +23,7 @@
2223
/**
2324
* @author Jean-Guilhem Rouel <jean-gui@w3.org>
2425
*/
25-
class LifecycleEventsListenerInverseTest extends \PHPUnit_Framework_TestCase
26+
class LifecycleEventsListenerInverseTest extends TestCase
2627
{
2728
/**
2829
* @var LifecycleEventsListener
@@ -55,7 +56,7 @@ class LifecycleEventsListenerInverseTest extends \PHPUnit_Framework_TestCase
5556
private $friend1;
5657
private $friend2;
5758

58-
public function setUp()
59+
public function setUp() : void
5960
{
6061
parent::setUp();
6162

0 commit comments

Comments
 (0)