Skip to content

Commit 9b5b3b2

Browse files
committed
Initial commit
0 parents  commit 9b5b3b2

File tree

9 files changed

+330
-0
lines changed

9 files changed

+330
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/.idea
2+
/.phpunit.cache
3+
/vendor
4+
composer.lock
5+
phpcs.xml
6+
phpstan.neon

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Laravel stubs
2+
3+
Improved Laravel stubs with a command to keep them in sync
4+

composer.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"name": "recoded-dev/laravel-stubs",
3+
"description": "Syncable Laravel stubs",
4+
"type": "library",
5+
"license": "MIT",
6+
"keywords": ["dev"],
7+
"require": {
8+
"php": "^8.2",
9+
"laravel/framework": "^10.0"
10+
},
11+
"require-dev": {
12+
"orchestra/testbench": "^8.5",
13+
"phpstan/extension-installer": "^1.3",
14+
"phpstan/phpstan": "^1.10",
15+
"phpstan/phpstan-deprecation-rules": "^1.1",
16+
"phpstan/phpstan-phpunit": "^1.3",
17+
"phpstan/phpstan-strict-rules": "^1.5",
18+
"phpunit/phpunit": "^10.0",
19+
"slevomat/coding-standard": "^8.12",
20+
"squizlabs/php_codesniffer": "^3.7"
21+
},
22+
"autoload": {
23+
"psr-4": {
24+
"Recoded\\LaravelStubs\\": "src/"
25+
}
26+
},
27+
"autoload-dev": {
28+
"psr-4": {
29+
"Tests\\": "tests/"
30+
}
31+
},
32+
"authors": [
33+
{
34+
"name": "Noël Hagestein",
35+
"email": "[email protected]"
36+
}
37+
],
38+
"minimum-stability": "stable",
39+
"config": {
40+
"allow-plugins": {
41+
"phpstan/extension-installer": true,
42+
"dealerdirect/phpcodesniffer-composer-installer": true
43+
},
44+
"sort-packages": true
45+
}
46+
}

phpcs.xml.dist

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<ruleset
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
name="23G Coding Standard"
5+
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"
6+
>
7+
<config name="tab_width" value="4" />
8+
<config name="ignore_warnings_on_exit" value="1" />
9+
10+
<arg name="colors" />
11+
<arg name="extensions" value="php" />
12+
13+
<rule ref="PSR12" />
14+
15+
<rule ref="Generic.Arrays.ArrayIndent" />
16+
17+
<rule ref="Generic.Arrays.DisallowLongArraySyntax" />
18+
19+
<rule ref="Generic.Files.LineLength">
20+
<properties>
21+
<property name="ignoreComments" value="true" />
22+
</properties>
23+
</rule>
24+
25+
<rule ref="Generic.Formatting.SpaceAfterCast" />
26+
27+
<rule ref="Generic.Formatting.SpaceAfterNot">
28+
<properties>
29+
<property name="spacing" value="0" />
30+
</properties>
31+
</rule>
32+
33+
<rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma" />
34+
35+
<rule ref="SlevomatCodingStandard.Classes.BackedEnumTypeSpacing" />
36+
37+
<rule ref="SlevomatCodingStandard.Classes.ClassStructure">
38+
<properties>
39+
<property name="groups" type="array">
40+
<element value="uses" />
41+
<element value="constants" />
42+
<element value="enum cases" />
43+
<element value="properties" />
44+
<element value="constructor" />
45+
<element value="methods" />
46+
</property>
47+
</properties>
48+
</rule>
49+
50+
<rule ref="SlevomatCodingStandard.Classes.ClassMemberSpacing">
51+
<properties>
52+
<property name="linesCountBetweenMembers" value="1" />
53+
</properties>
54+
</rule>
55+
56+
<rule ref="SlevomatCodingStandard.Classes.MethodSpacing">
57+
<properties>
58+
<property name="minLinesCount" value="1" />
59+
<property name="maxLinesCount" value="1" />
60+
</properties>
61+
</rule>
62+
63+
<rule ref="SlevomatCodingStandard.Classes.SuperfluousTraitNaming" />
64+
65+
<rule ref="SlevomatCodingStandard.Commenting.DocCommentSpacing">
66+
<properties>
67+
<property name="linesCountBeforeFirstContent" value="0" />
68+
<property name="linesCountBetweenDescriptionAndAnnotations" value="1" />
69+
<property name="linesCountBetweenDifferentAnnotationTypes" value="0" />
70+
<property name="linesCountAfterLastContent" value="0" />
71+
</properties>
72+
</rule>
73+
74+
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison" />
75+
76+
<rule ref="SlevomatCodingStandard.ControlStructures.JumpStatementsSpacing">
77+
<properties>
78+
<property name="linesCountBefore" value="1" />
79+
<property name="jumpStatements" type="array">
80+
<element value="return" />
81+
<element value="throw" />
82+
</property>
83+
</properties>
84+
</rule>
85+
86+
<rule ref="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing">
87+
<properties>
88+
<property name="linesCountBefore" value="1" />
89+
<property name="linesCountAfter" value="1" />
90+
<property name="controlStructures" type="array">
91+
<element value="for" />
92+
<element value="foreach" />
93+
<element value="if" />
94+
<element value="switch" />
95+
<element value="while" />
96+
</property>
97+
</properties>
98+
</rule>
99+
100+
<rule ref="SlevomatCodingStandard.Exceptions.RequireNonCapturingCatch" />
101+
102+
<rule ref="SlevomatCodingStandard.Functions.ArrowFunctionDeclaration">
103+
<properties>
104+
<property name="spacesCountAfterKeyword" value="1" />
105+
<property name="spacesCountBeforeArrow" value="1" />
106+
<property name="spacesCountAfterArrow" value="1" />
107+
</properties>
108+
</rule>
109+
110+
<rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInCall" />
111+
112+
<rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInDeclaration" />
113+
114+
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses" />
115+
116+
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses" />
117+
118+
<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation" />
119+
120+
<rule ref="SlevomatCodingStandard.Operators.NegationOperatorSpacing">
121+
<properties>
122+
<property name="spacesCount" value="0" />
123+
</properties>
124+
</rule>
125+
126+
<rule ref="SlevomatCodingStandard.Operators.SpreadOperatorSpacing">
127+
<properties>
128+
<property name="spacesCount" value="0" />
129+
</properties>
130+
</rule>
131+
132+
<rule ref="SlevomatCodingStandard.PHP.TypeCast" />
133+
134+
<rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints" />
135+
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue" />
136+
<rule ref="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat">
137+
<properties>
138+
<property name="withSpaces" value="no" />
139+
<property name="shortNullable" value="yes" />
140+
<property name="nullPosition" value="last" />
141+
</properties>
142+
</rule>
143+
144+
<rule ref="SlevomatCodingStandard.Whitespaces.DuplicateSpaces" />
145+
146+
<rule ref="Squiz.Commenting.FunctionComment">
147+
<exclude name="Squiz.Commenting.FunctionComment.EmptyThrows" />
148+
<exclude name="Squiz.Commenting.FunctionComment.Missing" />
149+
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment" />
150+
<exclude name="Squiz.Commenting.FunctionComment.IncorrectParamVarName" />
151+
<exclude name="Squiz.Commenting.FunctionComment.IncorrectTypeHint" />
152+
<!-- TODO remove IncorrectTypeHint exclusion when generics support is added -->
153+
<exclude name="Squiz.Commenting.FunctionComment.InvalidReturn" />
154+
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop" />
155+
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentNotCapital" />
156+
<exclude name="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing" />
157+
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamName" />
158+
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamType" />
159+
<exclude name="Squiz.Commenting.FunctionComment.TypeHintMissing" />
160+
161+
<properties>
162+
<property name="skipIfInheritdoc" value="true" />
163+
</properties>
164+
</rule>
165+
166+
<rule ref="Squiz.Commenting.FunctionComment.MissingParamTag">
167+
<exclude-pattern>tests/**/*Test.php</exclude-pattern>
168+
</rule>
169+
170+
<rule ref="Squiz.Commenting.FunctionComment.MissingReturn">
171+
<exclude-pattern>tests/**/*Test.php</exclude-pattern>
172+
</rule>
173+
174+
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
175+
<exclude-pattern>tests/*Test.php</exclude-pattern>
176+
</rule>
177+
178+
<rule ref="Squiz.NamingConventions.ValidVariableName.NotCamelCaps" />
179+
180+
<rule ref="PSR12.Namespaces.CompoundNamespaceDepth">
181+
<properties>
182+
<property name="maxDepth" value="0" />
183+
</properties>
184+
</rule>
185+
186+
<rule ref="PSR12.ControlStructures.BooleanOperatorPlacement">
187+
<properties>
188+
<property name="allowOnly" value="first" />
189+
</properties>
190+
</rule>
191+
192+
<rule ref="SlevomatCodingStandard.ControlStructures.UselessTernaryOperator" />
193+
194+
<rule ref="SlevomatCodingStandard.Namespaces.UselessAlias" />
195+
196+
<rule ref="SlevomatCodingStandard.PHP.ShortList" />
197+
198+
<rule ref="Squiz.Commenting.InlineComment">
199+
<exclude name="Squiz.Commenting.InlineComment.DocBlock" />
200+
<exclude name="Squiz.Commenting.InlineComment.Empty" />
201+
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
202+
<exclude name="Squiz.Commenting.InlineComment.NotCapital" />
203+
</rule>
204+
205+
<rule ref="Squiz.Strings.DoubleQuoteUsage" />
206+
<rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar">
207+
<severity>0</severity>
208+
</rule>
209+
210+
<file>src/</file>
211+
<file>tests/</file>
212+
213+
</ruleset>

phpstan.neon.dist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
parameters:
2+
level: max
3+
paths:
4+
- src
5+
- tests

phpunit.xml.dist

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
cacheDirectory=".phpunit.cache"
6+
executionOrder="depends,defects"
7+
requireCoverageMetadata="true"
8+
beStrictAboutCoverageMetadata="true"
9+
beStrictAboutOutputDuringTests="true"
10+
failOnRisky="true"
11+
failOnWarning="true">
12+
<testsuites>
13+
<testsuite name="default">
14+
<directory>tests</directory>
15+
</testsuite>
16+
</testsuites>
17+
18+
<source restrictDeprecations="true" restrictNotices="true" restrictWarnings="true">
19+
<include>
20+
<directory>src</directory>
21+
</include>
22+
</source>
23+
</phpunit>

src/.gitkeep

Whitespace-only changes.

tests/ExampleTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Tests;
4+
5+
use PHPUnit\Framework\Attributes\CoversNothing;
6+
7+
final class ExampleTest extends TestCase
8+
{
9+
#[CoversNothing]
10+
public function test_example(): void
11+
{
12+
self::assertTrue(true); // @phpstan-ignore-line
13+
}
14+
}

tests/TestCase.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace Tests;
4+
5+
use Orchestra\Testbench\TestCase as BaseTestCase;
6+
7+
abstract class TestCase extends BaseTestCase
8+
{
9+
/**
10+
* Get package providers.
11+
*
12+
* @param \Illuminate\Foundation\Application $app
13+
* @return array<int, class-string>
14+
*/
15+
protected function getPackageProviders($app): array
16+
{
17+
return [];
18+
}
19+
}

0 commit comments

Comments
 (0)