fix whitespace and newline for bloc content in _fixphpheader_

This commit is contained in:
Jean-Christian Denis 2021-09-11 00:07:43 +02:00
parent 99638fcd92
commit 02949af33a
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
2 changed files with 4 additions and 1 deletions

View file

@ -4,6 +4,7 @@
- [x] use _requires_ or dc_min in _fixdcstore_ - [x] use _requires_ or dc_min in _fixdcstore_
- [x] fix unwanted translation of module name in _fixdcstore_ - [x] fix unwanted translation of module name in _fixdcstore_
- [x] add modifier _first upper case_ : _\u_ in _fixphpheader_ - [x] add modifier _first upper case_ : _\u_ in _fixphpheader_
- [x] fix whitespace and newline for bloc content in _fixphpheader_
0.0.1 0.0.1
- First pre-release - First pre-release

View file

@ -155,6 +155,8 @@ class ImproveActionPhpheader extends ImproveAction
return null; return null;
} }
$bloc = trim(str_replace("\r\n", "\n", $bloc));
try { try {
$this->bloc = preg_replace_callback( $this->bloc = preg_replace_callback(
// use \u in bloc content for first_upper_case // use \u in bloc content for first_upper_case
@ -196,7 +198,7 @@ class ImproveActionPhpheader extends ImproveAction
private function deleteDocBloc($content) private function deleteDocBloc($content)
{ {
return preg_replace( return preg_replace(
'/^(\<\?php[\n|\r\n]{0,1}\/\*\*.*?\s*\*\/\s*[\n|\r\n]+)/msi', '/^(\<\?php\s*[\n|\r\n]{0,1}\s*\/\*\*.*?\s*\*\/\s*[\n|\r\n]+)/msi',
"<?php\n", "<?php\n",
$content $content
); );