Skip to content
This repository was archived by the owner on Mar 30, 2022. It is now read-only.
Draft
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
18 changes: 18 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

$finder = PhpCsFixer\Finder::create()
->notPath('src/Symfony/Component/Translation/Tests/fixtures/resources.php')
->in(__DIR__.DIRECTORY_SEPARATOR."src")
;

return PhpCsFixer\Config::create()
->setRules([
'line_ending' => true,
'single_blank_line_at_eof' => true,
'class_attributes_separation' => true,
'single_line_after_imports' => true,
'blank_line_before_statement' => ['statements' => ['return', 'case', 'default', 'foreach']],
])
->setLineEnding("\n")
->setFinder($finder)
;
20 changes: 20 additions & 0 deletions PHP5_TRANSPILATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Transpilation from PHP7 code to PHP5.6

To allow this library to run on PHP5.6 the following process was used:

## 1. Install transpilation library and run transpilation
The library used is: https://packagist.org/packages/janpiet/php-version-transpiler
Note that it requires PHP7 to run.
- `composer global require janpiet/php-version-transpiler:dev-master`
- `php-version-transpiler src src`

## 2. Additional replaces
The following seems to have been skipped by the transpiler library
`find ./src/ -type f -print0 | xargs -0 sed -i -r 's/public const/const/g'`

## 3. Code reformatting
The PHP transpiler uses the Nikic PHP parser and thus does not retain the original formatting of the file.
To reduce unnecessary diffs, we run the code through PHP-CS-Fixer.
Be aware that this is not perfect and will still result in whitespace changes.
- `composer global require friendsofphp/php-cs-fixer`
- `php-cs-fixer fix`
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
}
],
"require": {
"php": "^7.1",
"ext-json": "*"
"php": "^5.6",
"ext-json": "^1.2"
},
"require-dev": {
"phpunit/phpunit": "^7",
"phpunit/phpunit": "^5.7",
"php-coveralls/php-coveralls": "^2"
},
"suggest": {
Expand Down
Loading