Skip to content

Commit 28b9d75

Browse files
committed
x
1 parent 4c859a3 commit 28b9d75

1 file changed

Lines changed: 15 additions & 22 deletions

File tree

readme.md

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
1-
# Nette PHPStan Rules
2-
3-
4-
<img width="2912" height="1440" alt="image" src="https://github.com/user-attachments/assets/c231ed47-a413-4dd2-81ef-83e52c080427" />
1+
![Nette PHPStan Rules](https://github.com/user-attachments/assets/c231ed47-a413-4dd2-81ef-83e52c080427)
52

63
[![Downloads this Month](https://img.shields.io/packagist/dm/nette/phpstan-rules.svg)](https://packagist.org/packages/nette/phpstan-rules)
74
[![Tests](https://github.com/nette/phpstan-rules/workflows/Tests/badge.svg?branch=master)](https://github.com/nette/phpstan-rules/actions)
85
[![Latest Stable Version](https://poser.pugx.org/nette/phpstan-rules/v/stable)](https://github.com/nette/phpstan-rules/releases)
96
[![License](https://img.shields.io/badge/license-New%20BSD-blue.svg)](https://github.com/nette/phpstan-rules/blob/master/license.md)
107

8+
 <!---->
119

12-
### PHPStan extensions for Nette libraries
10+
# PHPStan extensions for Nette libraries
1311

1412
Provides custom type extensions and error suppression rules used when analysing Nette libraries with [PHPStan](https://phpstan.org).
1513

16-
<!---->
14+
 <!---->
1715

1816

19-
Installation
20-
============
17+
## Installation
2118

2219
Install via Composer:
2320

@@ -34,15 +31,13 @@ includes:
3431
- vendor/nette/phpstan-rules/extension.neon
3532
```
3633

37-
<!---->
34+
 <!---->
3835

36+
## What's Included
3937

40-
What's Included
41-
===============
38+
 <!---->
4239

43-
44-
Narrow Return Types
45-
-------------------
40+
### Narrow Return Types
4641

4742
Removes `|false` from return types of native PHP functions and methods where `false` is trivial or outdated. For example, `getcwd()` returns `string|false`, but on modern systems `false` is unrealistic. This extension narrows it to `string`.
4843

@@ -54,9 +49,9 @@ Covered functions include `getcwd`, `json_encode`, `preg_match`, `preg_split`, `
5449
$cwd = getcwd();
5550
```
5651

52+
 <!---->
5753

58-
Type Validation Call Ignore
59-
---------------------------
54+
### Type Validation Call Ignore
6055

6156
Suppresses `expr.resultUnused` for the runtime type validation pattern commonly used in Nette:
6257

@@ -70,11 +65,9 @@ public function setItems(array $items): void
7065

7166
PHPStan normally reports the closure call result as unused. This extension recognizes the pattern (empty closure body, all parameters variadic with type hints) and ignores the error.
7267

73-
<!---->
74-
68+
 <!---->
7569

76-
Type Assertion Testing Helper
77-
==============================
70+
### Type Assertion Testing Helper
7871

7972
The package also provides `Nette\PHPStan\Testing\TypeAssert` for testing type inference in Nette packages using [Nette Tester](https://tester.nette.org):
8073

@@ -97,9 +90,9 @@ assertType('non-empty-string', getcwd());
9790
assertType('string', Normalizer::normalize('foo'));
9891
```
9992

93+
 <!---->
10094

101-
[Support Me](https://github.com/sponsors/dg)
102-
=============================================
95+
## [Support Me](https://github.com/sponsors/dg)
10396

10497
Do you like Nette? Are you looking forward to the new features?
10598

0 commit comments

Comments
 (0)