Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for open source release #9

Merged
merged 1 commit into from
Nov 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "daily"
allow:
- dependency-type: "all"
4 changes: 4 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
template: |
## What’s Changed
$CHANGES
change-title-escapes: '\<*_&#@`'
78 changes: 78 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: "CI"

on:
pull_request:
push:
branches:
- "master"

jobs:
ci:
name: "Execute"
runs-on: ${{ matrix.operating-system }}

strategy:
matrix:
dependencies:
- "lowest"
- "highest"
- "locked"
php-version:
- "7.4"
- "8.0"
- "8.1"
operating-system:
- "ubuntu-latest"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1

- name: "Cache Composer dependencies"
uses: "actions/cache@v2"
with:
path: |
~/.composer/cache
vendor
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"

- name: "Install lowest dependencies"
if: ${{ matrix.dependencies == 'lowest' }}
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest --ansi"

- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update --no-interaction --no-progress --no-suggest --ansi"

- name: "Install locked dependencies"
if: ${{ matrix.dependencies == 'locked' }}
run: "composer install --no-interaction --no-progress --no-suggest --ansi"

- name: "Validate Composer dependencies"
run: "composer validate"

- name: "Run linting"
run: "composer lint"

- name: "Run coding style"
if: ${{ matrix.php-version != '8.1' }} # php-cs-fixer does not run on 8.1 yet
run: "composer code-style:check"

- name: "Run PHPStan"
if: ${{ matrix.dependencies == 'locked' }}
run: "composer phpstan"

- name: "Run Rector"
if: ${{ matrix.dependencies == 'locked' }}
run: "composer rector:check"

- name: "Unit tests"
run: "composer tests:unit"
14 changes: 14 additions & 0 deletions .github/workflows/release-drafting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Release Drafter

on:
push:
branches:
- master

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/bin
!/bin/local-php-security-checker
/vendor
composer.lock
phpunit.xml
/.phpunit.result.cache
119 changes: 119 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<?php

declare(strict_types=1);

$finder = (new PhpCsFixer\Finder())
->in(['lib', 'tests']);

return (new PhpCsFixer\Config())
->setRules([
'@PSR12' => true,
'@PHP70Migration' => true,
'@PHP71Migration' => true,
'@PHP73Migration' => true,
'@PHP74Migration' => true,
'@DoctrineAnnotation' => true,
'align_multiline_comment' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => true,
'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => true,
'cast_spaces' => ['space' => 'single'],
'class_attributes_separation' => true,
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'none'],
'declare_equal_normalize' => ['space' => 'none'],
'declare_strict_types' => true,
'dir_constant' => true,
'ereg_to_preg' => true,
'explicit_indirect_variable' => true,
'explicit_string_variable' => true,
'final_internal_class' => true,
'fully_qualified_strict_types' => true,
'function_to_constant' => true,
'function_typehint_space' => true,
'include' => true,
'is_null' => true,
'linebreak_after_opening_tag' => true,
'list_syntax' => ['syntax' => 'short'],
'lowercase_cast' => true,
'lowercase_static_reference' => true,
'magic_constant_casing' => true,
'magic_method_casing' => true,
'mb_str_functions' => false,
'method_chaining_indentation' => true,
'multiline_comment_opening_closing' => true,
'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'],
'modernize_types_casting' => true,
'native_constant_invocation' => ['scope' => 'all'],
'native_function_casing' => true,
'native_function_invocation' => ['include' => ['@all']],
'new_with_braces' => true,
'no_alias_functions' => true,
'no_alternative_syntax' => true,
'no_binary_string' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_leading_import_slash' => true,
'no_mixed_echo_print' => ['use' => 'echo'],
'no_multiline_whitespace_around_double_arrow' => true,
'no_null_property_initialization' => true,
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_after_function_name' => true,
'no_spaces_around_offset' => true,
'no_spaces_inside_parenthesis' => true,
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => true,
'no_trailing_comma_in_list_call' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_curly_braces' => true,
'no_unneeded_final_method' => true,
'no_unreachable_default_argument_value' => false,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'non_printable_character' => false,
'object_operator_without_whitespace' => true,
'phpdoc_no_access' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_no_package' => true,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_return_self_reference' => true,
'phpdoc_scalar' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_to_comment' => true,
'phpdoc_types' => true,
'phpdoc_var_without_name' => true,
'increment_style' => ['style' => 'post'],
'return_type_declaration' => true,
'semicolon_after_instruction' => true,
'short_scalar_cast' => true,
'single_blank_line_before_namespace' => true,
'single_line_comment_style' => false,
'single_quote' => true,
'space_after_semicolon' => true,
'standardize_not_equals' => true,
'static_lambda' => true,
'strict_comparison' => true,
'strict_param' => true,
'ternary_operator_spaces' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'void_return' => true,
'whitespace_after_comma_in_array' => true,
])
->setRiskyAllowed(true)
->setUsingCache(true)
->setIndent(' ')
->setLineEnding("\n")
->setFinder($finder);
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Lendable Ltd
Copyright (c) 2021 Lendable Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,3 @@ Deserializes a JSON string into an `array`.

Throws `DeserializationFailed` on failure to deserialize.
Throws `InvalidDeserializedData` if the data type of the resulting deserialized data is not an `array`.


58 changes: 55 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,67 @@
}
},
"require": {
"php": ">=7.2",
"php": ">=7.4.0,<8.2.0",
"ext-json": "*"
},
"require-dev": {
"phpunit/phpunit": "^7.5"
"friendsofphp/php-cs-fixer": "^3.3",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpstan/phpstan": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
"phpunit/phpunit": "^9.5",
"rector/rector": "^0.12.4"
},
"config": {
"bin-dir": "bin",
"sort-packages": true
},
"prefer-stable": true
"prefer-stable": true,
"scripts": {
"security:check": [
"local-php-security-checker"
],
"code-style:fix": [
"PHP_CS_FIXER_FUTURE_MODE=1 php-cs-fixer fix --diff --ansi --using-cache=no"
],
"code-style:check": [
"PHP_CS_FIXER_FUTURE_MODE=1 php-cs-fixer fix --dry-run --diff --ansi --using-cache=no"
],
"lint:php": [
"parallel-lint lib",
"parallel-lint tests"
],
"lint": [
"@lint:php"
],
"phpstan": [
"phpstan analyse --memory-limit=-1 lib/ tests/ --ansi --no-progress"
],
"rector:check": [
"rector --dry-run --ansi --no-progress-bar"
],
"rector:fix": [
"rector --ansi --no-progress-bar"
],
"static-analysis": [
"@composer validate",
"@lint",
"@phpstan",
"@rector:check"
],
"phpunit:unit": [
"phpunit --colors --testsuite=unit --do-not-cache-result"
],
"tests:unit": [
"@phpunit:unit"
],
"ci": [
"@security:check",
"@static-analysis",
"@code-style:check",
"@tests:unit"
]
}
}
Loading