Skip to content

Commit

Permalink
- Fixing coding standards
Browse files Browse the repository at this point in the history
- PHP71 types
  • Loading branch information
akadlec committed Jan 14, 2018
1 parent e10429a commit d5cb5b0
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 42 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
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ env:
- NETTE=default

php:
- 7.0
- 7.1
- 7.2

Expand Down
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@
"nette/http" : "~2.4",
"nette/utils" : "~2.4",

"latte/latte" : "~2.4",

"pds/skeleton" : "@dev"
"latte/latte" : "~2.4"
},

"require-dev": {
"nette/bootstrap" : "~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
5 changes: 4 additions & 1 deletion src/IPub/Gravatar/Application/GravatarResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
*/
final class GravatarResponse implements Nette\Application\IResponse
{
/**
* Implement nette smart magic
*/
use Nette\SmartObject;

/**
Expand Down Expand Up @@ -117,7 +120,7 @@ public function getType() : string
*
* @return void
*/
public function send(Http\IRequest $httpRequest, Http\IResponse $httpResponse)
public function send(Http\IRequest $httpRequest, Http\IResponse $httpResponse) : void
{
echo $this->image->send($this->type, 85);
}
Expand Down
2 changes: 1 addition & 1 deletion src/IPub/Gravatar/Caching/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final class Cache extends Caching\Cache
*
* @return void
*/
public function clean(array $conditions = NULL)
public function clean(array $conditions = NULL) : void
{
parent::clean([self::TAGS => ['ipub.gravatar']]);
}
Expand Down
6 changes: 3 additions & 3 deletions src/IPub/Gravatar/DI/GravatarExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ final class GravatarExtension extends DI\CompilerExtension
/**
* @return void
*/
public function loadConfiguration()
public function loadConfiguration() : void
{
// Get container builder
$builder = $this->getContainerBuilder();
Expand Down Expand Up @@ -77,7 +77,7 @@ public function loadConfiguration()
/**
* {@inheritdoc}
*/
public function beforeCompile()
public function beforeCompile() : void
{
parent::beforeCompile();

Expand All @@ -101,7 +101,7 @@ public function beforeCompile()
*/
public static function register(Nette\Configurator $config, string $extensionName = 'gravatar')
{
$config->onCompile[] = function (Nette\Configurator $config, Nette\DI\Compiler $compiler) use ($extensionName) {
$config->onCompile[] = function (Nette\Configurator $config, Nette\DI\Compiler $compiler) use ($extensionName) : void {
$compiler->addExtension($extensionName, new GravatarExtension());
};
}
Expand Down
21 changes: 12 additions & 9 deletions src/IPub/Gravatar/Gravatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@
*/
final class Gravatar
{
/**
* Implement nette smart magic
*/
use Nette\SmartObject;

/**
* @var string - URL constants for the avatar images
*/
Expand Down Expand Up @@ -140,7 +143,7 @@ public function getEmailHash(string $email = NULL) : string
*
* @return void
*/
public function setSize(int $size)
public function setSize(int $size) : void
{
if ($this->isSizeValid($size)) {
$this->size = $size;
Expand Down Expand Up @@ -180,7 +183,7 @@ public function isSizeValid(int $size) : bool
*
* @return void
*/
public function setExpiration(int $expiration)
public function setExpiration(int $expiration) : void
{
$this->expiration = $expiration;
}
Expand All @@ -194,7 +197,7 @@ public function setExpiration(int $expiration)
*
* @throws Exceptions\InvalidArgumentException
*/
public function setDefaultImage($image)
public function setDefaultImage($image) : void
{
// Quick check against boolean FALSE.
if ($image === FALSE) {
Expand Down Expand Up @@ -226,7 +229,7 @@ public function setDefaultImage($image)
*
* @return mixed - False if no default image set, string if one is set
*/
public function getDefaultImage(string $defaultImage = NULL)
public function getDefaultImage(string $defaultImage = NULL) : void
{
if ($defaultImage !== NULL && in_array($defaultImage, ['404', 'mm', 'identicon', 'monsterid', 'wavatar', 'retro'])) {
return $defaultImage;
Expand All @@ -248,7 +251,7 @@ public function getDefaultImage(string $defaultImage = NULL)
*
* @throws Exceptions\InvalidArgumentException
*/
public function setMaxRating(string $rating)
public function setMaxRating(string $rating) : void
{
$rating = strtolower($rating);

Expand Down Expand Up @@ -310,7 +313,7 @@ public function usingSecureImages() : bool
*
* @return void
*/
public function enableSecureImages()
public function enableSecureImages() : void
{
$this->useSecureUrl = TRUE;
}
Expand All @@ -320,7 +323,7 @@ public function enableSecureImages()
*
* @return void
*/
public function disableSecureImages()
public function disableSecureImages() : void
{
$this->useSecureUrl = FALSE;
}
Expand Down Expand Up @@ -397,7 +400,7 @@ public function buildUrl(string $email = NULL, int $size = NULL, string $maxRati
*
* @return bool|NULL Boolean if we could connect, null if no connection to gravatar.com
*/
public function exists(string $email)
public function exists(string $email) : ?bool
{
$path = $this->buildUrl($email, NULL, NULL, '404');

Expand Down
2 changes: 1 addition & 1 deletion src/IPub/Gravatar/TGravatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ trait TGravatar
*
* @return void
*/
public function injectGravatar(Gravatar $gravatar)
public function injectGravatar(Gravatar $gravatar) : void
{
$this->gravatar = $gravatar;
}
Expand Down
3 changes: 3 additions & 0 deletions src/IPub/Gravatar/Templating/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
*/
final class Helpers
{
/**
* Implement nette smart magic
*/
use Nette\SmartObject;

/**
Expand Down
7 changes: 1 addition & 6 deletions tests/IPubTests/Gravatar/TemplateTest.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,7 @@ class TemplateTest 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
11 changes: 0 additions & 11 deletions tests/IPubTests/Gravatar/files/presenters_2.3.neon

This file was deleted.

0 comments on commit d5cb5b0

Please sign in to comment.