Skip to content

Commit

Permalink
strict checks
Browse files Browse the repository at this point in the history
  • Loading branch information
matteosister committed Sep 18, 2015
1 parent 6a098ec commit 876b23d
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ output/
composer.phar
build/
cache/
deploy_docs.sh
deploy_docs.sh
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ tools:
php_analyzer: true
sensiolabs_security_checker: true
php_pdepend: true
php_loc: true
php_loc: true
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ script:

after_success:
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --access-token="e4c700772ac67a0210fa0054a54c34bfb5eac71883df0bd2d23ccb03e264be14" --format=php-clover coverage.clover
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
1 change: 0 additions & 1 deletion src/GitElephant/Command/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

use \GitElephant\Repository;
use \PhpCollection\Map;
use \PhpCollection\Sequence;

/**
* BaseCommand
Expand Down
2 changes: 1 addition & 1 deletion src/GitElephant/Command/Caller/Caller.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function execute($cmd, $git = true, $cwd = null, $acceptedExitCodes = arr
$cmd = $this->binary->getPath() . ' ' . $cmd;
}

$process = new Process($cmd, $cwd == null ? $this->repositoryPath : $cwd);
$process = new Process($cmd, is_null($cwd) ? $this->repositoryPath : $cwd);
$process->setTimeout(15000);
$process->run();
if (!in_array($process->getExitCode(), $acceptedExitCodes)) {
Expand Down
4 changes: 2 additions & 2 deletions src/GitElephant/Command/DiffCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ public function diff($of, $with = null, $path = null)

$subject = '';

if ($with == null) {
if (is_null($with)) {
$subject .= $of.'^..'.$of;
} else {
$subject .= $with.'..'.$of;
}

if ($path != null) {
if (! is_null($path)) {
if (!is_string($path)) {
/** @var Object $path */
$path = $path->getPath();
Expand Down
2 changes: 1 addition & 1 deletion src/GitElephant/Command/LsTreeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function tree($ref = 'HEAD', $path = null)
*/
public function listAll($ref = null)
{
if ($ref == null) {
if (is_null($ref)) {
$ref = 'HEAD';
}
$this->clearAll();
Expand Down
2 changes: 1 addition & 1 deletion src/GitElephant/Command/MainCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function unstage($what)
public function commit($message, $stageAll = false, $author = null, $allowEmpty = false)
{
$this->clearAll();
if (trim($message) == '' || $message == null) {
if (trim($message) === '' || is_null($message)) {
throw new \InvalidArgumentException(sprintf('You can\'t commit without message'));
}
$this->addCommandName(self::GIT_COMMIT);
Expand Down
1 change: 0 additions & 1 deletion src/GitElephant/Command/RevParseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
namespace GitElephant\Command;

use \GitElephant\Objects\Branch;
use \GitElephant\Objects\Remote;
use \GitElephant\Repository;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/GitElephant/Command/SubCommandCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function getCommand()
{
$command = $this->getCommandName();

if ($command == null) {
if (is_null($command)) {
throw new \RuntimeException("commandName must be specified to build a subcommand");
}

Expand Down
2 changes: 1 addition & 1 deletion src/GitElephant/Command/SubmoduleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function update($recursive = false, $init = false, $force = false, $path
if ($recursive === true) {
$this->addCommandArgument(self::SUBMODULE_OPTION_RECURSIVE);
}
if ($init == true) {
if ($init === true) {
$this->addCommandArgument(self::SUBMODULE_OPTION_INIT);
}
if ($force === true) {
Expand Down
2 changes: 1 addition & 1 deletion src/GitElephant/Command/TagCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function create($name, $startPoint = null, $message = null)
{
$this->clearAll();
$this->addCommandName(self::TAG_COMMAND);
if (null != $message) {
if (null !== $message) {
$this->addCommandArgument('-m');
$this->addCommandArgument($message);
}
Expand Down
2 changes: 1 addition & 1 deletion src/GitElephant/GitBinary.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class GitBinary
*/
public function __construct($path = null)
{
if (null == $path) {
if (is_null($path)) {
// unix only!
$path = exec('which git');
}
Expand Down
2 changes: 1 addition & 1 deletion src/GitElephant/Objects/Object.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public function getMimeType($basePath)
public function getExtension()
{
$pos = strrpos($this->name, '.');
if ($pos == false) {
if ($pos === false) {
return null;
} else {
return substr($this->name, $pos+1);
Expand Down
6 changes: 3 additions & 3 deletions src/GitElephant/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class Repository
*/
public function __construct($repositoryPath, GitBinary $binary = null, $name = null)
{
if ($binary == null) {
if (is_null($binary)) {
$binary = new GitBinary();
}

Expand Down Expand Up @@ -282,15 +282,15 @@ public function remove($path, $recursive = false, $force = false)
public function commit($message, $stageAll = false, $ref = null, $author = null, $allowEmpty = false)
{
$currentBranch = null;
if ($ref != null) {
if (! is_null($ref)) {
$currentBranch = $this->getMainBranch();
$this->checkout($ref);
}
if ($stageAll) {
$this->stage();
}
$this->caller->execute(MainCommand::getInstance($this)->commit($message, $stageAll, $author, $allowEmpty));
if ($ref != null) {
if (! is_null($ref)) {
$this->checkout($currentBranch);
}

Expand Down

0 comments on commit 876b23d

Please sign in to comment.