Skip to content

Commit

Permalink
Merge pull request BitBagCommerce#34 from Zales0123/php71
Browse files Browse the repository at this point in the history
Use PHP 7.1
  • Loading branch information
pamil authored Sep 11, 2017
2 parents 8218004 + 4c308fd commit b4bcd85
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 24 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ language: php

php:
- 7.1
- 7.0
- 5.6

cache:
directories:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Acme example plugin for Sylius.",
"license": "MIT",
"require": {
"php": "^5.6|^7.0",
"php": "^7.1",

"sylius/sylius": "^1.0.0@beta"
},
Expand Down
6 changes: 3 additions & 3 deletions src/Controller/GreetingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class GreetingController extends Controller
*
* @return Response
*/
public function staticallyGreetAction($name)
public function staticallyGreetAction(?string $name): Response
{
return new Response(sprintf('<html><body><div id="greeting">%s</div></body></html>', $this->getGreeting($name)));
}
Expand All @@ -22,7 +22,7 @@ public function staticallyGreetAction($name)
*
* @return Response
*/
public function dynamicallyGreetAction($name)
public function dynamicallyGreetAction(?string $name): Response
{
return $this->render('@AcmeExample/dynamic_greeting.html.twig', ['greeting' => $this->getGreeting($name)]);
}
Expand All @@ -32,7 +32,7 @@ public function dynamicallyGreetAction($name)
*
* @return string
*/
private function getGreeting($name)
private function getGreeting(?string $name): string
{
switch ($name) {
case null:
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/AcmeExampleExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class AcmeExampleExtension extends Extension
/**
* {@inheritdoc}
*/
public function load(array $config, ContainerBuilder $container)
public function load(array $config, ContainerBuilder $container): void
{
$config = $this->processConfiguration($this->getConfiguration([], $container), $config);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ final class Configuration implements ConfigurationInterface
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('acme_example_plugin');
Expand Down
4 changes: 2 additions & 2 deletions tests/Application/app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ final class AppKernel extends Kernel
/**
* {@inheritdoc}
*/
public function registerBundles()
public function registerBundles(): array
{
return array_merge(parent::registerBundles(), [
new \Sylius\Bundle\AdminBundle\SyliusAdminBundle(),
Expand All @@ -24,7 +24,7 @@ public function registerBundles()
/**
* {@inheritdoc}
*/
public function registerContainerConfiguration(LoaderInterface $loader)
public function registerContainerConfiguration(LoaderInterface $loader): void
{
$loader->load($this->getRootDir() . '/config/config.yml');
}
Expand Down
12 changes: 6 additions & 6 deletions tests/Behat/Context/Ui/Shop/WelcomeContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,47 +31,47 @@ public function __construct(WelcomePageInterface $staticWelcomePage, WelcomePage
/**
* @When a customer with an unknown name visits static welcome page
*/
public function customerWithUnknownNameVisitsStaticWelcomePage()
public function customerWithUnknownNameVisitsStaticWelcomePage(): void
{
$this->staticWelcomePage->open();
}

/**
* @When a customer named :name visits static welcome page
*/
public function namedCustomerVisitsStaticWelcomePage($name)
public function namedCustomerVisitsStaticWelcomePage(string $name): void
{
$this->staticWelcomePage->open(['name' => $name]);
}

/**
* @Then they should be statically greeted with :greeting
*/
public function theyShouldBeStaticallyGreetedWithGreeting($greeting)
public function theyShouldBeStaticallyGreetedWithGreeting(string $greeting): void
{
Assert::same($this->staticWelcomePage->getGreeting(), $greeting);
}

/**
* @When a customer with an unknown name visits dynamic welcome page
*/
public function customerWithUnknownNameVisitsDynamicWelcomePage()
public function customerWithUnknownNameVisitsDynamicWelcomePage(): void
{
$this->dynamicWelcomePage->open();
}

/**
* @When a customer named :name visits dynamic welcome page
*/
public function namedCustomerVisitsDynamicWelcomePage($name)
public function namedCustomerVisitsDynamicWelcomePage(string $name): void
{
$this->dynamicWelcomePage->open(['name' => $name]);
}

/**
* @Then they should be dynamically greeted with :greeting
*/
public function theyShouldBeDynamicallyGreetedWithGreeting($greeting)
public function theyShouldBeDynamicallyGreetedWithGreeting(string $greeting): void
{
Assert::same($this->dynamicWelcomePage->getGreeting(), $greeting);
}
Expand Down
8 changes: 4 additions & 4 deletions tests/Behat/Page/Shop/DynamicWelcomePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ class DynamicWelcomePage extends SymfonyPage implements WelcomePageInterface
/**
* {@inheritdoc}
*/
public function getGreeting()
public function getGreeting(): string
{
return $this->getSession()->getPage()->waitFor(3, function () {
return $this->getSession()->getPage()->waitFor(3, function (): string {
$greeting = $this->getElement('greeting')->getText();

if ('Loading...' === $greeting) {
Expand All @@ -25,15 +25,15 @@ public function getGreeting()
/**
* {@inheritdoc}
*/
public function getRouteName()
public function getRouteName(): string
{
return 'acme_example_dynamic_welcome';
}

/**
* {@inheritdoc}
*/
protected function getDefinedElements()
protected function getDefinedElements(): array
{
return array_merge(parent::getDefinedElements(), [
'greeting' => '#greeting',
Expand Down
6 changes: 3 additions & 3 deletions tests/Behat/Page/Shop/StaticWelcomePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ class StaticWelcomePage extends SymfonyPage implements WelcomePageInterface
/**
* {@inheritdoc}
*/
public function getGreeting()
public function getGreeting(): string
{
return $this->getElement('greeting')->getText();
}

/**
* {@inheritdoc}
*/
public function getRouteName()
public function getRouteName(): string
{
return 'acme_example_static_welcome';
}

/**
* {@inheritdoc}
*/
protected function getDefinedElements()
protected function getDefinedElements(): array
{
return array_merge(parent::getDefinedElements(), [
'greeting' => '#greeting',
Expand Down
2 changes: 1 addition & 1 deletion tests/Behat/Page/Shop/WelcomePageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ interface WelcomePageInterface extends PageInterface
/**
* @return string
*/
public function getGreeting();
public function getGreeting(): string;
}

0 comments on commit b4bcd85

Please sign in to comment.