Skip to content

Commit

Permalink
Merge pull request #255 from andypost/php8
Browse files Browse the repository at this point in the history
Allow installing on PHP 8
  • Loading branch information
dbu authored Oct 6, 2020
2 parents 81fcbf7 + c03e46e commit 97c7633
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ matrix:
env: SYMFONY_REQUIRE=4.4.*
- php: 7.4
env: SYMFONY_REQUIRE=5.0.*
- php: nightly
env: COMPOSER_FLAGS="--no-interaction --ignore-platform-reqs" SYMFONY_PHPUNIT_VERSION=9 SYMFONY_REQUIRE=5.0.*
fast_finish: true
allow_failures:

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
],
"require": {
"php": "^7.2",
"php": "^7.2 || ^8.0",
"symfony/routing": "^4.4 || ^5.0",
"symfony/http-kernel": "^4.4 || ^5.0",
"psr/log": "^1.0"
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Enhancer/ContentRepositoryEnhancerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ContentRepositoryEnhancerTest extends TestCase
/**
* {@inheritdoc}
*/
public function setUp()
public function setUp(): void
{
$cRepository = $this->createMock(ContentRepositoryInterface::class);
$cRepository
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Enhancer/FieldByClassEnhancerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class FieldByClassEnhancerTest extends TestCase

private $document;

public function setUp()
public function setUp(): void
{
$this->document = $this->createMock(RouteObject::class);

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Enhancer/FieldMapEnhancerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class FieldMapEnhancerTest extends TestCase
*/
private $enhancer;

public function setUp()
public function setUp(): void
{
$this->request = Request::create('/test');
$mapping = ['static_pages' => 'cmf_content.controller:indexAction'];
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Enhancer/FieldPresenceEnhancerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class FieldPresenceEnhancerTest extends TestCase

private $request;

public function setUp()
public function setUp(): void
{
$this->mapper = new FieldPresenceEnhancer('_template', '_controller', 'cmf_content.controller:indexAction');

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Enhancer/RouteContentEnhancerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class RouteContentEnhancerTest extends TestCase

private $request;

public function setUp()
public function setUp(): void
{
$this->document = $this->createMock(RouteObject::class);

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/NestedMatcher/NestedMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class NestedMatcherTest extends TestCase

private $finalMatcher;

public function setUp()
public function setUp(): void
{
$this->provider = $this->createMock(RouteProviderInterface::class);
$this->routeFilter1 = $this->createMock(RouteFilterInterface::class);
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/NestedMatcher/UrlMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class UrlMatcherTest extends TestCase
*/
private $url = '/foo/bar';

public function setUp()
public function setUp(): void
{
$this->routeDocument = $this->createMock(RouteMock::class);
$this->routeCompiled = $this->createMock(CompiledRoute::class);
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Routing/ChainRouterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ChainRouterTest extends TestCase
*/
private $context;

public function setUp()
public function setUp(): void
{
$this->router = new ChainRouter($this->createMock(LoggerInterface::class));
$this->context = $this->createMock(RequestContext::class);
Expand Down
12 changes: 6 additions & 6 deletions tests/Unit/Routing/ContentAwareGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -538,19 +538,19 @@ public function testSupports(): void

public function testGetRouteDebugMessage(): void
{
$this->assertContains('/some/content', $this->generator->getRouteDebugMessage(RouteObjectInterface::OBJECT_BASED_ROUTE_NAME, ['content_id' => '/some/content']));
$this->assertContains('Route aware content Symfony\Cmf\Component\Routing\Tests\Routing\RouteAware', $this->generator->getRouteDebugMessage(RouteObjectInterface::OBJECT_BASED_ROUTE_NAME, [RouteObjectInterface::ROUTE_OBJECT => new RouteAware()]));
$this->assertContains('/some/content', $this->generator->getRouteDebugMessage('/some/content'));
$this->assertStringContainsString('/some/content', $this->generator->getRouteDebugMessage(RouteObjectInterface::OBJECT_BASED_ROUTE_NAME, ['content_id' => '/some/content']));
$this->assertStringContainsString('Route aware content Symfony\Cmf\Component\Routing\Tests\Routing\RouteAware', $this->generator->getRouteDebugMessage(RouteObjectInterface::OBJECT_BASED_ROUTE_NAME, [RouteObjectInterface::ROUTE_OBJECT => new RouteAware()]));
$this->assertStringContainsString('/some/content', $this->generator->getRouteDebugMessage('/some/content'));
}

/**
* @legacy
*/
public function testGetRouteDebugMessageLegacy(): void
{
$this->assertContains('/some/content', $this->generator->getRouteDebugMessage(null, ['content_id' => '/some/content']));
$this->assertContains('Route aware content Symfony\Cmf\Component\Routing\Tests\Routing\RouteAware', $this->generator->getRouteDebugMessage(new RouteAware()));
$this->assertContains('/some/content', $this->generator->getRouteDebugMessage('/some/content'));
$this->assertStringContainsString('/some/content', $this->generator->getRouteDebugMessage(null, ['content_id' => '/some/content']));
$this->assertStringContainsString('Route aware content Symfony\Cmf\Component\Routing\Tests\Routing\RouteAware', $this->generator->getRouteDebugMessage(new RouteAware()));
$this->assertStringContainsString('/some/content', $this->generator->getRouteDebugMessage('/some/content'));
}
}

Expand Down
6 changes: 3 additions & 3 deletions tests/Unit/Routing/DynamicRouterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class DynamicRouterTest extends TestCase

const URL = '/foo/bar';

public function setUp()
public function setUp(): void
{
$this->routeDocument = $this->createMock(RouteMock::class);

Expand Down Expand Up @@ -157,7 +157,7 @@ public function testSupportsNonversatile()
{
$generator = $this->createMock(UrlGeneratorInterface::class);
$router = new DynamicRouter($this->context, $this->matcher, $generator);
$this->assertInternalType('string', $router->getRouteDebugMessage('test'));
$this->assertIsString($router->getRouteDebugMessage('test'));

$this->assertTrue($router->supports('some string'));
$this->assertFalse($router->supports($this));
Expand Down Expand Up @@ -328,7 +328,7 @@ public function testRouteDebugMessageNonversatile()
{
$generator = $this->createMock(UrlGeneratorInterface::class);
$router = new DynamicRouter($this->context, $this->matcher, $generator);
$this->assertInternalType('string', $router->getRouteDebugMessage('test'));
$this->assertIsString($router->getRouteDebugMessage('test'));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Routing/PagedRouteCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class PagedRouteCollectionTest extends TestCase
*/
private $routeProvider;

protected function setUp()
protected function setUp(): void
{
$this->routeProvider = $this->createMock(PagedRouteProviderInterface::class);
}
Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/Routing/ProviderBasedGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ public function testSupports(): void

public function testGetRouteDebugMessage(): void
{
$this->assertContains('/some/key', $this->generator->getRouteDebugMessage(new RouteObject()));
$this->assertContains('/de/test', $this->generator->getRouteDebugMessage(new Route('/de/test')));
$this->assertContains('/some/route', $this->generator->getRouteDebugMessage('/some/route'));
$this->assertContains('a:1:{s:10:"route_name";s:7:"example";}', $this->generator->getRouteDebugMessage(['route_name' => 'example']));
$this->assertStringContainsString('/some/key', $this->generator->getRouteDebugMessage(new RouteObject()));
$this->assertStringContainsString('/de/test', $this->generator->getRouteDebugMessage(new Route('/de/test')));
$this->assertStringContainsString('/some/route', $this->generator->getRouteDebugMessage('/some/route'));
$this->assertStringContainsString('a:1:{s:10:"route_name";s:7:"example";}', $this->generator->getRouteDebugMessage(['route_name' => 'example']));
}

/**
Expand Down

0 comments on commit 97c7633

Please sign in to comment.