Skip to content

Commit ba40f0b

Browse files
committed
Fixes for PHP 8.1
1 parent 543138b commit ba40f0b

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

src/PHPSemVerChecker/Console/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function __construct()
2525
parent::__construct('PHP Semantic Versioning Checker by Tom Rochette', self::VERSION);
2626

2727
// Suppress deprecated warnings
28-
error_reporting(E_ALL ^E_DEPRECATED);
28+
error_reporting(E_ALL & ~E_DEPRECATED);
2929
}
3030

3131
/**

src/PHPSemVerChecker/Console/Command/CompareCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8888
$output->writeln('');
8989
$output->writeln('[Scanned files] Before: ' . count($sourceBefore) . ', After: ' . count($sourceAfter) . ', Identical: ' . $identicalCount);
9090
$output->writeln('Time: ' . round($duration, 3) . ' seconds, Memory: ' . round(memory_get_peak_usage() / 1024 / 1024, 3) . ' MB');
91+
92+
return 0;
9193
}
9294
}

src/PHPSemVerChecker/Finder/Finder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ public function find($path, array $includes, array $excludes = [])
4444
*/
4545
public function findFromString($path, $includes, $excludes)
4646
{
47-
if ($includes === '*') {
47+
if ($includes === '*' || $includes === null) {
4848
$includes = [];
4949
} else {
5050
$includes = preg_split('@(?:\s*,\s*|^\s*|\s*$)@', $includes, null, PREG_SPLIT_NO_EMPTY);
5151
}
5252

53-
if ($excludes === '*') {
53+
if ($excludes === '*' || $excludes === null) {
5454
$excludes = [];
5555
} else {
5656
$excludes = preg_split('@(?:\s*,\s*|^\s*|\s*$)@', $excludes, null, PREG_SPLIT_NO_EMPTY);

src/PHPSemVerChecker/Report/Report.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public function getSuggestedLevel()
158158
* @param string $offset
159159
* @return bool
160160
*/
161-
public function offsetExists($offset)
161+
public function offsetExists($offset): bool
162162
{
163163
return isset($this->differences[$offset]);
164164
}
@@ -167,6 +167,7 @@ public function offsetExists($offset)
167167
* @param string $offset
168168
* @return array
169169
*/
170+
#[\ReturnTypeWillChange]
170171
public function offsetGet($offset)
171172
{
172173
return $this->differences[$offset];
@@ -176,7 +177,7 @@ public function offsetGet($offset)
176177
* @param string $offset
177178
* @param mixed $value
178179
*/
179-
public function offsetSet($offset, $value)
180+
public function offsetSet($offset, $value): void
180181
{
181182
if ($offset === null) {
182183
$this->differences[] = $value;
@@ -188,15 +189,15 @@ public function offsetSet($offset, $value)
188189
/**
189190
* @param string $offset
190191
*/
191-
public function offsetUnset($offset)
192+
public function offsetUnset($offset): void
192193
{
193194
unset($this->differences[$offset]);
194195
}
195196

196197
/**
197198
* @return \ArrayIterator|\Traversable
198199
*/
199-
public function getIterator()
200+
public function getIterator(): \Traversable
200201
{
201202
return new ArrayIterator($this->differences);
202203
}

0 commit comments

Comments
 (0)