Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
12d34849
Commit
12d34849
authored
Apr 23, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved phpdoc command
parent
83a63f23
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
0 deletions
+44
-0
PhpDocController.php
build/controllers/PhpDocController.php
+43
-0
SyslogTarget.php
framework/log/SyslogTarget.php
+1
-0
No files found.
build/controllers/PhpDocController.php
View file @
12d34849
...
...
@@ -84,6 +84,7 @@ class PhpDocController extends Controller
$lines
=
preg_split
(
'/(\r\n|\n|\r)/'
,
$contents
);
$this
->
fixFileDoc
(
$lines
);
$this
->
fixDocBlockIndentation
(
$lines
);
$newContent
=
implode
(
"
\n
"
,
$lines
);
if
(
$sha
!==
sha1
(
$newContent
))
{
...
...
@@ -194,6 +195,48 @@ class PhpDocController extends Controller
}
}
/**
* Markdown aware fix of whitespace issues in doc comments
*/
protected
function
fixDocBlockIndentation
(
&
$lines
)
{
$docBlock
=
false
;
$codeBlock
=
false
;
$listIndent
=
false
;
$indent
=
''
;
foreach
(
$lines
as
$i
=>
$line
)
{
if
(
preg_match
(
'~^(\s+)/\*\*$~'
,
$line
,
$matches
))
{
$docBlock
=
true
;
$indent
=
$matches
[
1
];
}
elseif
(
preg_match
(
'~^(\s+)\*/~'
,
$line
))
{
$docBlock
=
false
;
$codeBlock
=
false
;
$listIndent
=
''
;
$lines
[
$i
]
=
$indent
.
' */'
;
}
elseif
(
$docBlock
)
{
$docLine
=
trim
(
$line
,
"
\t
*"
);
if
(
empty
(
$docLine
))
{
$listIndent
=
''
;
}
elseif
(
$docLine
[
0
]
===
'@'
)
{
$listIndent
=
''
;
$codeBlock
=
false
;
$docLine
=
preg_replace
(
'/\s+/'
,
' '
,
$docLine
);
}
elseif
(
preg_match
(
'/^(~~~|```)/'
,
$docLine
))
{
$codeBlock
=
!
$codeBlock
;
}
elseif
(
preg_match
(
'/^([0-9]+\.|-|\*|\+) /'
,
$docLine
,
$matches
))
{
$listIndent
=
str_repeat
(
' '
,
strlen
(
$matches
[
0
]));
$lines
[
$i
]
=
$indent
.
' * '
.
$docLine
;
continue
;
}
if
(
$codeBlock
)
{
$lines
[
$i
]
=
rtrim
(
$indent
.
' * '
.
substr
(
ltrim
(
$line
),
2
));
}
else
{
$lines
[
$i
]
=
rtrim
(
$indent
.
' * '
.
$listIndent
.
$docLine
);
}
}
}
}
protected
function
updateClassPropertyDocs
(
$file
,
$className
,
$propertyDoc
)
{
$ref
=
new
\ReflectionClass
(
$className
);
...
...
framework/log/SyslogTarget.php
View file @
12d34849
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment