File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323 "nette/http" : " ^3.2" ,
2424 "nette/tester" : " ^2.6" ,
2525 "tracy/tracy" : " ^2.9" ,
26- "phpstan/phpstan-nette" : " ^2.0@stable" ,
26+ "phpstan/phpstan" : " ^2.1@stable" ,
27+ "phpstan/extension-installer" : " ^1.4@stable" ,
28+ "nette/phpstan-rules" : " ^1.0" ,
2729 "mockery/mockery" : " ^1.6@stable"
2830 },
2931 "conflict" : {
4547 "branch-alias" : {
4648 "dev-master" : " 3.2-dev"
4749 }
50+ },
51+ "config" : {
52+ "allow-plugins" : {
53+ "phpstan/extension-installer" : true
54+ }
4855 }
4956}
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ /**
4+ * PHPStan type tests.
5+ */
6+
7+ use Nette \Security \IIdentity ;
8+ use Nette \Security \Permission ;
9+ use Nette \Security \User ;
10+ use function PHPStan \Testing \assertType ;
11+
12+
13+ function testPermissionGetRoles (Permission $ acl ): void
14+ {
15+ assertType ('list<string> ' , $ acl ->getRoles ());
16+ }
17+
18+
19+ function testPermissionGetRoleParents (Permission $ acl ): void
20+ {
21+ $ acl ->addRole ('admin ' );
22+ assertType ('list<string> ' , $ acl ->getRoleParents ('admin ' ));
23+ }
24+
25+
26+ function testPermissionGetResources (Permission $ acl ): void
27+ {
28+ assertType ('list<string> ' , $ acl ->getResources ());
29+ }
30+
31+
32+ function testIIdentityGetId (IIdentity $ identity ): void
33+ {
34+ assertType ('int|string ' , $ identity ->getId ());
35+ }
36+
37+
38+ function testUserGetId (User $ user ): void
39+ {
40+ assertType ('int|string|null ' , $ user ->getId ());
41+ }
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ require __DIR__ . '/../bootstrap.php ' ;
4+
5+ use Nette \PHPStan \Tester \TypeAssert ;
6+
7+ TypeAssert::assertTypes (__DIR__ . '/security-types.php ' );
You can’t perform that action at this time.
0 commit comments