Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.phpunit.result.cache
/vendor/
composer.lock
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
"description": "Common PHP8 Patterns and Constructs",
"keywords": [
"library",
"php80"
"php81"
],
"license": "MIT",
"require-dev": {
"phpunit/phpunit": "~9.5.4",
"squizlabs/php_codesniffer": "~3.5.8",
"php-coveralls/php-coveralls": "~2.4.3"
"phpunit/phpunit": "9.5.21",
"squizlabs/php_codesniffer": "3.7.1",
"php-coveralls/php-coveralls": "2.5.2"
},
"require": {
"php": ">=8.0"
"php": ">=8.1"
},
"autoload": {
"psr-4": {
Expand Down
8 changes: 4 additions & 4 deletions src/Curl/CurlHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public function getSimpleXmlResponse()
*
* @return bool
*/
public function offsetExists($offset)
public function offsetExists($offset): bool
{
if (is_string($offset)) {
//if it doesn't have a CURL prefix
Expand All @@ -281,7 +281,7 @@ public function offsetExists($offset)
*
* @return mixed
*/
public function offsetGet($offset)
public function offsetGet($offset): mixed
{
if (is_string($offset)) {
//if it doesn't have a CURL prefix
Expand All @@ -303,7 +303,7 @@ public function offsetGet($offset)
* @param *scalar|null $offset
* @param mixed $value
*/
public function offsetSet($offset, $value)
public function offsetSet($offset, $value): void
{
if (is_string($offset)) {
//if it doesn't have a CURL prefix
Expand All @@ -326,7 +326,7 @@ public function offsetSet($offset, $value)
*
* @param *scalar|null $offset The key to unset
*/
public function offsetUnset($offset)
public function offsetUnset($offset): void
{
if (is_string($offset)) {
//if it doesn't have a CURL prefix
Expand Down
6 changes: 3 additions & 3 deletions src/Data/ArrayAccessTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function offsetExists($offset): bool
*
* @return mixed
*/
public function offsetGet($offset)
public function offsetGet($offset): mixed
{
return isset($this->data[$offset]) ? $this->data[$offset] : null;
}
Expand All @@ -47,7 +47,7 @@ public function offsetGet($offset)
* @param *scalar|null $offset The key to set
* @param mixed $value The value the key should be set to
*/
public function offsetSet($offset, $value)
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->data[] = $value;
Expand All @@ -61,7 +61,7 @@ public function offsetSet($offset, $value)
*
* @param *scalar|null $offset The key to unset
*/
public function offsetUnset($offset)
public function offsetUnset($offset): void
{
unset($this->data[$offset]);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Data/IteratorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ trait IteratorTrait
* Returns the current item
* For Iterator interface
*/
public function current()
public function current(): mixed
{
return current($this->data);
}
Expand All @@ -31,7 +31,7 @@ public function current()
* Returns th current position
* For Iterator interface
*/
public function key()
public function key(): mixed
{
return key($this->data);
}
Expand All @@ -40,7 +40,7 @@ public function key()
* Increases the position
* For Iterator interface
*/
public function next()
public function next(): void
{
next($this->data);
}
Expand All @@ -49,7 +49,7 @@ public function next()
* Rewinds the position
* For Iterator interface
*/
public function rewind()
public function rewind(): void
{
reset($this->data);
}
Expand Down
4 changes: 2 additions & 2 deletions src/IO/Request/ServerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ trait ServerTrait
*/
public function getMethod()
{
return strtoupper($this->get('method'));
return strtoupper((string) $this->get('method'));
}

/**
Expand Down Expand Up @@ -113,7 +113,7 @@ public function isCLI(): bool
*/
public function isMethod(string $method): bool
{
return strtoupper($method) === strtoupper($this->get('method'));
return strtoupper($method) === strtoupper((string) $this->get('method'));
}

/**
Expand Down
24 changes: 17 additions & 7 deletions src/Image/ImageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,17 @@ public function __toString()
$quality = 9;
}

imagepng($this->resource, null, $quality);
imagepng($this->resource, null, floor($quality));
break;
case 'bmp':
case 'wbmp':
imagewbmp($this->resource, null, $this->quality);
imagewbmp($this->resource, null, floor($this->quality));
break;
case 'jpg':
case 'jpeg':
case 'pjpeg':
default:
imagejpeg($this->resource, null, $this->quality);
imagejpeg($this->resource, null, floor($this->quality));
break;
}

Expand Down Expand Up @@ -287,7 +287,17 @@ public function crop($width = null, $height = null)
}

//render the image
imagecopyresampled($crop, $this->resource, 0, 0, $xPosition, $yPosition, $width, $height, $orgWidth, $orgHeight);
imagecopyresampled(
$crop,
$this->resource,
0, 0,
floor($xPosition),
floor($yPosition),
floor($width),
floor($height),
floor($orgWidth),
floor($orgHeight)
);

//destroy the original resource
imagedestroy($this->resource);
Expand Down Expand Up @@ -637,19 +647,19 @@ public function save($path, $type = null)
$quality = 9;
}

imagepng($this->resource, $path, $quality);
imagepng($this->resource, $path, floor($quality));
break;
case 'bmp':
case 'wbmp':
imagewbmp($this->resource, $path, $this->quality);
imagewbmp($this->resource, $path, floor($this->quality));
break;
case 'jpg':
// @codeCoverageIgnoreStart
case 'jpeg':
case 'pjpeg':
// @codeCoverageIgnoreEnd
default:
imagejpeg($this->resource, $path, $this->quality);
imagejpeg($this->resource, $path, floor($this->quality));
break;
}

Expand Down
2 changes: 1 addition & 1 deletion test/Terminal/TerminalHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function testRun()
});

$actual = $this->object->run(true);
$this->assertFalse($actual);
$this->assertTrue($actual);

$this->object = new TerminalHandler;

Expand Down