Skip to content

Commit 81bad90

Browse files
committed
Merge pull request #90 from JanTvrdik/php56
5.6 with ::class
2 parents ffd6566 + 926e567 commit 81bad90

27 files changed

+90
-94
lines changed

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
language: php
22
php:
3-
- 5.4
4-
- 5.5
53
- 5.6
64
- 7.0
75
- hhvm
@@ -20,7 +18,7 @@ matrix:
2018
env: PHP_BIN=php-cgi
2119

2220
include:
23-
- php: 5.5
21+
- php: 5.6
2422
env: dependencies="--prefer-lowest --prefer-stable" PHP_BIN=php
2523

2624
script:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
}
1515
],
1616
"require": {
17-
"php": ">=5.4.4",
17+
"php": ">=5.6.0",
1818
"nette/component-model": "~2.2",
1919
"nette/http": "~2.2",
2020
"nette/reflection": "~2.2",

src/Application/LinkGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct(IRouter $router, Nette\Http\Url $refUrl, IPresenterF
3737
* Generates URL to presenter.
3838
* @param string destination in format "[[[module:]presenter:]action] [#fragment]"
3939
* @return string
40-
* @throws InvalidLinkException
40+
* @throws UI\InvalidLinkException
4141
*/
4242
public function link($dest, array $params = [])
4343
{
@@ -52,7 +52,7 @@ public function link($dest, array $params = [])
5252
throw new UI\InvalidLinkException($e->getMessage(), NULL, $e);
5353
}
5454

55-
if (is_subclass_of($class, 'Nette\Application\UI\Presenter')) {
55+
if (is_subclass_of($class, UI\Presenter::class)) {
5656
if ($action === '') {
5757
$action = UI\Presenter::DEFAULT_ACTION;
5858
}

src/Application/MicroPresenter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/**
1818
* Micro presenter.
1919
*
20-
* @property-read Nette\Application\IRequest $request
20+
* @property-read Nette\Application\Request $request
2121
*/
2222
class MicroPresenter extends Nette\Object implements Application\IPresenter
2323
{
@@ -115,7 +115,7 @@ public function run(Application\Request $request)
115115
*/
116116
public function createTemplate($class = NULL, callable $latteFactory = NULL)
117117
{
118-
$latte = $latteFactory ? $latteFactory() : $this->getContext()->getByType('Nette\Bridges\ApplicationLatte\ILatteFactory')->create();
118+
$latte = $latteFactory ? $latteFactory() : $this->getContext()->getByType(Nette\Bridges\ApplicationLatte\ILatteFactory::class)->create();
119119
$template = $class ? new $class : new Nette\Bridges\ApplicationLatte\Template($latte);
120120

121121
$template->setParameters($this->request->getParameters());
@@ -156,7 +156,7 @@ public function error($message = NULL, $code = Http\IResponse::S404_NOT_FOUND)
156156

157157

158158
/**
159-
* @return Nette\Application\IRequest
159+
* @return Nette\Application\Request
160160
*/
161161
public function getRequest()
162162
{

src/Application/PresenterFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function getPresenterClass(& $name)
7272
$reflection = new \ReflectionClass($class);
7373
$class = $reflection->getName();
7474

75-
if (!$reflection->implementsInterface('Nette\Application\IPresenter')) {
75+
if (!$reflection->implementsInterface(IPresenter::class)) {
7676
throw new InvalidPresenterException("Cannot load presenter '$name', class '$class' is not Nette\\Application\\IPresenter implementor.");
7777
} elseif ($reflection->isAbstract()) {
7878
throw new InvalidPresenterException("Cannot load presenter '$name', class '$class' is abstract.");

src/Application/Routers/Route.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,7 @@ private function setMask($mask, array $metadata)
477477
// name=<parameter-name [pattern]>
478478
$matches = Strings::matchAll($parts[$i - 1], '/(?:([a-zA-Z0-9_.-]+)=)?<([^> ]+) *([^>]*)>/');
479479

480-
foreach ($matches as $match) {
481-
list(, $param, $name, $pattern) = $match; // $pattern is not used
482-
480+
foreach ($matches as list(, $param, $name, $pattern)) { // $pattern is not used
483481
if (isset(static::$styles['?' . $name])) {
484482
$meta = static::$styles['?' . $name];
485483
} else {

src/Application/UI/Form.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(Nette\ComponentModel\IContainer $parent = NULL, $nam
3636
protected function validateParent(Nette\ComponentModel\IContainer $parent)
3737
{
3838
parent::validateParent($parent);
39-
$this->monitor('Nette\Application\UI\Presenter');
39+
$this->monitor(Presenter::class);
4040
}
4141

4242

@@ -47,7 +47,7 @@ protected function validateParent(Nette\ComponentModel\IContainer $parent)
4747
*/
4848
public function getPresenter($need = TRUE)
4949
{
50-
return $this->lookup('Nette\Application\UI\Presenter', $need);
50+
return $this->lookup(Presenter::class, $need);
5151
}
5252

5353

@@ -60,7 +60,7 @@ public function getPresenter($need = TRUE)
6060
protected function attached($presenter)
6161
{
6262
if ($presenter instanceof Presenter) {
63-
$name = $this->lookupPath('Nette\Application\UI\Presenter');
63+
$name = $this->lookupPath(Presenter::class);
6464

6565
if (!isset($this->getElementPrototype()->id)) {
6666
$this->getElementPrototype()->id = 'frm-' . $name;

src/Application/UI/Presenter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ public function canonicalize()
748748

749749
/**
750750
* Attempts to cache the sent entity by its last modification date.
751-
* @param string|int|DateTime last modified time
751+
* @param string|int|\DateTimeInterface last modified time
752752
* @param string strong entity tag validator
753753
* @param mixed optional expiration time
754754
* @return void
@@ -1156,7 +1156,7 @@ protected function getGlobalState($forClass = NULL)
11561156
}
11571157

11581158
$components = $this->getReflection()->getPersistentComponents();
1159-
$iterator = $this->getComponents(TRUE, 'Nette\Application\UI\IStatePersistent');
1159+
$iterator = $this->getComponents(TRUE, IStatePersistent::class);
11601160

11611161
foreach ($iterator as $name => $component) {
11621162
if ($iterator->getDepth() === 0) {

src/Application/UI/PresenterComponent.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ abstract class PresenterComponent extends Nette\ComponentModel\Container impleme
3333
*/
3434
public function getPresenter($need = TRUE)
3535
{
36-
return $this->lookup('Nette\Application\UI\Presenter', $need);
36+
return $this->lookup(Presenter::class, $need);
3737
}
3838

3939

@@ -44,7 +44,7 @@ public function getPresenter($need = TRUE)
4444
*/
4545
public function getUniqueId()
4646
{
47-
return $this->lookupPath('Nette\Application\UI\Presenter', TRUE);
47+
return $this->lookupPath(Presenter::class, TRUE);
4848
}
4949

5050

@@ -68,7 +68,7 @@ protected function attached($presenter)
6868
protected function validateParent(Nette\ComponentModel\IContainer $parent)
6969
{
7070
parent::validateParent($parent);
71-
$this->monitor('Nette\Application\UI\Presenter');
71+
$this->monitor(Presenter::class);
7272
}
7373

7474

src/Application/UI/PresenterComponentReflection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function getPersistentParams($class = NULL)
3939
return $params;
4040
}
4141
$params = [];
42-
if (is_subclass_of($class, 'Nette\Application\UI\PresenterComponent')) {
42+
if (is_subclass_of($class, PresenterComponent::class)) {
4343
$defaults = get_class_vars($class);
4444
foreach ($class::getPersistentParams() as $name => $default) {
4545
if (is_int($name)) {
@@ -76,7 +76,7 @@ public function getPersistentComponents($class = NULL)
7676
return $components;
7777
}
7878
$components = [];
79-
if (is_subclass_of($class, 'Nette\Application\UI\Presenter')) {
79+
if (is_subclass_of($class, Presenter::class)) {
8080
foreach ($class::getPersistentComponents() as $name => $meta) {
8181
if (is_string($meta)) {
8282
$name = $meta;

0 commit comments

Comments
 (0)