Skip to content

Commit

Permalink
Merge pull request #81 from Hi-Folks/feat/update-php84
Browse files Browse the repository at this point in the history
update PHP 8.4 + rector
  • Loading branch information
roberto-butti authored Nov 21, 2024
2 parents 3d4b978 + cb76aa4 commit 163ce29
Show file tree
Hide file tree
Showing 33 changed files with 205 additions and 359 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest]
php-versions: [ '8.2', '8.1', '8.0']
php-versions: [ '8.4', '8.3', '8.2', '8.1', '8.0']
dependency-stability: [ prefer-stable ]

name: P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}
],
"require": {
"php": "^8.0|^8.1|^8.2|^8.3"
"php": "^8.0|^8.1|^8.2|^8.3|^8.4"
},
"require-dev": {
"phpstan/phpstan": "^1.9",
Expand Down
4 changes: 2 additions & 2 deletions examples/DistributionChar.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

require_once "./vendor/autoload.php";
require_once __DIR__ . "/vendor/autoload.php";

use HiFolks\RandoPhp\Randomize;
$count = 10000;
Expand All @@ -9,7 +9,7 @@

for ($i = 0; $i < $count; $i++) {
$item = Randomize::char()->alphanumeric()->generate();
$results[$item] = (key_exists($item, $results)) ? $results[$item] + 1 : 0;
$results[$item] = (array_key_exists($item, $results)) ? $results[$item] + 1 : 0;
}
ksort($results);
print_r($results);
2 changes: 1 addition & 1 deletion examples/RandomBoolean.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require_once "./vendor/autoload.php";
require_once __DIR__ . "/vendor/autoload.php";

use HiFolks\RandoPhp\Randomize;

Expand Down
2 changes: 1 addition & 1 deletion examples/RandomChar.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require_once "./vendor/autoload.php";
require_once __DIR__ . "/vendor/autoload.php";

use HiFolks\RandoPhp\Randomize;
echo "--- GENERATING A LOWER CASE CHAR (a-z)" . PHP_EOL;
Expand Down
6 changes: 3 additions & 3 deletions examples/RandomChars.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php
require_once "./vendor/autoload.php";
require_once __DIR__ . "/vendor/autoload.php";

use HiFolks\RandoPhp\Randomize;

function printLn($str)
function printLn(string $str): void
{
echo $str . PHP_EOL;
}

function insertBreak($char, $duplicates = 15)
function insertBreak($char, $duplicates = 15): void
{
echo str_repeat($char, $duplicates) . PHP_EOL;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/RandomDate.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require_once "./vendor/autoload.php";
require_once __DIR__ . "/vendor/autoload.php";

use HiFolks\RandoPhp\Randomize;

Expand Down
2 changes: 1 addition & 1 deletion examples/RandomInteger.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require_once "./vendor/autoload.php";
require_once __DIR__ . "/vendor/autoload.php";

use HiFolks\RandoPhp\Randomize;

Expand Down
6 changes: 3 additions & 3 deletions examples/RandomSequenceChar.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php
require_once "./vendor/autoload.php";
require_once __DIR__ . "/vendor/autoload.php";

use HiFolks\RandoPhp\Randomize;

function printLn($str)
function printLn(string $str): void
{
echo $str . PHP_EOL;
}

function insertBreak($char, $duplicates = 15)
function insertBreak($char, $duplicates = 15): void
{
echo str_repeat($char, $duplicates) . PHP_EOL;
}
Expand Down
6 changes: 3 additions & 3 deletions examples/RandomSequenceInteger.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php
require_once "./vendor/autoload.php";
require_once __DIR__ . "/vendor/autoload.php";

use HiFolks\RandoPhp\Randomize;

function printLn($str)
function printLn(string $str): void
{
echo $str . PHP_EOL;
}

function insertBreak($char, $duplicates = 15)
function insertBreak($char, $duplicates = 15): void
{
echo str_repeat($char, $duplicates) . PHP_EOL;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/basic.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require_once "./vendor/autoload.php";
require_once __DIR__ . "/vendor/autoload.php";

use HiFolks\RandoPhp\Draw;
use HiFolks\RandoPhp\Randomize;
Expand Down
12 changes: 6 additions & 6 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
php80: true,
)
->withPreparedSets(
//deadCode: true,
//codeQuality: true,
//earlyReturn: true,
//typeDeclarations: true,
//privatization: true,
// naming: true
deadCode: true,
codeQuality: true,
earlyReturn: true,
typeDeclarations: true,
privatization: true,
naming: true
);
3 changes: 1 addition & 2 deletions src/Draw.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ class Draw
{
/**
* @param array<int|string> $array
* @return Sample
*/
public static function sample($array = [])
public static function sample($array = []): \HiFolks\RandoPhp\Models\Sample
{
return new Sample($array);
}
Expand Down
1 change: 0 additions & 1 deletion src/Models/Boolean.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
class Boolean
{
/**
* @return bool
* @throws \Exception
*/
public function generate(): bool
Expand Down
7 changes: 1 addition & 6 deletions src/Models/Byte.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@

class Byte
{
/**
* @var int
*/
private $length = 8;
private int $length = 8;


/**
* @param int $length
* @return $this
*/
public function length(int $length): self
Expand All @@ -21,7 +17,6 @@ public function length(int $length): self
}

/**
* @return string
* @throws \Exception
*/
public function generate(): string
Expand Down
Loading

0 comments on commit 163ce29

Please sign in to comment.