Skip to content
This repository has been archived by the owner on Feb 17, 2020. It is now read-only.

Commit

Permalink
- Refactoring to latest PHP & Nette version
Browse files Browse the repository at this point in the history
  • Loading branch information
akadlec committed Mar 17, 2018
1 parent 2f42e15 commit 8f09450
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ checks:
build:
environment:
php:
version: 7.0.7
version: 7.1
variables:
NETTE: default

Expand Down
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ language: php

env:
- NETTE=default
- NETTE=~2.3.0
- NETTE=~2.4.0

php:
- 7.0
- 7.1
- 7.2

before_install:
- composer self-update
Expand Down
21 changes: 10 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"name" : "iPublikuj:cms",
"email" : "info@ipublikuj.eu",
"homepage" : "http://www.ipublikuj.eu/"
"homepage" : "https://www.ipublikuj.eu/"
}
],

Expand All @@ -20,22 +20,21 @@
},

"require": {
"php" : ">=7.0.0",
"php" : ">=7.1.0",

"nette/application" : "~2.3",

"pds/skeleton" : "@dev"
"nette/application" : "~2.4"
},

"require-dev": {
"nette/bootstrap" : "~2.3",
"nette/di" : "~2.3",
"nette/mail" : "~2.3",
"nette/bootstrap" : "~2.4",
"nette/mail" : "~2.4",
"nette/robot-loader" : "~2.4",
"nette/safe-stream" : "~2.3",
"nette/robot-loader" : "~2.3",
"nette/tester" : "@dev",
"nette/tester" : "~2.0",

"tracy/tracy" : "~2.4",

"tracy/tracy" : "@dev"
"pds/skeleton" : "~1.0"
},

"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ $ composer require ipub/application
Learn how to use this traits in [documentation](https://github.com/iPublikuj/application/blob/master/docs/en/index.md).

***
Homepage [http://www.ipublikuj.eu](http://www.ipublikuj.eu) and repository [http://github.com/iPublikuj/application](http://github.com/iPublikuj/application).
Homepage [https://www.ipublikuj.eu](https://www.ipublikuj.eu) and repository [http://github.com/iPublikuj/application](http://github.com/iPublikuj/application).

9 changes: 4 additions & 5 deletions src/IPub/Application/UI/TRedirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* TRedirect.php
*
* @copyright More in license.md
* @license http://www.ipublikuj.eu
* @author Adam Kadlec http://www.ipublikuj.eu
* @license https://www.ipublikuj.eu
* @author Adam Kadlec https://www.ipublikuj.eu
* @package iPublikuj:Application!
* @subpackage UI
* @since 1.0.0
Expand All @@ -16,7 +16,6 @@

namespace IPub\Application\UI;

use Nette;
use Nette\Application;
use Nette\Application\Responses;

Expand Down Expand Up @@ -46,7 +45,7 @@ trait TRedirect
*
* @throws Application\AbortException
*/
final public function go($destination, $args = [], $snippets = [])
final public function go($destination, $args = [], $snippets = []) : void
{
// Get presenter object
$presenter = ($this instanceof Application\UI\Presenter) ? $this : $this->getPresenter();
Expand Down Expand Up @@ -75,7 +74,7 @@ final public function go($destination, $args = [], $snippets = [])
*
* @throws Application\AbortException
*/
public function forward($destination, $args = [])
public function forward($destination, $args = []) : void
{
if (!$this->isPresenter()) {
$name = $this->getUniqueId();
Expand Down
13 changes: 5 additions & 8 deletions src/IPub/Application/UI/TTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* TTranslator.php
*
* @copyright More in license.md
* @license http://www.ipublikuj.eu
* @author Adam Kadlec http://www.ipublikuj.eu
* @license https://www.ipublikuj.eu
* @author Adam Kadlec https://www.ipublikuj.eu
* @package iPublikuj:Application!
* @subpackage UI
* @since 1.0.0
Expand All @@ -16,7 +16,6 @@

namespace IPub\Application\UI;

use Nette;
use Nette\Localization;

/**
Expand All @@ -39,7 +38,7 @@ trait TTranslator
*
* @return void
*/
public function injectTranslator(Localization\ITranslator $translator)
public function injectTranslator(Localization\ITranslator $translator) : void
{
$this->translator = $translator;
}
Expand All @@ -51,7 +50,7 @@ public function injectTranslator(Localization\ITranslator $translator)
*
* @return void
*/
public function setTranslator(Localization\ITranslator $translator)
public function setTranslator(Localization\ITranslator $translator) : void
{
$this->translator = $translator;
}
Expand All @@ -60,10 +59,8 @@ public function setTranslator(Localization\ITranslator $translator)
* Get app translator service
*
* @return Localization\ITranslator|NULL
*
* @return void
*/
public function getTranslator()
public function getTranslator() : ?Localization\ITranslator
{
if ($this->translator instanceof Localization\ITranslator) {
return $this->translator;
Expand Down
19 changes: 7 additions & 12 deletions tests/IPubTests/Application/RedirectTest.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* @testCase
*
* @copyright More in license.md
* @license http://www.ipublikuj.eu
* @author Adam Kadlec http://www.ipublikuj.eu
* @license https://www.ipublikuj.eu
* @author Adam Kadlec https://www.ipublikuj.eu
* @package iPublikuj:Application!
* @subpackage Tests
* @since 1.1.0
Expand Down Expand Up @@ -66,7 +66,7 @@ class RedirectTest extends Tester\TestCase
/**
* {@inheritdoc}
*/
public function setUp()
public function setUp() : void
{
parent::setUp();

Expand All @@ -76,7 +76,7 @@ class RedirectTest extends Tester\TestCase
$this->presenterFactory = $this->container->getByType(Nette\Application\IPresenterFactory::class);
}

public function testPresenterRedirect()
public function testPresenterRedirect() : void
{
// Create test presenter
$presenter = $this->createPresenter();
Expand All @@ -90,7 +90,7 @@ class RedirectTest extends Tester\TestCase
Assert::equal('http:///end/show', $response->getUrl());
}

public function testPresenterForward()
public function testPresenterForward() : void
{
// Create test presenter
$presenter = $this->createPresenter();
Expand All @@ -106,7 +106,7 @@ class RedirectTest extends Tester\TestCase
Assert::equal(['action' => 'show'], $response->getRequest()->getParameters());
}

public function testPresenterAjaxRedirect()
public function testPresenterAjaxRedirect() : void
{
// Create test presenter
$presenter = $this->createPresenter();
Expand Down Expand Up @@ -145,12 +145,7 @@ class RedirectTest extends Tester\TestCase

$version = getenv('NETTE');

if (!$version || $version == 'default') {
$config->addConfig(__DIR__ . DS . 'files' . DS . 'presenters.neon');

} else {
$config->addConfig(__DIR__ . DS . 'files' . DS . 'presenters_2.3.neon');
}
$config->addConfig(__DIR__ . DS . 'files' . DS . 'presenters.neon');

return $config->createContainer();
}
Expand Down
10 changes: 5 additions & 5 deletions tests/IPubTests/Application/TranslatorTest.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* @testCase
*
* @copyright More in license.md
* @license http://www.ipublikuj.eu
* @author Adam Kadlec http://www.ipublikuj.eu
* @license https://www.ipublikuj.eu
* @author Adam Kadlec https://www.ipublikuj.eu
* @package iPublikuj:Application!
* @subpackage Tests
* @since 1.1.0
Expand Down Expand Up @@ -67,7 +67,7 @@ class TranslatorTest extends Tester\TestCase
/**
* {@inheritdoc}
*/
public function setUp()
public function setUp() : void
{
parent::setUp();

Expand All @@ -83,7 +83,7 @@ class TranslatorTest extends Tester\TestCase
* @param string $toTranslate
* @param string $expected
*/
public function testPresenterUseTranslator(string $toTranslate, string $expected)
public function testPresenterUseTranslator(string $toTranslate, string $expected) : void
{
// Create test presenter
$presenter = $this->createPresenter();
Expand All @@ -97,7 +97,7 @@ class TranslatorTest extends Tester\TestCase
Assert::equal($expected, $response->getSource());
}

public function testPresenterChangeTranslator()
public function testPresenterChangeTranslator() : void
{
// Create test presenter
$presenter = $this->createPresenter();
Expand Down
11 changes: 0 additions & 11 deletions tests/IPubTests/Application/files/presenters_2.3.neon

This file was deleted.

7 changes: 3 additions & 4 deletions tests/IPubTests/Application/libs/RouterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* @testCase
*
* @copyright More in license.md
* @license http://www.ipublikuj.eu
* @author Adam Kadlec http://www.ipublikuj.eu
* @license https://www.ipublikuj.eu
* @author Adam Kadlec https://www.ipublikuj.eu
* @package iPublikuj:Application!
* @subpackage Tests
* @since 1.1.0
Expand All @@ -17,7 +17,6 @@

namespace IPubTests\Application\Libs;

use Nette;
use Nette\Application;
use Nette\Application\Routers;

Expand All @@ -34,7 +33,7 @@ class RouterFactory
/**
* @return Application\IRouter
*/
public static function createRouter()
public static function createRouter() : ?Application\IRouter
{
$router = new Routers\RouteList();
$router[] = new Routers\Route('<presenter>/<action>[/<id>]', 'Test:default');
Expand Down
11 changes: 8 additions & 3 deletions tests/IPubTests/Application/libs/SecondTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* @testCase
*
* @copyright More in license.md
* @license http://www.ipublikuj.eu
* @author Adam Kadlec http://www.ipublikuj.eu
* @license https://www.ipublikuj.eu
* @author Adam Kadlec https://www.ipublikuj.eu
* @package iPublikuj:Application!
* @subpackage Tests
* @since 1.1.0
Expand All @@ -28,8 +28,13 @@
*
* @author Adam Kadlec <adam.kadlec@ipublikuj.eu>
*/
class SecondTranslator extends Nette\Object implements Localization\ITranslator
class SecondTranslator implements Localization\ITranslator
{
/**
* Implement nette smart magic
*/
use Nette\SmartObject;

/**
* {@inheritdoc}
*/
Expand Down
11 changes: 8 additions & 3 deletions tests/IPubTests/Application/libs/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* @testCase
*
* @copyright More in license.md
* @license http://www.ipublikuj.eu
* @author Adam Kadlec http://www.ipublikuj.eu
* @license https://www.ipublikuj.eu
* @author Adam Kadlec https://www.ipublikuj.eu
* @package iPublikuj:Application!
* @subpackage Tests
* @since 1.1.0
Expand All @@ -28,8 +28,13 @@
*
* @author Adam Kadlec <adam.kadlec@ipublikuj.eu>
*/
class Translator extends Nette\Object implements Localization\ITranslator
class Translator implements Localization\ITranslator
{
/**
* Implement nette smart magic
*/
use Nette\SmartObject;

/**
* {@inheritdoc}
*/
Expand Down
7 changes: 4 additions & 3 deletions tests/IPubTests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
Tester\Helpers::purge(TEMP_DIR);
\Tracy\Debugger::$logDirectory = TEMP_DIR;

$_SERVER = array_intersect_key($_SERVER, array_flip(array(
'PHP_SELF', 'SCRIPT_NAME', 'SERVER_ADDR', 'SERVER_SOFTWARE', 'HTTP_HOST', 'DOCUMENT_ROOT', 'OS', 'argc', 'argv')));
$_SERVER = array_intersect_key($_SERVER, array_flip([
'PHP_SELF', 'SCRIPT_NAME', 'SERVER_ADDR', 'SERVER_SOFTWARE', 'HTTP_HOST', 'DOCUMENT_ROOT', 'OS', 'argc', 'argv'
]));
$_SERVER['REQUEST_TIME'] = 1234567890;
$_ENV = $_GET = $_POST = array();
$_ENV = $_GET = $_POST = [];

function id($val)
{
Expand Down

0 comments on commit 8f09450

Please sign in to comment.