Skip to content

Commit 07bbec0

Browse files
authored
Merge pull request #3 from Riimu/next
Implement next version changes
2 parents 40f197d + 7703cb6 commit 07bbec0

30 files changed

+268
-172
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ tests export-ignore
77
.gitignore export-ignore
88
.php_cs export-ignore
99
.travis.yml export-ignore
10-
apigen.neon export-ignore
1110
phpunit.xml export-ignore
11+
sami_config.php export-ignore

.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1+
build/
2+
vendor/
13
examples/dbconf.php
2-
api
3-
coverage
4-
vendor
5-
dev
4+
composer.lock

.php_cs

Lines changed: 94 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,101 @@
11
<?php
22

3-
$finder = Symfony\CS\Finder\DefaultFinder::create()
3+
$finder = \PhpCsFixer\Finder::create()
44
->in(__DIR__ . '/src')
55
->in(__DIR__ . '/tests');
66

7-
return Symfony\CS\Config\Config::create()
8-
->fixers([
9-
'align_double_arrow',
10-
'concat_with_spaces',
11-
'ereg_to_preg',
12-
'multiline_spaces_before_semicolon',
13-
'newline_after_open_tag',
14-
'ordered_use',
15-
'php4_constructor',
16-
'php_unit_construct',
17-
'php_unit_strict',
18-
'short_array_syntax',
19-
'strict',
20-
'strict_param',
7+
return \PhpCsFixer\Config::create()
8+
->setRules([
9+
'@PSR2' => true,
2110

22-
'-concat_without_spaces',
23-
'-linefeed',
24-
'-phpdoc_no_empty_return',
25-
'-phpdoc_params',
26-
'-phpdoc_separation',
27-
'-pre_increment',
28-
'-unalign_double_arrow',
29-
'-unary_operators_spaces',
11+
'array_syntax' => [
12+
'syntax' => 'short'
13+
],
14+
'binary_operator_spaces' => [
15+
'align_double_arrow' => null,
16+
'align_equals' => false,
17+
],
18+
'blank_line_after_opening_tag' => true,
19+
'cast_spaces' => true,
20+
'combine_consecutive_unsets' => true,
21+
'concat_space' => [
22+
'spacing' => 'one'
23+
],
24+
'declare_equal_normalize' => true,
25+
'dir_constant' => true,
26+
'ereg_to_preg' => true,
27+
'function_to_constant' => true,
28+
'function_typehint_space' => true,
29+
'hash_to_slash_comment' => true,
30+
'heredoc_to_nowdoc' => true,
31+
'include' => true,
32+
'is_null' => true,
33+
'lowercase_cast' => true,
34+
'magic_constant_casing' => true,
35+
'method_separation' => true,
36+
'modernize_types_casting' => true,
37+
'native_function_casing' => true,
38+
'new_with_braces' => true,
39+
'no_alias_functions' => true,
40+
'no_blank_lines_after_class_opening' => true,
41+
'no_blank_lines_after_phpdoc' => true,
42+
'no_empty_comment' => true,
43+
'no_empty_phpdoc' => true,
44+
'no_empty_statement' => true,
45+
'no_extra_consecutive_blank_lines' => true,
46+
'no_leading_import_slash' => true,
47+
'no_leading_namespace_whitespace' => true,
48+
'no_mixed_echo_print' => true,
49+
'no_multiline_whitespace_around_double_arrow' => true,
50+
'no_multiline_whitespace_before_semicolons' => true,
51+
'no_php4_constructor' => true,
52+
'no_short_bool_cast' => true,
53+
'no_singleline_whitespace_before_semicolons' => true,
54+
'no_spaces_around_offset' => true,
55+
'no_trailing_comma_in_list_call' => true,
56+
'no_trailing_comma_in_singleline_array' => true,
57+
'no_unneeded_control_parentheses' => true,
58+
'no_unused_imports' => true,
59+
'no_useless_return' => true,
60+
'no_whitespace_before_comma_in_array' => true,
61+
'no_whitespace_in_blank_line' => true,
62+
'non_printable_character' => true,
63+
'normalize_index_brace' => true,
64+
'object_operator_without_whitespace' => true,
65+
'ordered_class_elements' => [
66+
'order' => ['use_trait', 'constant', 'property', 'construct', 'method'],
67+
],
68+
'ordered_imports' => true,
69+
'php_unit_construct' => true,
70+
'php_unit_dedicate_assert' => true,
71+
'php_unit_strict' => true,
72+
'phpdoc_add_missing_param_annotation' => true,
73+
'phpdoc_annotation_without_dot' => true,
74+
'phpdoc_indent' => true,
75+
'phpdoc_inline_tag' => true,
76+
'phpdoc_no_access' => true,
77+
'phpdoc_no_alias_tag' => true,
78+
'phpdoc_no_package' => true,
79+
'phpdoc_scalar' => true,
80+
'phpdoc_single_line_var_spacing' => true,
81+
'phpdoc_summary' => true,
82+
'phpdoc_trim' => true,
83+
'phpdoc_types' => true,
84+
'phpdoc_var_without_name' => true,
85+
'pow_to_exponentiation' => true,
86+
'psr4' => true,
87+
'return_type_declaration' => true,
88+
'self_accessor' => true,
89+
'short_scalar_cast' => true,
90+
'single_blank_line_before_namespace' => true,
91+
'single_quote' => true,
92+
'space_after_semicolon' => true,
93+
'standardize_not_equals' => true,
94+
'strict_comparison' => true,
95+
'strict_param' => true,
96+
'ternary_operator_spaces' => true,
97+
'trailing_comma_in_multiline_array' => true,
98+
'trim_array_spaces' => true,
99+
'whitespace_after_comma_in_array' => true,
30100
])
31-
->finder($finder);
101+
->setFinder($finder);

.travis.yml

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,31 @@
11
language: php
22
sudo: false
3+
dist: trusty
34

45
php:
56
- 5.6
6-
- 5.5
7-
- 5.4
87
- 7.0
8+
- 7.1
99
- hhvm
1010

1111
cache:
1212
directories:
13-
- vendor
13+
- vendor
1414

1515
before_install:
16-
- if [[ $TRAVIS_PHP_VERSION =~ ^7 ]]; then phpenv config-rm xdebug.ini; fi
17-
- composer self-update
16+
- export XDEBUG="/home/travis/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini"
17+
- is_hhvm () { [[ $TRAVIS_PHP_VERSION =~ ^hhvm ]]; }
18+
- is_hhvm || mv -v "$XDEBUG" "$XDEBUG.disabled"
1819

1920
install:
20-
- composer require --no-update --no-interaction "phpunit/phpunit:*" "squizlabs/php_codesniffer:*" "fabpot/php-cs-fixer:*"
21-
- travis_retry composer update --no-interaction --prefer-source
21+
- travis_retry composer update -a --no-interaction
2222
- travis_retry wget https://scrutinizer-ci.com/ocular.phar
2323

24-
before_script:
25-
- if [[ $TRAVIS_PHP_VERSION =~ ^hhvm ]]; then echo 'xdebug.enable = On' >> /etc/hhvm/php.ini; fi
26-
2724
script:
28-
- >
29-
if [[ $TRAVIS_PHP_VERSION =~ ^7 ]]; then
30-
phpdbg -qrr vendor/phpunit/phpunit/phpunit --coverage-clover=coverage.clover --coverage-text;
31-
else
32-
vendor/bin/phpunit --coverage-clover=coverage.clover --coverage-text;
33-
fi
3425
- vendor/bin/phpcs --standard=PSR2 src tests
35-
- vendor/bin/php-cs-fixer fix --dry-run --diff
26+
- vendor/bin/php-cs-fixer fix -v --dry-run --allow-risky=yes --using-cache=no
27+
- if is_hhvm; then echo "xdebug.enable = On" >> /etc/hhvm/php.ini; else mv -v "$XDEBUG.disabled" "$XDEBUG"; fi
28+
- vendor/bin/phpunit --coverage-clover=coverage.clover --coverage-text
3629

3730
after_script:
38-
- >
39-
if [[ ! $TRAVIS_PHP_VERSION =~ ^hhvm ]]; then
40-
php ocular.phar code-coverage:upload --format=php-clover coverage.clover;
41-
fi
31+
- is_hhvm || php ocular.phar code-coverage:upload --format=php-clover coverage.clover

CHANGES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog #
22

3+
## v2.2.0 (2017-07-08) ##
4+
5+
* Increase the minimum PHP version requirement to 5.6
6+
* Update to latest coding standards
7+
* Update tests to work with PHPUnit 6
8+
* Update travis build to test for PHP 7.1
9+
310
## v2.1.3 (2015-11-08) ##
411

512
* Ensure the tests run on both HHVM and PHP7

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2013 - 2015 Riikka Kalliomäki
1+
Copyright (c) 2013-2017 Riikka Kalliomäki
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of
44
this software and associated documentation files (the "Software"), to deal in

README.md

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,16 @@ fits in any of your dynamically generated PHP files.
2121
The API documentation, which can be generated using Apigen, can be read online
2222
at: http://kit.riimu.net/api/phpencoder/
2323

24-
[![Build Status](https://img.shields.io/travis/Riimu/Kit-PHPEncoder.svg?style=flat)](https://travis-ci.org/Riimu/Kit-PHPEncoder)
25-
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/Riimu/Kit-PHPEncoder.svg?style=flat)](https://scrutinizer-ci.com/g/Riimu/Kit-PHPEncoder/)
26-
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/Riimu/Kit-PHPEncoder.svg?style=flat)](https://scrutinizer-ci.com/g/Riimu/Kit-PHPEncoder/)
27-
[![HHVM Status](https://img.shields.io/hhvm/riimu/Kit-PHPEncoder.svg)](http://hhvm.h4cc.de/package/riimu/Kit-PHPEncoder)
28-
[![PHP7 Status](https://img.shields.io/badge/PHP7-tested-brightgreen.svg)]()
24+
[![Travis](https://img.shields.io/travis/Riimu/Kit-PHPEncoder.svg?style=flat-square)](https://travis-ci.org/Riimu/Kit-PHPEncoder)
25+
[![Scrutinizer](https://img.shields.io/scrutinizer/g/Riimu/Kit-PHPEncoder.svg?style=flat-square)](https://scrutinizer-ci.com/g/Riimu/Kit-PHPEncoder/)
26+
[![Scrutinizer Coverage](https://img.shields.io/scrutinizer/coverage/g/Riimu/Kit-PHPEncoder.svg?style=flat-square)](https://scrutinizer-ci.com/g/Riimu/Kit-PHPEncoder/)
27+
[![Packagist](https://img.shields.io/packagist/v/riimu/kit-phpencoder.svg?style=flat-square)](https://packagist.org/packages/riimu/kit-phpencoder)
2928

3029
## Requirements ##
3130

3231
In order to use this library, the following requirements must be met:
3332

34-
* PHP version 5.4
33+
* PHP version 5.6
3534

3635
## Installation ##
3736

@@ -245,18 +244,6 @@ apply to following calls.
245244

246245
## Known Issues ##
247246

248-
### Recursive arrays on PHP < 5.4.5 ###
249-
250-
If you try to encode recursive arrays on PHP versions earlier than 5.4.5, you
251-
may encounter the following error (due to the way array comparisons work
252-
internally in PHP):
253-
254-
`Fatal error: Nesting level too deep - recursive dependency?`
255-
256-
In order to fix this, you should disable the recursive array detection by
257-
setting the option `recursion.detect` to false and set a value for the option
258-
`recursion.max` to prevent recursive arrays from causing an infinite loop.
259-
260247
### Float precision on HHVM ###
261248

262249
Note that HHVM does not support the ini setting `serialize_precision`. Thus,
@@ -265,6 +252,6 @@ on HHVM.
265252

266253
## Credits ##
267254

268-
This library is copyright 2013 - 2015 to Riikka Kalliomäki.
255+
This library is Copyright (c) 2013-2017 Riikka Kalliomäki.
269256

270257
See LICENSE for license and copying information.

apigen.neon

Lines changed: 0 additions & 12 deletions
This file was deleted.

composer.json

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,43 @@
11
{
2-
"name": "riimu/kit-phpencoder",
3-
"type": "library",
4-
"description": "Highly customizable alternative to var_export for PHP code generation",
5-
"homepage": "http://kit.riimu.net",
6-
"keywords": ["variable", "export", "code", "generator", "encoder"],
7-
"license": "MIT",
8-
"authors": [
9-
{
10-
"name": "Riikka Kalliomäki",
11-
"email": "riikka.kalliomaki@gmail.com",
12-
"homepage": "http://riimu.net"
13-
}
14-
],
15-
"require": {
16-
"php": ">=5.4.0"
17-
},
18-
"suggest": {
19-
"ext-gmp" : "To convert GMP numbers into PHP code"
20-
},
21-
"autoload": {
22-
"psr-4": {
23-
"Riimu\\Kit\\PHPEncoder\\": "src/"
24-
}
2+
"name": "riimu/kit-phpencoder",
3+
"type": "library",
4+
"description": "Highly customizable alternative to var_export for PHP code generation",
5+
"homepage": "http://kit.riimu.net",
6+
"keywords": [
7+
"variable",
8+
"export",
9+
"code",
10+
"generator",
11+
"encoder"
12+
],
13+
"license": "MIT",
14+
"authors": [
15+
{
16+
"name": "Riikka Kalliomäki",
17+
"email": "riikka.kalliomaki@gmail.com",
18+
"homepage": "http://riimu.net"
2519
}
20+
],
21+
"require": {
22+
"php": ">=5.6.0"
23+
},
24+
"require-dev": {
25+
"phpunit/phpunit": "^5.7 || ^6.2",
26+
"squizlabs/php_codesniffer": "^3.0",
27+
"friendsofphp/php-cs-fixer": "^2.3"
28+
},
29+
"suggest": {
30+
"ext-gmp": "To convert GMP numbers into PHP code"
31+
},
32+
"autoload": {
33+
"psr-4": {
34+
"Riimu\\Kit\\PHPEncoder\\": "src/"
35+
}
36+
},
37+
"autoload-dev": {
38+
"psr-4": {
39+
"Riimu\\Kit\\PHPEncoder\\": "tests/tests/",
40+
"Riimu\\Kit\\PHPEncoder\\Test\\": "tests/extra/"
41+
}
42+
}
2643
}

sami_config.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
use Sami\RemoteRepository\GitHubRemoteRepository;
4+
use Sami\Sami;
5+
use Symfony\Component\Finder\Finder;
6+
7+
$iterator = Finder::create()
8+
->files()
9+
->name('*.php')
10+
->in(__DIR__ . '/src');
11+
12+
$theme = getenv('SAMI_THEME');
13+
$settings = [];
14+
15+
if ($theme) {
16+
$settings['theme'] = basename($theme);
17+
$settings['template_dirs'] = [dirname($theme)];
18+
}
19+
20+
return new Sami($iterator, $settings + [
21+
'title' => 'Kit PHPEncoder API',
22+
'build_dir' => __DIR__ . '/build/doc',
23+
'cache_dir' => __DIR__ . '/build/cache',
24+
'remote_repository' => new GitHubRemoteRepository('Riimu/Kit-PHPEncoder', __DIR__),
25+
'default_opened_level' => 3,
26+
]);

0 commit comments

Comments
 (0)