mirror of
https://github.com/danog/psalm-plugin.git
synced 2024-11-30 04:39:05 +01:00
Initial commit
This commit is contained in:
commit
cd223caa18
17
.editorconfig
Normal file
17
.editorconfig
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# editorconfig.org
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[*.yml]
|
||||||
|
indent_size = 2
|
40
.gitattributes
vendored
Normal file
40
.gitattributes
vendored
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# Autodetect text files
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
# ...Unless the name matches the following overriding patterns
|
||||||
|
|
||||||
|
# Definitively text files
|
||||||
|
*.php text
|
||||||
|
*.css text
|
||||||
|
*.js text
|
||||||
|
*.txt text
|
||||||
|
*.md text
|
||||||
|
*.xml text
|
||||||
|
*.json text
|
||||||
|
*.bat text
|
||||||
|
*.sql text
|
||||||
|
*.yml text
|
||||||
|
|
||||||
|
# Ensure those won't be messed up with
|
||||||
|
*.png binary
|
||||||
|
*.jpg binary
|
||||||
|
*.gif binary
|
||||||
|
*.ttf binary
|
||||||
|
|
||||||
|
# Ignore some meta files when creating an archive of this repository
|
||||||
|
/.github export-ignore
|
||||||
|
/.editorconfig export-ignore
|
||||||
|
/.gitattributes export-ignore
|
||||||
|
/.gitignore export-ignore
|
||||||
|
/.scrutinizer.yml export-ignore
|
||||||
|
/phpunit.xml.dist export-ignore
|
||||||
|
/psalm.xml export-ignore
|
||||||
|
/.phpcs.xml export-ignore
|
||||||
|
/.php_cs.dist export-ignore
|
||||||
|
/tests export-ignore
|
||||||
|
/docs export-ignore
|
||||||
|
|
||||||
|
# Avoid merge conflicts in CHANGELOG
|
||||||
|
# https://about.gitlab.com/2015/02/10/gitlab-reduced-merge-conflicts-by-90-percent-with-changelog-placeholders/
|
||||||
|
/CHANGELOG.md merge=union
|
||||||
|
|
25
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
25
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: 'Type: Bug'
|
||||||
|
assignees: azjezz
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Code to reproduce the behavior:
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Environment (please complete the following information):**
|
||||||
|
- OS: [e.g. iOS, Ubuntu]
|
||||||
|
- PHP version [e.g. 7.4, 8.0]
|
||||||
|
- Version [e.g. 22]
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: 'Type: Enhancement'
|
||||||
|
assignees: azjezz
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
36
.github/workflows/code-coverage.yml
vendored
Normal file
36
.github/workflows/code-coverage.yml
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
name: "code coverage"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request: ~
|
||||||
|
push: ~
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
code-coverage:
|
||||||
|
name: "code coverage"
|
||||||
|
|
||||||
|
runs-on: "ubuntu-latest"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: "checkout"
|
||||||
|
uses: "actions/checkout@v2"
|
||||||
|
|
||||||
|
- name: "installing PHP"
|
||||||
|
uses: "shivammathur/setup-php@v2"
|
||||||
|
with:
|
||||||
|
php-version: "8.0"
|
||||||
|
ini-values: memory_limit=-1
|
||||||
|
tools: composer:v2, cs2pr
|
||||||
|
extensions: bcmath, mbstring, intl, sodium, json
|
||||||
|
|
||||||
|
- name: "installing dependencies"
|
||||||
|
run: "composer install --no-interaction --no-progress --ignore-platform-req php"
|
||||||
|
|
||||||
|
- name: "running unit tests ( phpunit )"
|
||||||
|
run: "php vendor/bin/phpunit"
|
||||||
|
|
||||||
|
- name: "sending code coverage to coveralls"
|
||||||
|
env:
|
||||||
|
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
composer global require php-coveralls/php-coveralls
|
||||||
|
php-coveralls -x tests/logs/clover.xml -o tests/logs/coveralls-upload.json -v
|
30
.github/workflows/coding-standards.yml
vendored
Normal file
30
.github/workflows/coding-standards.yml
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
name: "coding standards"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request: ~
|
||||||
|
push: ~
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
coding-standards:
|
||||||
|
name: "coding standards"
|
||||||
|
runs-on: "ubuntu-latest"
|
||||||
|
steps:
|
||||||
|
- name: "checkout"
|
||||||
|
uses: "actions/checkout@v2"
|
||||||
|
|
||||||
|
- name: "installing PHP"
|
||||||
|
uses: "shivammathur/setup-php@v2"
|
||||||
|
with:
|
||||||
|
php-version: "7.4"
|
||||||
|
ini-values: memory_limit=-1
|
||||||
|
tools: composer:v2, cs2pr
|
||||||
|
extensions: bcmath, mbstring, intl, sodium, json
|
||||||
|
|
||||||
|
- name: "installing dependencies"
|
||||||
|
run: "composer update --no-interaction --no-progress"
|
||||||
|
|
||||||
|
- name: "checking coding standards ( codesniffer )"
|
||||||
|
run: "php vendor/bin/phpcs"
|
||||||
|
|
||||||
|
- name: "checking coding standards ( php-cs-fixer )"
|
||||||
|
run: "php vendor/bin/php-cs-fixer fix --dry-run --diff --ansi"
|
27
.github/workflows/security-analysis.yml
vendored
Normal file
27
.github/workflows/security-analysis.yml
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
name: "security analysis"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request: ~
|
||||||
|
push: ~
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
security-analysis:
|
||||||
|
name: "security analysis"
|
||||||
|
runs-on: "ubuntu-latest"
|
||||||
|
steps:
|
||||||
|
- name: "checkout"
|
||||||
|
uses: "actions/checkout@v2"
|
||||||
|
|
||||||
|
- name: "installing PHP"
|
||||||
|
uses: "shivammathur/setup-php@v2"
|
||||||
|
with:
|
||||||
|
php-version: "7.4"
|
||||||
|
ini-values: memory_limit=-1
|
||||||
|
tools: composer:v2, cs2pr
|
||||||
|
extensions: bcmath, mbstring, intl, sodium, json
|
||||||
|
|
||||||
|
- name: "installing dependencies"
|
||||||
|
run: "composer update --no-interaction --no-progress"
|
||||||
|
|
||||||
|
- name: "running security analysis ( psalm )"
|
||||||
|
run: "vendor/bin/psalm --output-format=github --taint-analysis"
|
29
.github/workflows/static-analysis.yml
vendored
Normal file
29
.github/workflows/static-analysis.yml
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
name: "static analysis"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request: ~
|
||||||
|
push: ~
|
||||||
|
schedule:
|
||||||
|
- cron: '0 */3 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
static-analysis:
|
||||||
|
name: "static analysis"
|
||||||
|
runs-on: "ubuntu-latest"
|
||||||
|
steps:
|
||||||
|
- name: "checkout"
|
||||||
|
uses: "actions/checkout@v2"
|
||||||
|
|
||||||
|
- name: "installing PHP"
|
||||||
|
uses: "shivammathur/setup-php@v2"
|
||||||
|
with:
|
||||||
|
php-version: "7.4"
|
||||||
|
ini-values: memory_limit=-1
|
||||||
|
tools: composer:v2, cs2pr
|
||||||
|
extensions: bcmath, mbstring, intl, sodium, json
|
||||||
|
|
||||||
|
- name: "installing dependencies"
|
||||||
|
run: "composer update --no-interaction --no-progress"
|
||||||
|
|
||||||
|
- name: "running static analysis ( psalm )"
|
||||||
|
run: "vendor/bin/psalm --shepherd --stats"
|
48
.github/workflows/unit-tests.yml
vendored
Normal file
48
.github/workflows/unit-tests.yml
vendored
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
name: "unit tests"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request: ~
|
||||||
|
push: ~
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
unit-tests:
|
||||||
|
name: "unit tests"
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.operating-system }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
php-version:
|
||||||
|
- "7.4"
|
||||||
|
- "8.0"
|
||||||
|
operating-system:
|
||||||
|
- "macos-latest"
|
||||||
|
- "ubuntu-latest"
|
||||||
|
- "windows-latest"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: "checkout"
|
||||||
|
uses: "actions/checkout@v2"
|
||||||
|
|
||||||
|
- name: "installing PHP"
|
||||||
|
uses: "shivammathur/setup-php@v2"
|
||||||
|
with:
|
||||||
|
php-version: "${{ matrix.php-version }}"
|
||||||
|
ini-values: memory_limit=-1
|
||||||
|
tools: composer:v2, cs2pr
|
||||||
|
extensions: bcmath, mbstring, intl, sodium, json
|
||||||
|
|
||||||
|
- name: "caching dependencies"
|
||||||
|
uses: "actions/cache@v2"
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.composer/cache
|
||||||
|
vendor
|
||||||
|
key: "php-${{ matrix.php-version }}"
|
||||||
|
restore-keys: "php-${{ matrix.php-version }}"
|
||||||
|
|
||||||
|
- name: "installing dependencies"
|
||||||
|
run: "composer install --no-interaction --no-progress --ignore-platform-req php"
|
||||||
|
|
||||||
|
- name: "running unit tests ( phpunit )"
|
||||||
|
run: "php vendor/bin/phpunit"
|
23
.gitignore
vendored
Normal file
23
.gitignore
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# phpstorm project files
|
||||||
|
.idea
|
||||||
|
|
||||||
|
# vs code project files
|
||||||
|
.vscode
|
||||||
|
|
||||||
|
# composer vendor dir
|
||||||
|
/vendor/
|
||||||
|
|
||||||
|
# composer lock file
|
||||||
|
/composer.lock
|
||||||
|
|
||||||
|
# Mac DS_Store files
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# php-cs-fixer cache
|
||||||
|
.php_cs.cache
|
||||||
|
|
||||||
|
# phpunit cache
|
||||||
|
.phpunit.result.cache
|
||||||
|
|
||||||
|
# test logs
|
||||||
|
/tests/logs/*
|
82
.php_cs.dist
Normal file
82
.php_cs.dist
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return PhpCsFixer\Config::create()
|
||||||
|
->setFinder(
|
||||||
|
\Symfony\Component\Finder\Finder::create()
|
||||||
|
->in([
|
||||||
|
__DIR__ . '/src',
|
||||||
|
__DIR__ . '/tests',
|
||||||
|
])
|
||||||
|
)
|
||||||
|
->setRiskyAllowed(true)
|
||||||
|
->setRules([
|
||||||
|
'align_multiline_comment' => true,
|
||||||
|
'array_indentation' => true,
|
||||||
|
'declare_strict_types' => true,
|
||||||
|
// Currently it is not possible to mark all classes as final (exceptions etc.)
|
||||||
|
// We can run this fixer periodically on the tests folder only.
|
||||||
|
// 'final_class' => true,
|
||||||
|
'global_namespace_import' => [
|
||||||
|
'import_classes' => true,
|
||||||
|
'import_constants' => true,
|
||||||
|
'import_functions' => true,
|
||||||
|
],
|
||||||
|
'list_syntax' => [
|
||||||
|
'syntax' => 'short',
|
||||||
|
],
|
||||||
|
'lowercase_constants' => true,
|
||||||
|
'multiline_comment_opening_closing' => true,
|
||||||
|
'native_function_casing' => true,
|
||||||
|
'no_empty_phpdoc' => true,
|
||||||
|
'no_leading_import_slash' => true,
|
||||||
|
'no_superfluous_phpdoc_tags' => [
|
||||||
|
'allow_mixed' => true,
|
||||||
|
],
|
||||||
|
'no_unused_imports' => true,
|
||||||
|
'no_useless_else' => true,
|
||||||
|
'no_useless_return' => true,
|
||||||
|
'ordered_imports' => [
|
||||||
|
'imports_order' => ['class', 'function', 'const'],
|
||||||
|
],
|
||||||
|
'ordered_interfaces' => true,
|
||||||
|
'php_unit_test_annotation' => true,
|
||||||
|
'php_unit_test_case_static_method_calls' => [
|
||||||
|
'call_type' => 'static',
|
||||||
|
],
|
||||||
|
'single_import_per_statement' => true,
|
||||||
|
'single_trait_insert_per_statement' => true,
|
||||||
|
'static_lambda' => true,
|
||||||
|
'strict_comparison' => true,
|
||||||
|
'strict_param' => true,
|
||||||
|
'no_blank_lines_after_phpdoc' => true,
|
||||||
|
'no_empty_phpdoc' => true,
|
||||||
|
'phpdoc_align' => [
|
||||||
|
'align' => 'left',
|
||||||
|
],
|
||||||
|
'phpdoc_indent' => true,
|
||||||
|
'phpdoc_line_span' => [
|
||||||
|
'const' => 'multi',
|
||||||
|
'property' => 'multi',
|
||||||
|
'method' => 'multi',
|
||||||
|
],
|
||||||
|
'phpdoc_no_alias_tag' => [
|
||||||
|
'replacements' => [
|
||||||
|
'psalm-var' => 'var',
|
||||||
|
'psalm-template' => 'template',
|
||||||
|
'psalm-param' => 'param',
|
||||||
|
'psalm-return' => 'return',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'phpdoc_order' => true,
|
||||||
|
'phpdoc_scalar' => true,
|
||||||
|
'phpdoc_separation' => true,
|
||||||
|
'phpdoc_summary' => true,
|
||||||
|
'phpdoc_tag_casing' => true,
|
||||||
|
'phpdoc_trim' => true,
|
||||||
|
'phpdoc_trim_consecutive_blank_line_separation' => true,
|
||||||
|
'no_empty_statement' => true,
|
||||||
|
'semicolon_after_instruction' => true,
|
||||||
|
'declare_strict_types' => true,
|
||||||
|
'strict_param' => true,
|
||||||
|
])
|
||||||
|
;
|
43
.phpcs.xml
Normal file
43
.phpcs.xml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PSL"
|
||||||
|
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
|
||||||
|
<description>The coding standard for PHP Standard Library.</description>
|
||||||
|
|
||||||
|
<file>src</file>
|
||||||
|
<file>tests</file>
|
||||||
|
|
||||||
|
<arg name="basepath" value="."/>
|
||||||
|
<arg name="colors"/>
|
||||||
|
<arg name="parallel" value="75"/>
|
||||||
|
|
||||||
|
<rule ref="PSR1">
|
||||||
|
<type>error</type>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<rule ref="PSR2">
|
||||||
|
<type>error</type>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<rule ref="PSR12">
|
||||||
|
<type>error</type>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<!-- Don't hide tokenizer exceptions -->
|
||||||
|
<rule ref="Internal.Tokenizer.Exception">
|
||||||
|
<type>error</type>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<!-- Ban some functions -->
|
||||||
|
<rule ref="Generic.PHP.ForbiddenFunctions">
|
||||||
|
<properties>
|
||||||
|
<property name="forbiddenFunctions" type="array">
|
||||||
|
<element key="sizeof" value="count"/>
|
||||||
|
<element key="delete" value="unset"/>
|
||||||
|
<element key="print" value="echo"/>
|
||||||
|
<element key="is_null" value="null"/>
|
||||||
|
<element key="create_function" value="null"/>
|
||||||
|
<element key="assert" value="Psl\invariant"/>
|
||||||
|
</property>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
</ruleset>
|
5
CHANGELOG.md
Normal file
5
CHANGELOG.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# php-standard-library/repository-template changelog
|
||||||
|
|
||||||
|
## 1.0.0
|
||||||
|
|
||||||
|
- initial release.
|
76
CODE_OF_CONDUCT.md
Normal file
76
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
In the interest of fostering an open and welcoming environment, we as
|
||||||
|
contributors and maintainers pledge to making participation in our project and
|
||||||
|
our community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||||
|
level of experience, education, socio-economic status, nationality, personal
|
||||||
|
appearance, race, religion, or sexual identity and orientation.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to creating a positive environment
|
||||||
|
include:
|
||||||
|
|
||||||
|
* Using welcoming and inclusive language
|
||||||
|
* Being respectful of differing viewpoints and experiences
|
||||||
|
* Gracefully accepting constructive criticism
|
||||||
|
* Focusing on what is best for the community
|
||||||
|
* Showing empathy towards other community members
|
||||||
|
|
||||||
|
Examples of unacceptable behavior by participants include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||||
|
advances
|
||||||
|
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing others' private information, such as a physical or electronic
|
||||||
|
address, without explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
## Our Responsibilities
|
||||||
|
|
||||||
|
Project maintainers are responsible for clarifying the standards of acceptable
|
||||||
|
behavior and are expected to take appropriate and fair corrective action in
|
||||||
|
response to any instances of unacceptable behavior.
|
||||||
|
|
||||||
|
Project maintainers have the right and responsibility to remove, edit, or
|
||||||
|
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||||
|
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||||
|
permanently any contributor for other behaviors that they deem inappropriate,
|
||||||
|
threatening, offensive, or harmful.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies both within project spaces and in public spaces
|
||||||
|
when an individual is representing the project or its community. Examples of
|
||||||
|
representing a project or community include using an official project e-mail
|
||||||
|
address, posting via an official social media account, or acting as an appointed
|
||||||
|
representative at an online or offline event. Representation of a project may be
|
||||||
|
further defined and clarified by project maintainers.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported by contacting the project team at azjezz@protonmail.com. All
|
||||||
|
complaints will be reviewed and investigated and will result in a response that
|
||||||
|
is deemed necessary and appropriate to the circumstances. The project team is
|
||||||
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||||
|
Further details of specific enforcement policies may be posted separately.
|
||||||
|
|
||||||
|
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||||
|
faith may face temporary or permanent repercussions as determined by other
|
||||||
|
members of the project's leadership.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||||
|
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see
|
||||||
|
https://www.contributor-covenant.org/faq
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2019-2020 Saif Eddin Gmati <azjezz@protonmail.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
21
README.md
Normal file
21
README.md
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Repository Template
|
||||||
|
|
||||||
|
![Unit tests status](https://github.com/php-standard-library/repository-template/workflows/unit%20tests/badge.svg)
|
||||||
|
![Static analysis status](https://github.com/php-standard-library/repository-template/workflows/static%20analysis/badge.svg)
|
||||||
|
![Security analysis status](https://github.com/php-standard-library/repository-template/workflows/security%20analysis/badge.svg)
|
||||||
|
![Coding standards status](https://github.com/php-standard-library/repository-template/workflows/coding%20standards/badge.svg)
|
||||||
|
[![Type Coverage](https://shepherd.dev/github/php-standard-library/repository-template/coverage.svg)](https://shepherd.dev/github/php-standard-library/repository-template)
|
||||||
|
|
||||||
|
## Sponsors
|
||||||
|
|
||||||
|
Thanks to our sponsors and supporters:
|
||||||
|
|
||||||
|
|
||||||
|
| JetBrains |
|
||||||
|
|---|
|
||||||
|
| <a href="https://www.jetbrains.com/?from=PSL ( PHP Standard Library )" title="JetBrains" target="_blank"><img src="https://res.cloudinary.com/azjezz/image/upload/v1599239910/jetbrains_qnyb0o.png" height="120" /></a> |
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
The MIT License (MIT). Please see [`LICENSE`](./LICENSE) for more information.
|
7
SECURITY.md
Normal file
7
SECURITY.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Security
|
||||||
|
|
||||||
|
If you discover a security vulnerability within PSL, please send an e-mail to Saif Eddin Gmati via azjezz@protonmail.com.
|
||||||
|
|
||||||
|
Please withhold public disclosure until after we have addressed the vulnerability.
|
||||||
|
|
||||||
|
There are no hard and fast rules to determine if a bug is worth reporting as a security issue.
|
63
composer.json
Normal file
63
composer.json
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
"name": "php-standard-library/repository-template",
|
||||||
|
"description": "PHP Standard Library: Repository Template",
|
||||||
|
"type": "library",
|
||||||
|
"license": "MIT",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "azjezz",
|
||||||
|
"email": "azjezz@protonmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"require": {
|
||||||
|
"php": "^7.4 || ^8.0",
|
||||||
|
"azjezz/psl": "^1.5",
|
||||||
|
"ext-bcmath": "*",
|
||||||
|
"ext-json": "*",
|
||||||
|
"ext-mbstring": "*",
|
||||||
|
"ext-sodium": "*",
|
||||||
|
"ext-intl": "*"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^9.5",
|
||||||
|
"friendsofphp/php-cs-fixer": "^2.18",
|
||||||
|
"roave/security-advisories": "dev-master",
|
||||||
|
"squizlabs/php_codesniffer": "^3.5",
|
||||||
|
"vimeo/psalm": "dev-master"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Psl\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"Psl\\Tests\\": "tests/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"cs:fix": [
|
||||||
|
"phpcbf",
|
||||||
|
"php-cs-fixer fix"
|
||||||
|
],
|
||||||
|
"cs:check": [
|
||||||
|
"phpcs",
|
||||||
|
"php-cs-fixer fix --dry-run"
|
||||||
|
],
|
||||||
|
"type:check": "psalm",
|
||||||
|
"type:coverage": "psalm --shepherd",
|
||||||
|
"test:unit": "phpunit",
|
||||||
|
"code:coverage": "php-coveralls -v",
|
||||||
|
"security:analysis": "psalm --taint-analysis",
|
||||||
|
"check": [
|
||||||
|
"@cs:check",
|
||||||
|
"@type:check",
|
||||||
|
"@security:analysis",
|
||||||
|
"@test:unit"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"process-timeout": 1200,
|
||||||
|
"sort-packages": true
|
||||||
|
}
|
||||||
|
}
|
21
phpunit.xml.dist
Normal file
21
phpunit.xml.dist
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
|
||||||
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" colors="true" stopOnFailure="true" bootstrap="vendor/autoload.php">
|
||||||
|
<coverage processUncoveredFiles="true">
|
||||||
|
<include>
|
||||||
|
<directory>src</directory>
|
||||||
|
</include>
|
||||||
|
<report>
|
||||||
|
<clover outputFile="tests/logs/clover.xml" />
|
||||||
|
</report>
|
||||||
|
</coverage>
|
||||||
|
<php>
|
||||||
|
<ini name="error_reporting" value="-1" />
|
||||||
|
</php>
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="PHP Standard Library">
|
||||||
|
<directory>tests/</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
<logging />
|
||||||
|
</phpunit>
|
48
psalm.xml
Normal file
48
psalm.xml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<psalm totallyTyped="true" resolveFromConfigFile="true" forbidEcho="true" strictBinaryOperands="true" phpVersion="7.4" allowPhpStormGenerics="true" allowStringToStandInForClass="true" rememberPropertyAssignmentsAfterCall="false" skipChecksOnUnresolvableIncludes="false" checkForThrowsDocblock="true" checkForThrowsInGlobalScope="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd">
|
||||||
|
<projectFiles>
|
||||||
|
<directory name="src" />
|
||||||
|
<ignoreFiles>
|
||||||
|
<directory name="vendor" />
|
||||||
|
</ignoreFiles>
|
||||||
|
</projectFiles>
|
||||||
|
|
||||||
|
<issueHandlers>
|
||||||
|
<DuplicateFunction errorLevel="suppress" />
|
||||||
|
|
||||||
|
<LessSpecificReturnType errorLevel="error" />
|
||||||
|
<DeprecatedMethod errorLevel="error" />
|
||||||
|
<DeprecatedProperty errorLevel="error" />
|
||||||
|
<DeprecatedClass errorLevel="error" />
|
||||||
|
<DeprecatedConstant errorLevel="error" />
|
||||||
|
<DeprecatedInterface errorLevel="error" />
|
||||||
|
<DeprecatedTrait errorLevel="error" />
|
||||||
|
<ForbiddenCode errorLevel="error" />
|
||||||
|
<InternalMethod errorLevel="error" />
|
||||||
|
<InternalProperty errorLevel="error" />
|
||||||
|
<InternalClass errorLevel="error" />
|
||||||
|
<MissingClosureReturnType errorLevel="error" />
|
||||||
|
<MissingReturnType errorLevel="error" />
|
||||||
|
<MissingPropertyType errorLevel="error" />
|
||||||
|
<InvalidDocblock errorLevel="error" />
|
||||||
|
<PropertyNotSetInConstructor errorLevel="error" />
|
||||||
|
<MissingConstructor errorLevel="error" />
|
||||||
|
<MissingClosureParamType errorLevel="error" />
|
||||||
|
<MissingParamType errorLevel="error" />
|
||||||
|
<DocblockTypeContradiction errorLevel="error" />
|
||||||
|
<RawObjectIteration errorLevel="error" />
|
||||||
|
<InvalidStringClass errorLevel="error" />
|
||||||
|
<UnresolvableInclude errorLevel="error" />
|
||||||
|
|
||||||
|
<!-- Redundant expressions should not be considered errors. -->
|
||||||
|
<!-- Sometimes we want to enforce things at runtime, as well using static analysis -->
|
||||||
|
<RedundantConditionGivenDocblockType errorLevel="suppress" />
|
||||||
|
<RedundantCondition errorLevel="suppress" />
|
||||||
|
<RedundantCast errorLevel="suppress" />
|
||||||
|
<RedundantCastGivenDocblockType errorLevel="suppress" />
|
||||||
|
</issueHandlers>
|
||||||
|
|
||||||
|
<plugins>
|
||||||
|
<pluginClass class="Psl\Integration\Psalm\Plugin" />
|
||||||
|
</plugins>
|
||||||
|
</psalm>
|
0
src/.gitkeep
Normal file
0
src/.gitkeep
Normal file
0
tests/.gitkeep
Normal file
0
tests/.gitkeep
Normal file
Loading…
Reference in New Issue
Block a user