Skip to content

Commit b1ff13f

Browse files
committed
build: initial upload
#1
1 parent 2e68572 commit b1ff13f

File tree

6 files changed

+374
-0
lines changed

6 files changed

+374
-0
lines changed

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/.github export-ignore
2+
/tests export-ignore
3+
/docs export-ignore
4+
CHANGELOG.md export-ignore
5+
phpcs.xml export-ignore
6+
phpunit.xml export-ignore
7+
phpmd.xml export-ignore
8+
phpdoc.xml export-ignore
9+
.gitattributes export-ignore
10+
.gitignore export-ignore
11+
.php-cs-fixer.dist.php export-ignore

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
vendor/
2+
coverage/
3+
.vscode/
4+
docs/cache/
5+
composer.phar
6+
composer.lock
7+
composer-test.lock
8+
phpcbf-fixed.diff
9+
.php_cs.cache
10+
php-exception-handler.code-workspace
11+
.repository.md
12+
.phpunit.result.cache
13+
coverage.xml

composer.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"name": "josantonius/exception-handler",
3+
"description": "PHP library for handling exceptions.",
4+
"license": "MIT",
5+
"type": "library",
6+
"keywords": [
7+
"exception",
8+
"exception-handler",
9+
"throw",
10+
"throwable",
11+
"php"
12+
],
13+
"authors": [
14+
{
15+
"name": "Josantonius",
16+
"email": "hello@josantonius.dev",
17+
"homepage": "https://josantonius.dev",
18+
"role": "Developer"
19+
}
20+
],
21+
"support": {
22+
"issues": "https://github.com/josantonius/php-exception-handler/issues",
23+
"source": "https://github.com/josantonius/php-exception-handler",
24+
"discussions": "https://github.com/josantonius/php-exception-handler/discussions"
25+
},
26+
"require": {
27+
"php": "^8.1"
28+
},
29+
"require-dev": {
30+
"phpmd/phpmd": "^2.6",
31+
"phpunit/phpunit": "^9.5",
32+
"squizlabs/php_codesniffer": "^3.7"
33+
},
34+
"minimum-stability": "stable",
35+
"autoload": {
36+
"psr-4": {
37+
"Josantonius\\ExceptionHandler\\": "src/"
38+
}
39+
},
40+
"autoload-dev": {
41+
"psr-4": {
42+
"Josantonius\\ExceptionHandler\\Tests\\": "tests/"
43+
}
44+
},
45+
"config": {
46+
"preferred-install": "dist"
47+
},
48+
"extra": {
49+
"branch-alias": {
50+
"dev-master": "1.0-dev"
51+
}
52+
},
53+
"scripts": {
54+
"coverage": "vendor/bin/phpunit --coverage-clover=coverage.xml",
55+
"fix": [
56+
"vendor/bin/phpcbf src tests"
57+
],
58+
"htmlCoverage": "vendor/bin/phpunit --coverage-html coverage",
59+
"phpcs": "vendor/bin/phpcs --standard=phpcs.xml $(find . -name '*.php');",
60+
"phpmd": "vendor/bin/phpmd src,tests text ./phpmd.xml",
61+
"phpunit": "vendor/bin/phpunit --colors=always;",
62+
"tests": [
63+
"clear",
64+
"@phpmd",
65+
"@phpcs",
66+
"@phpunit"
67+
]
68+
}
69+
}

phpcs.xml

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PSR12">
3+
<description>Coding standard.</description>
4+
<arg name="tab-width" value="4" />
5+
6+
7+
<rule ref="PSR1" />
8+
9+
10+
<rule ref="PSR12" />
11+
12+
13+
<rule ref="Generic.Classes.DuplicateClassName" />
14+
15+
16+
<rule ref="Generic.CodeAnalysis.EmptyStatement" />
17+
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop" />
18+
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall" />
19+
<rule ref="Generic.CodeAnalysis.JumbledIncrementer" />
20+
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement" />
21+
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier" />
22+
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter" />
23+
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod" />
24+
25+
26+
<rule ref="Generic.Commenting.Todo" />
27+
<rule ref="Generic.Commenting.Fixme" />
28+
29+
30+
<rule ref="Generic.ControlStructures.InlineControlStructure" />
31+
32+
33+
<rule ref="Generic.Files.ByteOrderMark" />
34+
<rule ref="Generic.Files.LineEndings">
35+
<properties>
36+
<property name="eolChar" value="\n" />
37+
</properties>
38+
</rule>
39+
<rule ref="Generic.Files.LineLength">
40+
<properties>
41+
<property name="lineLimit" value="100" />
42+
<property name="absoluteLineLimit" value="100" />
43+
</properties>
44+
</rule>
45+
46+
47+
<rule ref="Generic.Formatting.DisallowMultipleStatements" />
48+
<rule ref="Generic.Formatting.MultipleStatementAlignment" />
49+
<rule ref="Generic.Formatting.SpaceAfterCast" />
50+
51+
52+
<rule ref="Generic.Functions.CallTimePassByReference" />
53+
<rule ref="Generic.Functions.FunctionCallArgumentSpacing" />
54+
55+
56+
<rule ref="Generic.Metrics.CyclomaticComplexity">
57+
<properties>
58+
<property name="complexity" value="50" />
59+
<property name="absoluteComplexity" value="100" />
60+
</properties>
61+
</rule>
62+
<rule ref="Generic.Metrics.NestingLevel">
63+
<properties>
64+
<property name="nestingLevel" value="10" />
65+
<property name="absoluteNestingLevel" value="30" />
66+
</properties>
67+
</rule>
68+
69+
70+
<rule ref="Generic.NamingConventions.ConstructorName" />
71+
72+
73+
<rule ref="Generic.PHP.DeprecatedFunctions" />
74+
<rule ref="Generic.PHP.DisallowShortOpenTag" />
75+
<rule ref="Generic.PHP.ForbiddenFunctions" />
76+
<rule ref="Generic.PHP.LowerCaseConstant" />
77+
<rule ref="Generic.PHP.LowerCaseKeyword" />
78+
<rule ref="Generic.PHP.LowerCaseType" />
79+
<rule ref="Generic.PHP.NoSilencedErrors" />
80+
81+
82+
<rule ref="Generic.Strings.UnnecessaryStringConcat" />
83+
84+
85+
<rule ref="Generic.WhiteSpace.DisallowTabIndent" />
86+
<rule ref="Generic.WhiteSpace.IncrementDecrementSpacing" />
87+
<rule ref="Generic.WhiteSpace.ScopeIndent">
88+
<properties>
89+
<property name="indent" value="4" />
90+
<property name="tabIndent" value="true" />
91+
</properties>
92+
</rule>
93+
94+
95+
<rule ref="PEAR.Functions.ValidDefaultValue" />
96+
97+
98+
<rule ref="PSR1.Classes.ClassDeclaration" />
99+
<rule ref="PSR1.Files.SideEffects" />
100+
101+
102+
<rule ref="PSR2.Classes.ClassDeclaration" />
103+
<rule ref="PSR2.Classes.PropertyDeclaration" />
104+
105+
106+
<rule ref="PSR2.ControlStructures.ControlStructureSpacing" />
107+
<rule ref="PSR2.ControlStructures.ElseIfDeclaration" />
108+
<rule ref="PSR2.ControlStructures.SwitchDeclaration" />
109+
110+
111+
<rule ref="PSR2.Files.ClosingTag" />
112+
<rule ref="PSR2.Files.EndFileNewline" />
113+
114+
115+
<rule ref="PSR2.Methods.FunctionCallSignature" />
116+
<rule ref="PSR2.Methods.FunctionCallSignature.OpeningIndent">
117+
<severity>0</severity>
118+
</rule>
119+
<rule ref="PSR2.Methods.FunctionCallSignature.SpaceAfterCloseBracket">
120+
<severity>0</severity>
121+
</rule>
122+
<rule ref="PSR2.Methods.FunctionClosingBrace" />
123+
<rule ref="PSR2.Methods.MethodDeclaration" />
124+
<rule ref="PSR2.Methods.MethodDeclaration.Underscore">
125+
<type>error</type>
126+
<message>Method name "%s" must not be prefixed with an underscore to indicate visibility</message>
127+
</rule>
128+
129+
130+
<rule ref="PSR2.Namespaces.NamespaceDeclaration" />
131+
<rule ref="PSR2.Namespaces.UseDeclaration" />
132+
133+
134+
<rule ref="Squiz.ControlStructures.ControlSignature" />
135+
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration" />
136+
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.AsNotLower">
137+
<severity>0</severity>
138+
</rule>
139+
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen">
140+
<severity>0</severity>
141+
</rule>
142+
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceBeforeClose">
143+
<severity>0</severity>
144+
</rule>
145+
<rule ref="Squiz.ControlStructures.ForLoopDeclaration">
146+
<properties>
147+
<property name="ignoreNewlines" value="true" />
148+
</properties>
149+
</rule>
150+
<rule ref="Squiz.ControlStructures.ForLoopDeclaration.SpacingAfterOpen">
151+
<severity>0</severity>
152+
</rule>
153+
<rule ref="Squiz.ControlStructures.ForLoopDeclaration.SpacingBeforeClose">
154+
<severity>0</severity>
155+
</rule>
156+
<rule ref="Squiz.ControlStructures.LowercaseDeclaration" />
157+
158+
159+
<rule ref="Squiz.Functions.FunctionDeclaration" />
160+
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
161+
<properties>
162+
<property name="equalsSpacing" value="1" />
163+
</properties>
164+
</rule>
165+
<rule ref="Squiz.Functions.LowercaseFunctionKeywords" />
166+
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration" />
167+
168+
169+
<rule ref="Squiz.Scope.MethodScope" />
170+
171+
172+
<rule ref="Squiz.WhiteSpace.CastSpacing" />
173+
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen" />
174+
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" />
175+
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace" />
176+
<rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing" />
177+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace" />
178+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
179+
<severity>0</severity>
180+
</rule>
181+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile">
182+
<severity>0</severity>
183+
</rule>
184+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile">
185+
<severity>0</severity>
186+
</rule>
187+
188+
189+
<rule ref="Zend.Files.ClosingTag" />
190+
191+
192+
<arg name="colors" />
193+
<arg value="spvnl" />
194+
<ini name="memory_limit" value="128M" />
195+
196+
197+
<exclude-pattern>node_modules</exclude-pattern>
198+
<exclude-pattern>vendor</exclude-pattern>
199+
</ruleset>

phpmd.xml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="PHPMD rule set"
3+
xmlns="http://pmd.sf.net/ruleset/1.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0
5+
http://pmd.sf.net/ruleset_xml_schema.xsd" xsi:noNamespaceSchemaLocation="
6+
http://pmd.sf.net/ruleset_xml_schema.xsd">
7+
<description>Coding standard.</description>
8+
9+
<!--Clean Code Rules-->
10+
<rule ref="rulesets/cleancode.xml/BooleanArgumentFlag" />
11+
<rule ref="rulesets/cleancode.xml/ElseExpression" />
12+
<!--<rule ref="rulesets/cleancode.xml/StaticAccess"/>-->
13+
<rule ref="rulesets/cleancode.xml/IfStatementAssignment" />
14+
<rule ref="rulesets/cleancode.xml/DuplicatedArrayKey" />
15+
<rule ref="rulesets/cleancode.xml/MissingImport" />
16+
<rule ref="rulesets/cleancode.xml/UndefinedVariable" />
17+
<rule ref="rulesets/cleancode.xml/ErrorControlOperator" />
18+
19+
<!--Code Size Rules-->
20+
<rule ref="rulesets/codesize.xml/CyclomaticComplexity" />
21+
<rule ref="rulesets/codesize.xml/NPathComplexity" />
22+
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength" />
23+
<rule ref="rulesets/codesize.xml/ExcessiveClassLength" />
24+
<rule ref="rulesets/codesize.xml/ExcessiveParameterList" />
25+
<rule ref="rulesets/codesize.xml/ExcessivePublicCount" />
26+
<rule ref="rulesets/codesize.xml/TooManyFields" />
27+
<rule ref="rulesets/codesize.xml/TooManyMethods" />
28+
<rule ref="rulesets/codesize.xml/TooManyPublicMethods" />
29+
<rule ref="rulesets/codesize.xml/ExcessiveClassComplexity" />
30+
31+
<!--Controversial Rules-->
32+
<rule ref="rulesets/controversial.xml/Superglobals" />
33+
<rule ref="rulesets/controversial.xml/CamelCaseClassName" />
34+
<rule ref="rulesets/controversial.xml/CamelCasePropertyName" />
35+
<rule ref="rulesets/controversial.xml/CamelCaseMethodName" />
36+
<rule ref="rulesets/controversial.xml/CamelCaseParameterName" />
37+
<rule ref="rulesets/controversial.xml/CamelCaseVariableName" />
38+
39+
<!--Design Rules-->
40+
<rule ref="rulesets/design.xml/ExitExpression" />
41+
<rule ref="rulesets/design.xml/EvalExpression" />
42+
<rule ref="rulesets/design.xml/GotoStatement" />
43+
<rule ref="rulesets/design.xml/NumberOfChildren" />
44+
<rule ref="rulesets/design.xml/DepthOfInheritance" />
45+
<rule ref="rulesets/design.xml/CouplingBetweenObjects">
46+
<properties>
47+
<property name="minimum" value="14" />
48+
</properties>
49+
</rule>
50+
<rule ref="rulesets/design.xml/DevelopmentCodeFragment" />
51+
<rule ref="rulesets/design.xml/EmptyCatchBlock" />
52+
<rule ref="rulesets/design.xml/CountInLoopExpression" />
53+
54+
<!--Naming Rules-->
55+
<rule ref="rulesets/naming.xml/LongClassName" />
56+
<rule ref="rulesets/naming.xml/ShortClassName" />
57+
<rule ref="rulesets/naming.xml/ShortVariable" />
58+
<rule ref="rulesets/naming.xml/LongVariable" />
59+
<rule ref="rulesets/naming.xml/ShortMethodName" />
60+
<rule ref="rulesets/naming.xml/ConstructorWithNameAsEnclosingClass" />
61+
<rule ref="rulesets/naming.xml/ConstantNamingConventions" />
62+
<rule ref="rulesets/naming.xml/BooleanGetMethodName" />
63+
64+
<!--Unused Code Rules-->
65+
<rule ref="rulesets/unusedcode.xml/UnusedPrivateField" />
66+
<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable" />
67+
<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod" />
68+
<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter" />
69+
</ruleset>

phpunit.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" bootstrap="vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage>
4+
<include>
5+
<directory>src</directory>
6+
</include>
7+
</coverage>
8+
<testsuites>
9+
<testsuite name="Test Suite">
10+
<directory>tests</directory>
11+
</testsuite>
12+
</testsuites>
13+
</phpunit>

0 commit comments

Comments
 (0)