Skip to content

Commit 0420dfa

Browse files
authored
Merge branch 'php-strictus:main' into feature/enum
2 parents 9f07c9f + 4b2ba1b commit 0420dfa

File tree

14 files changed

+80
-27
lines changed

14 files changed

+80
-27
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml,json}]
15+
indent_size = 2

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
steps:
1616
- name: Checkout code
17-
uses: actions/checkout@v2
17+
uses: actions/checkout@v3
1818

1919
- name: Setup PHP
2020
uses: shivammathur/setup-php@v2

README.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
<div align="center">
2-
<p>
3-
<img src="https://github.com/php-strictus/strictus/raw/main/art/logo.png" alt="Strictus" width="400"/>
4-
<h1>Strictus</h1>
5-
Strict Typing on inline variables for PHP
6-
</p>
7-
8-
<p align="center">
9-
<a href="https://packagist.org/packages/strictus/strictus"><img src="https://img.shields.io/packagist/v/strictus/strictus.svg?style=flat-square" alt="Packagist"></a>
10-
<a href="https://packagist.org/packages/strictus/strictus"><img src="https://img.shields.io/packagist/php-v/strictus/strictus.svg?style=flat-square" alt="PHP from Packagist"></a>
11-
<a href="https://github.com/php-strictus/strictus/actions"><img alt="GitHub Workflow Status (main)" src="https://img.shields.io/github/actions/workflow/status/php-strictus/strictus/tests.yml?branch=main&label=Tests"> </a>
12-
</p>
13-
14-
<p align="center">
2+
<img src="https://github.com/php-strictus/strictus/raw/main/art/logo.png" alt="Strictus" width="400"/>
3+
<h1>Strictus</h1>
4+
<h4>Strict Typing on inline variables for PHP</h4>
5+
</div>
6+
7+
<div align="center">
8+
<a href="https://packagist.org/packages/strictus/strictus"><img src="https://img.shields.io/packagist/v/strictus/strictus.svg?style=flat-square" alt="Packagist"></a>
9+
<a href="https://packagist.org/packages/strictus/strictus"><img src="https://img.shields.io/packagist/php-v/strictus/strictus.svg?style=flat-square" alt="PHP from Packagist"></a>
10+
<a href="https://github.com/php-strictus/strictus/actions"><img alt="GitHub Workflow Status (main)" src="https://img.shields.io/github/actions/workflow/status/php-strictus/strictus/tests.yml?branch=main&label=Tests"> </a>
11+
</div>
12+
13+
<div align="center">
1514
<a href="#introduction">Introduction</a> |
1615
<a href="#installation">Installation</a> |
1716
<a href="#usage">Usage</a> |
1817
<a href="#credits">Credits</a> |
1918
<a href="#contributing">Contributing</a>
20-
</p>
2119
</div>
2220

2321
## Introduction

composer.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,17 @@
3030
"php": "^8.1"
3131
},
3232
"scripts": {
33-
"lint": "pint",
34-
"test:lint": "pint --test",
35-
"test:unit": "./vendor/bin/pest --order-by random",
36-
"test": ["@test:lint", "@test:unit"]
33+
"lint": ["pint"],
34+
"test:lint": ["pint --test"],
35+
"test:unit": ["pest --order-by random"],
36+
"test": [
37+
"@test:lint",
38+
"@test:unit"
39+
]
3740
},
3841
"require-dev": {
39-
"laravel/pint": "^1.4.1",
40-
"pestphp/pest": "^1.22.4"
42+
"laravel/pint": "^1.10.1",
43+
"pestphp/pest": "^1.23.0"
4144
},
4245
"config": {
4346
"sort-packages": true,

pint.json

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
{
22
"preset": "laravel",
33
"rules": {
4+
"array_push": true,
5+
"assign_null_coalescing_to_coalesce_equal": true,
6+
"combine_consecutive_issets": true,
7+
"combine_consecutive_unsets": true,
8+
"concat_space": {
9+
"spacing": "one"
10+
},
11+
"declare_strict_types": true,
12+
"explicit_indirect_variable": true,
13+
"explicit_string_variable": true,
14+
"global_namespace_import": true,
15+
"method_argument_space": {
16+
"on_multiline": "ensure_fully_multiline"
17+
},
18+
"modernize_strpos": true,
19+
"modernize_types_casting": true,
20+
"new_with_braces": true,
21+
"no_superfluous_elseif": true,
22+
"no_useless_else": true,
23+
"nullable_type_declaration_for_default_null_value": true,
424
"ordered_imports": {
525
"sort_algorithm": "alpha"
626
},
@@ -28,6 +48,9 @@
2848
"method_private"
2949
],
3050
"sort_algorithm": "none"
31-
}
51+
},
52+
"strict_comparison": true,
53+
"ternary_to_null_coalescing": true,
54+
"use_arrow_functions": true
3255
}
33-
}
56+
}

src/Types/StrictusInstance.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ final class StrictusInstance implements StrictusTypeInterface
1919

2020
public function __construct(private string $instanceType, private mixed $value, private bool $nullable)
2121
{
22-
$this->errorMessage = 'Expected Instance Of '.$this->instanceType;
22+
$this->errorMessage = 'Expected Instance Of ' . $this->instanceType;
2323

2424
if ($this->nullable) {
2525
$this->errorMessage .= ' Or Null';

tests/Pest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/*
46
|--------------------------------------------------------------------------
57
| Test Case
@@ -24,9 +26,7 @@
2426
|
2527
*/
2628

27-
expect()->extend('toBeOne', function () {
28-
return $this->toBe(1);
29-
});
29+
expect()->extend('toBeOne', fn () => $this->toBe(1));
3030

3131
/*
3232
|--------------------------------------------------------------------------

tests/Unit/ArrayTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
use Strictus\Exceptions\StrictusTypeException;
46
use Strictus\Strictus;
57
use Strictus\Types\StrictusArray;

tests/Unit/BooleanTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
use Strictus\Exceptions\StrictusTypeException;
46
use Strictus\Strictus;
57
use Strictus\Types\StrictusBoolean;

tests/Unit/FloatTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
use Strictus\Exceptions\StrictusTypeException;
46
use Strictus\Strictus;
57
use Strictus\Types\StrictusFloat;

0 commit comments

Comments
 (0)