Skip to content

Commit

Permalink
phpcs issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesread committed Aug 28, 2023
1 parent 3b911bc commit 034222d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ test: tests
tests:
composer run-script test

lint:
lint: phpcs

phpcs:
./vendor/bin/phpcs

phpstan:
./vendor/bin/phpstan analyse src/main/php/libAllure/
./vendor/bin/phpstan analyse --level 1 src/main/php/libAllure/


.PHONY: test tests default lint
6 changes: 3 additions & 3 deletions src/main/php/libAllure/ConfigFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace libAllure;

class ConfigFile
class ConfigFile
{
private array $keys;

Expand All @@ -23,7 +23,7 @@ public function __construct(array $additionalKeys = null, $useDefaultKeys = true
if (is_array($additionalKeys)) {
$this->keys = array_merge($this->keys, $additionalKeys);
}
}
}

public function tryLoad(array $possiblePaths)
{
Expand Down Expand Up @@ -70,7 +70,7 @@ public function get($k): ?string
{
if (isset($this->keys[$k])) {
return $this->keys[$k];
}
}

return null;
}
Expand Down
31 changes: 18 additions & 13 deletions src/main/php/libAllure/Sanitizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
namespace libAllure;

/**
* Sanitizes and filters input.
* Sanitizes and filters input.
*
* This class has an unusual history, and the first thing you will probably ask
* is why on earth this class exists when PHP has filter_ functions.
* This class has an unusual history, and the first thing you will probably ask
* is why on earth this class exists when PHP has filter_ functions.
*
* It looks like PHP's filter_ function were added in PHP 5.2 (~2006), yet
* this class was probably written around2005-2008 - and PHP 5.2 either probably
* was not available on my server, or I just didn't know about the filter_
* It looks like PHP's filter_ function were added in PHP 5.2 (~2006), yet
* this class was probably written around2005-2008 - and PHP 5.2 either probably
* was not available on my server, or I just didn't know about the filter_
* functions.
*
* However, the filter_ functions interface is incredibly goofy (array of
* However, the filter_ functions interface is incredibly goofy (array of
* $options, etc), so this class has now been re-written as a wrapper around
* the filter_ functions.
*/
Expand All @@ -58,7 +58,7 @@ class Sanitizer
/**
* The constructor is still public as it's quite likely that users will want
* to create instances of this class with different options. This singleton
* method is useful for getting an instance with sane defaults.
* method is useful for getting an instance with sane defaults.
*/
public static function getInstance()
{
Expand All @@ -82,11 +82,16 @@ public function setInputSource($inputSource)
private function getInputSourceArray(): array
{
switch ($this->inputSource) {
case self::INPUT_GET: return $_GET;
case self::INPUT_POST: return $_POST;
case self::INPUT_REQUEST: return $_REQUEST;
case self::INPUT_SERVER: return $_SERVER;
case self::INPUT_COOKIE: return $_COOKIE;
case self::INPUT_GET:
return $_GET;
case self::INPUT_POST:
return $_POST;
case self::INPUT_REQUEST:
return $_REQUEST;
case self::INPUT_SERVER:
return $_SERVER;
case self::INPUT_COOKIE:
return $_COOKIE;
default:
throw new \Exception('Invalid input source');
}
Expand Down

0 comments on commit 034222d

Please sign in to comment.