Skip to content

Commit 67525c2

Browse files
authored
Merge pull request #9 from fbarrento/configure-pint
chore: installs and configures pint.
2 parents c5469aa + 05556eb commit 67525c2

File tree

6 files changed

+75
-2
lines changed

6 files changed

+75
-2
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
]
2727
},
2828
"require-dev": {
29+
"laravel/pint": "^1.20",
2930
"pestphp/pest-dev-tools": "^3.4.0"
3031
},
3132
"minimum-stability": "dev",

pint.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"preset": "laravel",
3+
"rules": {
4+
"array_push": true,
5+
"backtick_to_shell_exec": true,
6+
"date_time_immutable": true,
7+
"declare_strict_types": true,
8+
"lowercase_keywords": true,
9+
"lowercase_static_reference": true,
10+
"final_class": true,
11+
"final_internal_class": true,
12+
"final_public_method_for_abstract_class": true,
13+
"fully_qualified_strict_types": true,
14+
"global_namespace_import": {
15+
"import_classes": true,
16+
"import_constants": true,
17+
"import_functions": true
18+
},
19+
"mb_str_functions": true,
20+
"modernize_types_casting": true,
21+
"new_with_parentheses": false,
22+
"no_superfluous_elseif": true,
23+
"no_useless_else": true,
24+
"no_multiple_statements_per_line": true,
25+
"ordered_class_elements": {
26+
"order": [
27+
"use_trait",
28+
"case",
29+
"constant",
30+
"constant_public",
31+
"constant_protected",
32+
"constant_private",
33+
"property_public",
34+
"property_protected",
35+
"property_private",
36+
"construct",
37+
"destruct",
38+
"magic",
39+
"phpunit",
40+
"method_abstract",
41+
"method_public_static",
42+
"method_public",
43+
"method_protected_static",
44+
"method_protected",
45+
"method_private_static",
46+
"method_private"
47+
],
48+
"sort_algorithm": "none"
49+
},
50+
"ordered_interfaces": true,
51+
"ordered_traits": true,
52+
"protected_to_private": true,
53+
"self_accessor": true,
54+
"self_static_accessor": true,
55+
"strict_comparison": true,
56+
"visibility_required": true
57+
}
58+
}

src/Compiler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ final class Compiler
2020
* @param array<int, Operation> $operations
2121
*/
2222
public function __construct(
23-
private array $operations
23+
private readonly array $operations
2424
) {
2525
//
2626
}

src/Operations/ToHaveTitle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ public function __construct(
2222

2323
public function compile(): string
2424
{
25-
return sprintf("await expect(page).toHaveTitle(/%s/);", $this->title);
25+
return sprintf('await expect(page).toHaveTitle(/%s/);', $this->title);
2626
}
2727
}

src/PendingTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,28 @@
44

55
namespace Pest\Browser;
66

7+
use Pest\Browser\Contracts\Operation;
8+
79
/**
810
* @internal
911
*/
1012
final class PendingTest
1113
{
1214
/**
1315
* The pending operations.
16+
*
17+
* @var array<int, Operation>
1418
*/
1519
private array $operations = [];
1620

21+
/**
22+
* Ends the chain and builds the test result.
23+
*/
24+
public function __destruct()
25+
{
26+
$this->build();
27+
}
28+
1729
/**
1830
* Visits a URL.
1931
*/

tests/Example.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 function Pest\Browser\visit;
46

57
it('may have a title at playwright', function () {

0 commit comments

Comments
 (0)