Skip to content

Commit 50fcbbf

Browse files
Add PHPStan to one-off traits (#852)
* Test traits too * Add trait tests * Exclude trait tests from PHPCS * Fix phpstan path * Fix indenting * Fix indenting * Work on linting for traits * Work on linting for traits * Add PHPStan to one-off traits --------- Co-authored-by: Viktor Szépe <viktor@szepe.net>
1 parent d63a876 commit 50fcbbf

38 files changed

+213
-56
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
/phpcs.xml export-ignore
99
/phpstan-baseline.neon export-ignore
1010
/phpstan.neon export-ignore
11+
/phpstan/ export-ignore
1112
/phpunit.xml export-ignore
1213
/rector.php export-ignore
1314
/tests export-ignore

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## Unreleased
9+
10+
### Changed
11+
12+
- Adds PHPStan testing to more traits.
13+
814
## v1.16.0
915

1016
### Added

phpcs.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<arg name="severity" value="1" />
1818

1919
<exclude-pattern>bin/</exclude-pattern>
20+
<exclude-pattern>phpstan/</exclude-pattern>
2021
<exclude-pattern>tests/</exclude-pattern>
2122

2223
<rule ref="Alley-Interactive">

phpstan.neon

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ parameters:
55
level: 8
66

77
paths:
8-
- src/mantle
8+
- src/mantle/
99
- mantle.php
10+
- phpstan/
1011

1112
ignoreErrors:
12-
-
13-
identifier: trait.unused
1413
-
1514
identifier: staticMethod.resultUnused
1615
# Will be fixed in PHPStan soon.

phpstan/AdminScreenTraitTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
class AdminScreenTraitTest
4+
{
5+
use Mantle\Testing\Concerns\Admin_Screen;
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
class CustomPostPermalinkTraitTest
4+
{
5+
use Mantle\Database\Model\Concerns\Custom_Post_Permalink;
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
class CustomTermLinkTraitTest
4+
{
5+
use Mantle\Database\Model\Concerns\Custom_Term_Link;
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
class DependencyAssertionsTraitTest
4+
{
5+
use Mantle\Testing\Concerns\Dependency_Assertions;
6+
}

phpstan/DispatchableTraitTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
use Mantle\Contracts\Queue\Job;
4+
5+
class DispatchableTraitTest implements Job
6+
{
7+
use Mantle\Queue\Dispatchable;
8+
9+
public function handle(): void
10+
{
11+
// Job handling logic here.
12+
}
13+
}

phpstan/MultisiteTestTraitTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
class MultisiteTestTraitTest
4+
{
5+
use Mantle\Testing\Concerns\Multisite_Test;
6+
}

0 commit comments

Comments
 (0)