Skip to content

Commit c20a2fd

Browse files
authored
Merge pull request #3 from PHPOffice/develop
Sync
2 parents fe78542 + af5a271 commit c20a2fd

File tree

450 files changed

+18959
-7927
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

450 files changed

+18959
-7927
lines changed

.gitattributes

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# build config
2+
/.scrutinizer.yml export-ignore
3+
/.travis.yml export-ignore
4+
/php_cs.dist export-ignore
5+
/phpmd.xml.dist export-ignore
6+
/phpstan.neon export-ignore
7+
8+
/composer.lock export-ignore
9+
10+
# git files
11+
/.gitignore export-ignore
12+
/.gitattributes export-ignore
13+
14+
# project directories
15+
/build export-ignore
16+
/docs export-ignore
17+
/samples export-ignore
18+
19+
# tests
20+
/phpunit.xml.dist export-ignore
21+
/tests export-ignore

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@ Thumbs.db
66
Desktop.ini
77
.idea
88
_build
9+
/build
910
phpunit.xml
1011
composer.lock
1112
composer.phar
1213
vendor
1314
/report
15+
/build
1416
/samples/resources
1517
/samples/results
1618
/.settings
1719
phpword.ini
1820
/.buildpath
19-
/.project
21+
/.scannerwork
22+
/.project
23+
/nbproject
24+
/.php_cs.cache

.php_cs.dist

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->notName('pclzip.lib.php')
5+
->notName('OLERead.php')
6+
->in('samples')
7+
->in('src')
8+
->in('tests');
9+
10+
return PhpCsFixer\Config::create()
11+
->setRiskyAllowed(true)
12+
->setFinder($finder)
13+
->setRules(array(
14+
'array_syntax' => array('syntax' => 'long'),
15+
'binary_operator_spaces' => array('align_double_arrow' => true),
16+
'blank_line_after_namespace' => true,
17+
'blank_line_after_opening_tag' => false,
18+
'blank_line_before_return' => true,
19+
'braces' => true,
20+
'cast_spaces' => true,
21+
'class_definition' => true,
22+
'class_keyword_remove' => false, // ::class keyword gives us beter support in IDE
23+
'combine_consecutive_unsets' => true,
24+
'concat_space' => array('spacing' => 'one'),
25+
'declare_equal_normalize' => true,
26+
'declare_strict_types' => false, // Too early to adopt strict types
27+
'dir_constant' => true,
28+
'elseif' => true,
29+
'encoding' => true,
30+
'ereg_to_preg' => true,
31+
'full_opening_tag' => true,
32+
'function_declaration' => true,
33+
'function_typehint_space' => true,
34+
'general_phpdoc_annotation_remove' => false, // No use for that
35+
'hash_to_slash_comment' => true,
36+
'header_comment' => false, // We don't use common header in all our files
37+
'heredoc_to_nowdoc' => false, // Not sure about this one
38+
'is_null' => false, // Risky
39+
'include' => true,
40+
'indentation_type' => true,
41+
'line_ending' => true,
42+
'linebreak_after_opening_tag' => true,
43+
'lowercase_cast' => true,
44+
'lowercase_constants' => true,
45+
'lowercase_keywords' => true,
46+
'mb_str_functions' => false, // No, too dangerous to change that
47+
'method_argument_space' => true,
48+
'method_separation' => true,
49+
'modernize_types_casting' => true,
50+
'native_function_casing' => true,
51+
'native_function_invocation'=> false, // This is risky and seems to be micro-optimization that make code uglier so not worth it, at least for now
52+
'new_with_braces' => true,
53+
'no_alias_functions' => true,
54+
'no_blank_lines_after_class_opening' => true,
55+
'no_blank_lines_after_phpdoc' => true,
56+
'no_blank_lines_before_namespace' => false, // we want 1 blank line before namespace
57+
'no_closing_tag' => true,
58+
'no_empty_comment' => true,
59+
'no_empty_phpdoc' => true,
60+
'no_empty_statement' => true,
61+
'no_extra_consecutive_blank_lines' => array('break', 'continue', 'extra', 'return', 'throw', 'use', 'useTrait', 'curly_brace_block', 'parenthesis_brace_block', 'square_brace_block'),
62+
'no_leading_import_slash' => true,
63+
'no_leading_namespace_whitespace' => true,
64+
'no_mixed_echo_print' => true,
65+
'no_multiline_whitespace_around_double_arrow' => true,
66+
'no_multiline_whitespace_before_semicolons' => true,
67+
'no_php4_constructor' => true,
68+
'no_short_bool_cast' => true,
69+
'no_short_echo_tag' => true,
70+
'no_singleline_whitespace_before_semicolons' => true,
71+
'no_spaces_after_function_name' => true,
72+
'no_spaces_around_offset' => true,
73+
'no_spaces_inside_parenthesis' => true,
74+
'no_trailing_comma_in_list_call' => true,
75+
'no_trailing_comma_in_singleline_array' => true,
76+
'no_trailing_whitespace' => true,
77+
'no_trailing_whitespace_in_comment' => true,
78+
'no_unneeded_control_parentheses' => true,
79+
'no_unreachable_default_argument_value' => true,
80+
'no_unused_imports' => true,
81+
'no_useless_else' => true,
82+
'no_useless_return' => true,
83+
'no_whitespace_before_comma_in_array' => true,
84+
'no_whitespace_in_blank_line' => true,
85+
'normalize_index_brace' => true,
86+
'not_operator_with_space' => false, // No we prefer to keep '!' without spaces
87+
'not_operator_with_successor_space' => false, // idem
88+
'object_operator_without_whitespace' => true,
89+
'ordered_class_elements' => false, // We prefer to keep some freedom
90+
'ordered_imports' => true,
91+
'php_unit_construct' => true,
92+
'php_unit_dedicate_assert' => true,
93+
'php_unit_fqcn_annotation' => true,
94+
'php_unit_strict' => false, // We sometime actually need assertEquals
95+
'phpdoc_add_missing_param_annotation' => true,
96+
'phpdoc_align' => false, // Waste of time
97+
'phpdoc_annotation_without_dot' => true,
98+
'phpdoc_indent' => true,
99+
'phpdoc_inline_tag' => true,
100+
'phpdoc_no_access' => true,
101+
'phpdoc_no_alias_tag' => true,
102+
'phpdoc_no_empty_return' => true,
103+
'phpdoc_no_package' => true,
104+
'phpdoc_no_useless_inheritdoc' => true,
105+
'phpdoc_order' => true,
106+
'phpdoc_return_self_reference' => true,
107+
'phpdoc_scalar' => true,
108+
'phpdoc_separation' => false,
109+
'phpdoc_single_line_var_spacing' => true,
110+
'phpdoc_summary' => false,
111+
'phpdoc_to_comment' => true,
112+
'phpdoc_trim' => true,
113+
'phpdoc_types' => true,
114+
'phpdoc_var_without_name' => true,
115+
'pow_to_exponentiation' => false,
116+
'pre_increment' => false,
117+
'protected_to_private' => true,
118+
'psr0' => true,
119+
'psr4' => true,
120+
'random_api_migration' => false, // This breaks our unit tests
121+
'return_type_declaration' => true,
122+
'self_accessor' => true,
123+
'semicolon_after_instruction' => false, // Buggy in `samples/index.php`
124+
'short_scalar_cast' => true,
125+
'silenced_deprecation_error' => true,
126+
'simplified_null_return' => false, // While technically correct we prefer to be explicit when returning null
127+
'single_blank_line_at_eof' => true,
128+
'single_blank_line_before_namespace' => true,
129+
'single_class_element_per_statement' => true,
130+
'single_import_per_statement' => true,
131+
'single_line_after_imports' => true,
132+
'single_quote' => true,
133+
'space_after_semicolon' => true,
134+
'standardize_not_equals' => true,
135+
'strict_comparison' => false, // No, too dangerous to change that
136+
'strict_param' => false, // No, too dangerous to change that
137+
'switch_case_semicolon_to_colon' => true,
138+
'switch_case_space' => true,
139+
'ternary_operator_spaces' => true,
140+
'ternary_to_null_coalescing' => false, // Cannot use that with PHP 5.6
141+
'trailing_comma_in_multiline_array' => true,
142+
'trim_array_spaces' => false,
143+
'unary_operator_spaces' => true,
144+
'visibility_required' => true,
145+
'whitespace_after_comma_in_array' => true,
146+
));

.scrutinizer.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
build:
2+
nodes:
3+
analysis:
4+
tests:
5+
override: [php-scrutinizer-run]
16
filter:
27
excluded_paths: [ 'vendor/*', 'tests/*', 'samples/*', 'src/PhpWord/Shared/PCLZip/*' ]
38

@@ -14,8 +19,8 @@ tools:
1419
config:
1520
ruleset: phpmd.xml.dist
1621
external_code_coverage:
17-
enabled: true
18-
timeout: 900
22+
enabled: false
23+
timeout: 1200
1924
php_cpd: true
2025
# php_sim: # Temporarily disabled to allow focus on things other than duplicates
2126
# min_mass: 40

.travis.yml

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,36 @@
11
language: php
22

3+
dist: precise
4+
35
php:
46
- 5.3
57
- 5.4
68
- 5.5
79
- 5.6
810
- 7.0
9-
- hhvm
11+
- 7.1
12+
- 7.2
13+
- 7.3
1014

1115
matrix:
12-
allow_failures:
16+
include:
17+
- php: 7.0
18+
env: COVERAGE=1
19+
- php: 5.3
20+
env: COMPOSER_MEMORY_LIMIT=2G
21+
- php: 7.3
22+
env: DEPENDENCIES="--ignore-platform-reqs"
23+
exclude:
24+
- php: 5.3
1325
- php: 7.0
14-
- php: hhvm
26+
- php: 7.3
27+
allow_failures:
28+
- php: 7.3
29+
30+
cache:
31+
directories:
32+
- $HOME/.composer/cache
33+
- .php-cs.cache
1534

1635
env:
1736
global:
@@ -23,28 +42,29 @@ before_install:
2342
- sudo apt-get install -y graphviz
2443

2544
before_script:
45+
## Deactivate xdebug if we don't do code coverage
46+
- if [ -z "$COVERAGE" ]; then phpenv config-rm xdebug.ini || echo "xdebug not available" ; fi
2647
## Composer
2748
- composer self-update
28-
- composer install --prefer-source
49+
- travis_wait composer install --prefer-source $(if [ -n "$DEPENDENCIES" ]; then echo $DEPENDENCIES; fi)
2950
## PHPDocumentor
30-
- mkdir -p build/docs
51+
##- mkdir -p build/docs
3152
- mkdir -p build/coverage
3253

3354
script:
3455
## PHP_CodeSniffer
35-
- ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip
56+
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip ; fi
57+
## PHP-CS-Fixer
58+
- if [ -n "$COVERAGE" ]; then ./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run ; fi
3659
## PHP Mess Detector
37-
- ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php
60+
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php ; fi
3861
## PHPUnit
39-
- ./vendor/bin/phpunit -c ./ --coverage-text --coverage-html ./build/coverage
62+
- ./vendor/bin/phpunit -c ./ $(if [ -n "$COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi)
4063
## PHPLOC
41-
- ./vendor/bin/phploc src/
64+
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phploc src/ ; fi
4265
## PHPDocumentor
43-
- ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig"
66+
##- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" ; fi
4467

45-
after_script:
46-
## PHPDocumentor
47-
- bash .travis_shell_after_success.sh
48-
## Scrutinizer
49-
- wget https://scrutinizer-ci.com/ocular.phar
50-
- php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
68+
after_success:
69+
## Coveralls
70+
- if [ -n "$COVERAGE" ]; then travis_retry php vendor/bin/php-coveralls -v ; fi

.travis_shell_after_success.sh

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

0 commit comments

Comments
 (0)