Skip to content

Commit

Permalink
Fixed CS etc
Browse files Browse the repository at this point in the history
  • Loading branch information
paranoiq committed Jul 26, 2022
1 parent 36efdaf commit a320266
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 26 deletions.
2 changes: 2 additions & 0 deletions build/custom.dic
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ wildcard
armscii
ascii
catalan
codepoint
csp
csrf
cygwin
Expand All @@ -74,6 +75,7 @@ tcp
tftp
ucs
uhc
unicode
unix
uri
ux
Expand Down
4 changes: 2 additions & 2 deletions build/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ parameters:
# PHP 7 -> 8
- '~expects (Curl(Multi)?Handle|resource), Curl(Multi)?Handle\|resource given~'

# PHP 7.1 compatibility (cannot declare interface method with default value)
- '~Call to an undefined method Dogma\\Time\\DateOr(Date)?Time::format\(\)~'
# PHP 8.0 -> 8.1
- '~finfo\|resource\|null~'
9 changes: 5 additions & 4 deletions src/Io/ContentType/ContentTypeDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
use Dogma\Io\Path;
use Dogma\Language\Encoding;
use Dogma\StrictBehaviorMixin;
use const FILEINFO_MIME_ENCODING;
use const FILEINFO_MIME_TYPE;
use finfo;
use function error_clear_last;
use function error_get_last;
use function finfo_buffer;
use function finfo_file;
use function finfo_open;
use const FILEINFO_MIME_ENCODING;
use const FILEINFO_MIME_TYPE;

class ContentTypeDetector
{
Expand All @@ -27,10 +28,10 @@ class ContentTypeDetector
/** @var string|null */
private $magicFile;

/** @var resource|null */
/** @var resource|finfo|null */
private $typeHandler;

/** @var resource|null */
/** @var resource|finfo|null */
private $encodingHandler;

public function __construct(?string $magicFile = null)
Expand Down
2 changes: 1 addition & 1 deletion src/Time/DateOrTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
interface DateOrTime extends Equalable, Comparable
{

//public function format(string $format = ''): string; // PHP 7.2+
public function format(string $format = ''): string;

public function fillValues(DateTimeValues $values): void;

Expand Down
13 changes: 2 additions & 11 deletions src/common/Obj.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@

namespace Dogma;

use function function_exists;
use function hexdec;
use function is_object;
use function md5;
use function spl_object_hash;
use function spl_object_id;
use function substr;

class Obj
Expand All @@ -37,15 +36,7 @@ public static function dumpHash($object): string
public static function objectId($object): int
{
if (is_object($object)) {
// PHP >= 7.2
if (function_exists('spl_object_id')) {
return spl_object_id($object);
} else {
$hash = spl_object_hash($object);
$hash = substr($hash, 8, 8) . substr($hash, 24, 8);

return (int) hexdec($hash);
}
return spl_object_id($object);
} else {
return (int) $object;
}
Expand Down
17 changes: 9 additions & 8 deletions src/common/Re.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@

namespace Dogma;

use const PREG_GREP_INVERT;
use const PREG_OFFSET_CAPTURE;
use const PREG_PATTERN_ORDER;
use const PREG_SET_ORDER;
use const PREG_SPLIT_DELIM_CAPTURE;
use const PREG_SPLIT_NO_EMPTY;
use const PREG_SPLIT_OFFSET_CAPTURE;
use function array_keys;
use function array_values;
use function count;
Expand All @@ -31,6 +24,14 @@
use function preg_replace_callback;
use function preg_split;
use function strlen;
use const PREG_GREP_INVERT;
use const PREG_OFFSET_CAPTURE;
use const PREG_PATTERN_ORDER;
use const PREG_SET_ORDER;
use const PREG_SPLIT_DELIM_CAPTURE;
use const PREG_SPLIT_NO_EMPTY;
use const PREG_SPLIT_OFFSET_CAPTURE;
use const PREG_UNMATCHED_AS_NULL;

/**
* Strings manipulation with regular expressions
Expand All @@ -47,7 +48,7 @@ class Re
public const CAPTURE_DELIMITER = PREG_SPLIT_DELIM_CAPTURE;

public const FILTER_EMPTY = PREG_SPLIT_NO_EMPTY;
//public const UNMATCHED_AS_NULL = PREG_UNMATCHED_AS_NULL; // PHP 7.2
public const UNMATCHED_AS_NULL = PREG_UNMATCHED_AS_NULL;

public const INVERT = PREG_GREP_INVERT;

Expand Down

0 comments on commit a320266

Please sign in to comment.