Skip to content

Commit d272857

Browse files
Merge branch 'main' into dev
2 parents 242f677 + 0f55f8f commit d272857

File tree

10 files changed

+132
-6
lines changed

10 files changed

+132
-6
lines changed

.github/CONTRIBUTING.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,21 @@
1-
## Contribute
1+
# Contributing
2+
3+
Thanks for contributing!
4+
5+
## Requirements
6+
7+
- PHP 8.2+
8+
- Composer
9+
- PSR-12 Code Style
10+
11+
## How to Contribute
12+
13+
1. Fork & create a branch: `feature/my-feature`
14+
2. Add tests and changelog if needed
15+
3. Open a PR and link changelog issue: `#123`
16+
17+
## Checklist
18+
19+
- [ ] Code follows style
20+
- [ ] CI (PHPStan, PHPUnit) passes
21+
- [ ] Changelog submitted

.github/ISSUE_TEMPLATE/changelog.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: 🔄 Changelog Entry
2+
description: Suggest a changelog entry
3+
labels: [changelog]
4+
body:
5+
- type: dropdown
6+
attributes:
7+
label: Type of change
8+
options:
9+
- Added
10+
- Changed
11+
- Deprecated
12+
- Removed
13+
- Fixed
14+
- Security
15+
validations:
16+
required: true
17+
18+
- type: textarea
19+
attributes:
20+
label: Description
21+
description: Describe the change
22+
placeholder: "Added support for X..."
23+
validations:
24+
required: true
25+
26+
- type: input
27+
attributes:
28+
label: Related PR or Issue
29+
placeholder: "#123"

.github/ISSUE_TEMPLATE/config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: 🙋 Ask a Question
4+
url: https://github.com/your-org/your-repo/discussions
5+
about: Ask questions and get help from the community.
6+
- name: 🛠️ Contributing Guide
7+
url: https://github.com/your-org/your-repo/blob/main/CONTRIBUTING.md
8+
about: Learn how to contribute to this project.

.github/workflows/auto-merge.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: 🤖 Auto Merge
2+
3+
on:
4+
pull_request:
5+
types: [labeled, unlabeled, synchronize, opened, reopened]
6+
7+
permissions:
8+
pull-requests: write
9+
contents: read
10+
checks: read
11+
12+
jobs:
13+
enable-auto-merge:
14+
if: |
15+
contains(github.event.pull_request.labels.*.name, 'automerge') &&
16+
github.event.pull_request.draft == false
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Enable Auto Merge
21+
uses: peter-evans/enable-pull-request-automerge@v3
22+
with:
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
merge-method: squash

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: ✅ PHP CI (PHPStan + PHPUnit)
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
tests:
11+
name: Run Static Analysis and Tests
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout Code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: 8.4
22+
extensions: mbstring, xml, pdo, curl
23+
tools: phpstan, phpunit
24+
25+
- name: Install Dependencies
26+
run: composer install --no-progress --prefer-dist
27+
28+
- name: Run PHPStan
29+
run: composer test:type
30+
31+
- name: Run PHPUnit
32+
run: composer test:unit

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ composer.lock
66
/*.db
77
/*.sqlite
88
/*.sqlite3
9+
.phpunit.cache/

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
3535
],
3636
"test:unit": "phpunit",
37-
"test:type": "phpstan analyse src",
37+
"test:type": "phpstan analyse --ansi",
3838
"test": ["@test:unit", "@test:type"]
3939
},
4040
"config": {

config/ErrorHandler.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
}
1313

1414
// Custom error handler
15-
function errorHandler($errNo, $errStr, $errFile, $errLine)
15+
function errorHandler(string $errNo, string $errStr, string $errFile, string $errLine): mixed
1616
{
1717
$errorTypes = [
1818
E_ERROR => 'Error',
@@ -41,7 +41,7 @@ function errorHandler($errNo, $errStr, $errFile, $errLine)
4141
}
4242

4343
// Custom exception handler
44-
function exceptionHandler(Throwable $exception)
44+
function exceptionHandler(Throwable $exception): void
4545
{
4646
$timestamp = date('Y-m-d H:i:s');
4747
$message = "[$timestamp] Uncaught Exception: " . $exception->getMessage() .
@@ -54,4 +54,3 @@ function exceptionHandler(Throwable $exception)
5454

5555
set_error_handler('errorHandler');
5656
set_exception_handler('exceptionHandler');
57-

phpstan.neon.dist

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
parameters:
2+
level: 6
3+
4+
reportUnmatchedIgnoredErrors: false
5+
treatPhpDocTypesAsCertain: false
6+
7+
paths:
8+
- 'app/'
9+

tests/ExampleTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,29 @@
55
namespace Tests;
66

77
use PHPUnit\Framework\TestCase;
8-
use App\App;
8+
//use App\App;
99

1010
final class ExampleTest extends TestCase
1111
{
1212
private $app;
1313

14+
/*
1415
public function setUp(): void
1516
{
1617
$this->app = new App("sushil");
1718
// $this->app->getName();
1819
}
20+
*/
1921

2022
public function testTwoNumbersAreSame(): void
2123
{
2224
$this->assertSame(1, 1);
2325
}
2426

27+
/*
2528
public function testSetName()
2629
{
2730
$this->assertSame('sushil', $this->app->getName());
2831
}
32+
*/
2933
}

0 commit comments

Comments
 (0)