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] fix unwanted translation of module name in _fixdcstore_
- [x] add modifier _first upper case_ : _\u_ in _fixphpheader_
- [x] fix whitespace and newline for bloc content in _fixphpheader_
0.0.1
- First pre-release

View file

@ -155,6 +155,8 @@ class ImproveActionPhpheader extends ImproveAction
return null;
}
$bloc = trim(str_replace("\r\n", "\n", $bloc));
try {
$this->bloc = preg_replace_callback(
// use \u in bloc content for first_upper_case
@ -196,7 +198,7 @@ class ImproveActionPhpheader extends ImproveAction
private function deleteDocBloc($content)
{
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",
$content
);