{"id":44574398,"url":"https://github.com/nette/phpstan-rules","last_synced_at":"2026-02-17T07:01:10.913Z","repository":{"id":337660982,"uuid":"1154477212","full_name":"nette/phpstan-rules","owner":"nette","description":"🐘 PHPStan rules and type extensions for Nette libraries","archived":false,"fork":false,"pushed_at":"2026-02-12T10:13:23.000Z","size":30,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-14T09:06:41.783Z","etag":null,"topics":["nette","phpstan-extension"],"latest_commit_sha":null,"homepage":"https://nette.org","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nette.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"dg","custom":"https://nette.org/donate"}},"created_at":"2026-02-10T12:39:41.000Z","updated_at":"2026-02-12T10:13:27.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/nette/phpstan-rules","commit_stats":null,"previous_names":["nette/phpstan-rules"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nette/phpstan-rules","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nette%2Fphpstan-rules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nette%2Fphpstan-rules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nette%2Fphpstan-rules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nette%2Fphpstan-rules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nette","download_url":"https://codeload.github.com/nette/phpstan-rules/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nette%2Fphpstan-rules/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29469907,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T04:35:06.950Z","status":"ssl_error","status_checked_at":"2026-02-15T04:33:41.357Z","response_time":118,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nette","phpstan-extension"],"created_at":"2026-02-14T04:08:56.432Z","updated_at":"2026-02-15T05:01:38.346Z","avatar_url":"https://github.com/nette.png","language":"PHP","readme":"# PHPStan extensions for Nette libraries\n\n![Nette PHPStan Rules](https://github.com/user-attachments/assets/c231ed47-a413-4dd2-81ef-83e52c080427)\n\n[![Downloads this Month](https://img.shields.io/packagist/dm/nette/phpstan-rules.svg)](https://packagist.org/packages/nette/phpstan-rules)\n[![Tests](https://github.com/nette/phpstan-rules/workflows/Tests/badge.svg?branch=master)](https://github.com/nette/phpstan-rules/actions)\n[![Latest Stable Version](https://poser.pugx.org/nette/phpstan-rules/v/stable)](https://github.com/nette/phpstan-rules/releases)\n[![License](https://img.shields.io/badge/license-New%20BSD-blue.svg)](https://github.com/nette/phpstan-rules/blob/master/license.md)\n\n \u003c!----\u003e\n\n\u003ch3\u003e\n\nMakes [PHPStan](https://phpstan.org) smarter about Nette code. Install, and it just works — more precise types, fewer false positives.\n\n\u003c/h3\u003e\n\n \u003c!----\u003e\n\n\n## Installation\n\nInstall via Composer:\n\n```shell\ncomposer require --dev nette/phpstan-rules\n```\n\nRequirements: PHP 8.1 or higher and PHPStan 2.1+.\n\nIf you use [phpstan/extension-installer](https://github.com/phpstan/extension-installer), the extension is registered automatically. Otherwise add to your `phpstan.neon`:\n\n```neon\nincludes:\n    - vendor/nette/phpstan-rules/extension.neon\n```\n\n \u003c!----\u003e\n\n## What's Included\n\n \u003c!----\u003e\n\n**Precise return types** — narrows return types of `Strings::match()`, `matchAll()`, `split()`, `Helpers::falseToNull()`, `Expect::array()`, `Arrays::invoke()`, and `Arrays::invokeMethod()` based on the arguments you pass.\n\n**Removes `|false` and `|null` from PHP functions** — many native functions like `getcwd`, `json_encode`, `preg_split`, `preg_replace`, and [many more](extension-php.neon) include `false` or `null` in their return type even though these error values are unrealistic on modern systems.\n\n**Assert type narrowing** — PHPStan understands type guarantees after `Tester\\Assert` calls like `notNull()`, `type()`, `true()`, etc.\n\n**False positive suppression** — silences known PHPStan false positives in Nette patterns (arrow functions passed as `void` callbacks, runtime type validation closures).\n\n \u003c!----\u003e\n\n### Type Assertion Testing Helper\n\nFor Nette package developers: `TypeAssert` lets you verify type inference in tests using [Nette Tester](https://tester.nette.org):\n\n```php\nuse Nette\\PHPStan\\Tester\\TypeAssert;\n\nTypeAssert::assertTypes(__DIR__ . '/data/types.php');\nTypeAssert::assertNoErrors(__DIR__ . '/data/clean.php');\n```\n\nThe data file uses `assertType()` from PHPStan:\n\n```php\nuse function PHPStan\\Testing\\assertType;\n\nassertType('non-empty-string', getcwd());\nassertType('string', Normalizer::normalize('foo'));\n```\n\n \u003c!----\u003e\n\n## [Support Me](https://github.com/sponsors/dg)\n\nDo you like Nette? Are you looking forward to the new features?\n\n[![Buy me a coffee](https://files.nette.org/icons/donation-3.svg)](https://github.com/sponsors/dg)\n\nThank you!\n","funding_links":["https://github.com/sponsors/dg","https://nette.org/donate"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnette%2Fphpstan-rules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnette%2Fphpstan-rules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnette%2Fphpstan-rules/lists"}