Skip to content

Commit 54f06ce

Browse files
authored
Update PHP deps (#30)
* Update deps * Fixes Code style * Fixed phan issues * Missed `: void` * Exclude PHP 8.0 in Travis
1 parent 3a2ae5c commit 54f06ce

49 files changed

Lines changed: 440 additions & 329 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
#
1313

1414
/.github export-ignore
15-
/.phan export-ignore
1615
/build export-ignore
1716
/tests export-ignore
1817
/.editorconfig export-ignore
1918
/.gitattributes export-ignore
2019
/.gitignore export-ignore
20+
/.phan.php export-ignore
2121
/.travis.yml export-ignore
2222
/phpunit.xml.dist export-ignore
2323

.github/workflows/main.yml

Lines changed: 79 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# @link https://github.com/JBZoo/Utils
1212
#
1313

14-
name: Continuous Integration
14+
name: CI
1515

1616
on:
1717
pull_request:
@@ -21,7 +21,7 @@ on:
2121
branches:
2222
- 'master'
2323
schedule:
24-
- cron: '15 */8 * * *'
24+
- cron: '50 */8 * * *'
2525

2626
env:
2727
COLUMNS: 120
@@ -35,12 +35,11 @@ jobs:
3535
JBZOO_COMPOSER_UPDATE_FLAGS: ${{ matrix.composer_flags }}
3636
strategy:
3737
matrix:
38-
php-version: [ 7.2, 7.3, 7.4 ]
38+
php-version: [ 7.2, 7.3, 7.4, 8.0 ]
3939
experimental: [ false ]
40+
coverage: [ xdebug, none ]
4041
composer_flags: [ "--prefer-lowest", "" ]
4142
include:
42-
- php-version: "8.0"
43-
experimental: true
4443
- php-version: "8.1"
4544
experimental: true
4645
steps:
@@ -49,11 +48,11 @@ jobs:
4948
with:
5049
fetch-depth: 0
5150

52-
- name: Setup PHP and composer
51+
- name: Setup PHP
5352
uses: shivammathur/setup-php@v2
5453
with:
5554
php-version: ${{ matrix.php-version }}
56-
coverage: xdebug
55+
coverage: ${{ matrix.coverage }}
5756
tools: composer
5857

5958
- name: Build the Project
@@ -64,10 +63,82 @@ jobs:
6463
continue-on-error: ${{ matrix.experimental }}
6564
run: make test --no-print-directory
6665

66+
- name: Upload Artifacts
67+
uses: actions/upload-artifact@v2
68+
with:
69+
name: PHPUnit - ${{ matrix.php-version }} - ${{ matrix.coverage }}
70+
path: build/
71+
72+
73+
linters:
74+
name: Linters
75+
runs-on: ubuntu-latest
76+
strategy:
77+
matrix:
78+
php-version: [ 7.2, 7.3, 7.4, 8.0 ]
79+
experimental: [ false ]
80+
include:
81+
- php-version: "8.1"
82+
experimental: true
83+
steps:
84+
- name: Checkout code
85+
uses: actions/checkout@v2
86+
with:
87+
fetch-depth: 0
88+
89+
- name: Setup PHP
90+
uses: shivammathur/setup-php@v2
91+
with:
92+
php-version: ${{ matrix.php-version }}
93+
tools: composer
94+
95+
- name: Build the Project
96+
continue-on-error: ${{ matrix.experimental }}
97+
run: make update --no-print-directory
98+
6799
- name: 👍 Code Quality
68100
continue-on-error: ${{ matrix.experimental }}
69101
run: make codestyle --no-print-directory
70102

71-
- name: 📝 Build All Reports at Once
103+
- name: Upload Artifacts
104+
uses: actions/upload-artifact@v2
105+
with:
106+
name: Linters - ${{ matrix.php-version }}
107+
path: build/
108+
109+
110+
report:
111+
name: Reports
112+
runs-on: ubuntu-latest
113+
strategy:
114+
matrix:
115+
php-version: [ 7.2, 7.3, 7.4, 8.0 ]
116+
experimental: [ false ]
117+
include:
118+
- php-version: "8.1"
119+
experimental: true
120+
steps:
121+
- name: Checkout code
122+
uses: actions/checkout@v2
123+
with:
124+
fetch-depth: 0
125+
126+
- name: Setup PHP
127+
uses: shivammathur/setup-php@v2
128+
with:
129+
php-version: ${{ matrix.php-version }}
130+
tools: composer
131+
132+
- name: Build the Project
133+
continue-on-error: ${{ matrix.experimental }}
134+
run: make update --no-print-directory
135+
136+
- name: 📝 Build Reports
72137
continue-on-error: ${{ matrix.experimental }}
73138
run: make report-all --no-print-directory
139+
140+
- name: Upload Artifacts
141+
uses: actions/upload-artifact@v2
142+
with:
143+
name: Reports - ${{ matrix.php-version }}
144+
path: build/

.phan/config.php renamed to .phan.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
declare(strict_types=1);
1717

18-
$default = include __DIR__ . '/../vendor/jbzoo/codestyle/src/phan/default.php';
18+
$default = include __DIR__ . '/vendor/jbzoo/codestyle/src/phan/default.php';
1919

2020
return array_merge($default, [
2121
'directory_list' => [

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ php:
2323
- 7.3
2424
- 7.4
2525
- 8.0
26-
- nightly
2726

2827
matrix:
2928
fast_finish: true
3029
allow_failures:
3130
- php: 8.0
32-
- php: nightly
3331

3432
env:
3533
matrix:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
},
3434

3535
"require-dev" : {
36-
"jbzoo/toolbox-dev" : "^2.11.0",
36+
"jbzoo/toolbox-dev" : "^2.13.1",
3737
"symfony/process" : ">=4.4"
3838
},
3939

src/Arr.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
2727
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
2828
*/
29-
class Arr
29+
final class Arr
3030
{
3131
/**
3232
* Remove the duplicates from an array.
@@ -475,4 +475,23 @@ public static function implode(string $glue, array $array): string
475475

476476
return $result;
477477
}
478+
479+
/**
480+
* @param array $array
481+
* @param string|float|int|bool|null $value
482+
* @return array
483+
*/
484+
public static function removeByValue(array $array, $value): array
485+
{
486+
return array_filter(
487+
$array,
488+
/**
489+
* @param string|float|int|bool|null $arrayItem
490+
*/
491+
static function ($arrayItem) use ($value): bool {
492+
return $value !== $arrayItem;
493+
},
494+
ARRAY_FILTER_USE_BOTH
495+
);
496+
}
478497
}

src/Cli.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*
2727
* @package JBZoo\Utils
2828
*/
29-
class Cli
29+
final class Cli
3030
{
3131
public const STDIN = 0;
3232
public const STDOUT = 1;

src/Csv.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*
2323
* @package JBZoo\Utils
2424
*/
25-
class Csv
25+
final class Csv
2626
{
2727
public const LENGTH_LIMIT = 10000000;
2828

src/Dates.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*
2626
* @package JBZoo\Utils
2727
*/
28-
class Dates
28+
final class Dates
2929
{
3030
public const MINUTE = 60;
3131
public const HOUR = 3600;
@@ -110,7 +110,7 @@ public static function timezone($timezone = null): DateTimeZone
110110
public static function is(?string $date): bool
111111
{
112112
$time = strtotime((string)$date);
113-
return $time > 10000;
113+
return $time > 0;
114114
}
115115

116116
/**
@@ -210,7 +210,9 @@ public static function isYesterday($time): bool
210210
*/
211211
public static function formatTime(float $seconds): string
212212
{
213-
if ($seconds < 2) {
213+
$minValuableSeconds = 2;
214+
215+
if ($seconds < $minValuableSeconds) {
214216
return number_format($seconds, 3) . ' sec';
215217
}
216218

src/Email.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*
2323
* @package JBZoo\Utils
2424
*/
25-
class Email
25+
final class Email
2626
{
2727
/**
2828
* Create random email

0 commit comments

Comments
 (0)