Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
2242f4ad
Commit
2242f4ad
authored
Sep 17, 2017
by
xjm
Browse files
Issue
#2901785
by mfernea, xjm, andriyun: Fix 'Generic.Formatting.SpaceAfterCast' coding standard
parent
aa7c4ab0
Changes
19
Hide whitespace changes
Inline
Side-by-side
core/lib/Drupal/Component/Utility/Number.php
View file @
2242f4ad
...
...
@@ -50,7 +50,7 @@ public static function validStep($value, $step, $offset = 0.0) {
// can't be represented with single precision floats are acceptable. The
// fractional part of a float has 24 bits. That means remainders smaller than
// $step * 2^-24 are acceptable.
$computed_acceptable_error
=
(
double
)(
$step
/
pow
(
2.0
,
24
));
$computed_acceptable_error
=
(
double
)
(
$step
/
pow
(
2.0
,
24
));
return
$computed_acceptable_error
>=
$remainder
||
$remainder
>=
(
$step
-
$computed_acceptable_error
);
}
...
...
core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php
View file @
2242f4ad
...
...
@@ -66,7 +66,7 @@ public function execute() {
// used twice. However, trying to insert a value into a serial
// column should only be done in very rare cases and is not thread
// safe by definition.
$this
->
connection
->
query
(
"SELECT setval('"
.
$table_information
->
sequences
[
$index
]
.
"', GREATEST(MAX("
.
$serial_field
.
"), :serial_value)) FROM {"
.
$this
->
table
.
"}"
,
[
':serial_value'
=>
(
int
)
$serial_value
]);
$this
->
connection
->
query
(
"SELECT setval('"
.
$table_information
->
sequences
[
$index
]
.
"', GREATEST(MAX("
.
$serial_field
.
"), :serial_value)) FROM {"
.
$this
->
table
.
"}"
,
[
':serial_value'
=>
(
int
)
$serial_value
]);
}
}
}
...
...
core/lib/Drupal/Core/Database/Driver/pgsql/NativeUpsert.php
View file @
2242f4ad
...
...
@@ -60,7 +60,7 @@ public function execute() {
// used twice. However, trying to insert a value into a serial
// column should only be done in very rare cases and is not thread
// safe by definition.
$this
->
connection
->
query
(
"SELECT setval('"
.
$table_information
->
sequences
[
$index
]
.
"', GREATEST(MAX("
.
$serial_field
.
"), :serial_value)) FROM {"
.
$this
->
table
.
"}"
,
[
':serial_value'
=>
(
int
)
$serial_value
]);
$this
->
connection
->
query
(
"SELECT setval('"
.
$table_information
->
sequences
[
$index
]
.
"', GREATEST(MAX("
.
$serial_field
.
"), :serial_value)) FROM {"
.
$this
->
table
.
"}"
,
[
':serial_value'
=>
(
int
)
$serial_value
]);
}
}
}
...
...
core/lib/Drupal/Core/Database/Query/Select.php
View file @
2242f4ad
...
...
@@ -156,14 +156,14 @@ public function hasTag($tag) {
* {@inheritdoc}
*/
public
function
hasAllTags
()
{
return
!
(
boolean
)
array_diff
(
func_get_args
(),
array_keys
(
$this
->
alterTags
));
return
!
(
boolean
)
array_diff
(
func_get_args
(),
array_keys
(
$this
->
alterTags
));
}
/**
* {@inheritdoc}
*/
public
function
hasAnyTag
()
{
return
(
boolean
)
array_intersect
(
func_get_args
(),
array_keys
(
$this
->
alterTags
));
return
(
boolean
)
array_intersect
(
func_get_args
(),
array_keys
(
$this
->
alterTags
));
}
/**
...
...
core/lib/Drupal/Core/Entity/Query/QueryBase.php
View file @
2242f4ad
...
...
@@ -348,14 +348,14 @@ public function hasTag($tag) {
* {@inheritdoc}
*/
public
function
hasAllTags
()
{
return
!
(
boolean
)
array_diff
(
func_get_args
(),
array_keys
(
$this
->
alterTags
));
return
!
(
boolean
)
array_diff
(
func_get_args
(),
array_keys
(
$this
->
alterTags
));
}
/**
* {@inheritdoc}
*/
public
function
hasAnyTag
()
{
return
(
boolean
)
array_intersect
(
func_get_args
(),
array_keys
(
$this
->
alterTags
));
return
(
boolean
)
array_intersect
(
func_get_args
(),
array_keys
(
$this
->
alterTags
));
}
/**
...
...
core/lib/Drupal/Core/Entity/Query/Sql/QueryAggregate.php
View file @
2242f4ad
...
...
@@ -172,7 +172,7 @@ protected function result() {
}
$return
=
[];
foreach
(
$this
->
sqlQuery
->
execute
()
as
$row
)
{
$return
[]
=
(
array
)
$row
;
$return
[]
=
(
array
)
$row
;
}
return
$return
;
}
...
...
core/lib/Drupal/Core/Form/FormState.php
View file @
2242f4ad
...
...
@@ -1186,7 +1186,7 @@ public function setCleanValueKeys(array $cleanValueKeys) {
*/
public
function
addCleanValueKey
(
$cleanValueKey
)
{
$keys
=
$this
->
getCleanValueKeys
();
$this
->
setCleanValueKeys
(
array_merge
((
array
)
$keys
,
[
$cleanValueKey
]));
$this
->
setCleanValueKeys
(
array_merge
((
array
)
$keys
,
[
$cleanValueKey
]));
return
$this
;
}
...
...
core/modules/comment/src/Tests/CommentTestBase.php
View file @
2242f4ad
...
...
@@ -192,12 +192,12 @@ public function commentExists(CommentInterface $comment = NULL, $reply = FALSE)
}
$comment_title
=
$comment_element
[
0
]
->
xpath
(
'div/h3/a'
);
if
(
empty
(
$comment_title
)
||
((
string
)
$comment_title
[
0
])
!==
$comment
->
getSubject
())
{
if
(
empty
(
$comment_title
)
||
((
string
)
$comment_title
[
0
])
!==
$comment
->
getSubject
())
{
return
FALSE
;
}
$comment_body
=
$comment_element
[
0
]
->
xpath
(
'div/div/p'
);
if
(
empty
(
$comment_body
)
||
((
string
)
$comment_body
[
0
])
!==
$comment
->
comment_body
->
value
)
{
if
(
empty
(
$comment_body
)
||
((
string
)
$comment_body
[
0
])
!==
$comment
->
comment_body
->
value
)
{
return
FALSE
;
}
...
...
core/modules/contact/src/Entity/Message.php
View file @
2242f4ad
...
...
@@ -108,7 +108,7 @@ public function setMessage($message) {
* {@inheritdoc}
*/
public
function
copySender
()
{
return
(
bool
)
$this
->
get
(
'copy'
)
->
value
;
return
(
bool
)
$this
->
get
(
'copy'
)
->
value
;
}
/**
...
...
core/modules/file/src/Plugin/Field/FieldType/FileItem.php
View file @
2242f4ad
...
...
@@ -333,7 +333,7 @@ public static function generateSampleValue(FieldDefinitionInterface $field_defin
$file
=
file_save_data
(
$data
,
$destination
,
FILE_EXISTS_ERROR
);
$values
=
[
'target_id'
=>
$file
->
id
(),
'display'
=>
(
int
)
$settings
[
'display_default'
],
'display'
=>
(
int
)
$settings
[
'display_default'
],
'description'
=>
$random
->
sentences
(
10
),
];
return
$values
;
...
...
core/modules/history/src/Controller/HistoryController.php
View file @
2242f4ad
...
...
@@ -51,7 +51,7 @@ public function readNode(Request $request, NodeInterface $node) {
// Update the history table, stating that this user viewed this node.
history_write
(
$node
->
id
());
return
new
JsonResponse
((
int
)
history_read
(
$node
->
id
()));
return
new
JsonResponse
((
int
)
history_read
(
$node
->
id
()));
}
}
core/modules/node/tests/src/Functional/NodeAccessBaseTableTest.php
View file @
2242f4ad
...
...
@@ -114,7 +114,7 @@ public function testNodeAccessBasic() {
$this
->
drupalPostForm
(
'node/add/article'
,
$edit
,
t
(
'Save'
));
$node
=
$this
->
drupalGetNodeByTitle
(
$edit
[
'title[0][value]'
]);
$this
->
assertEqual
(
$is_private
,
(
int
)
$node
->
private
->
value
,
'The private status of the node was properly set in the node_access_test table.'
);
$this
->
assertEqual
(
$is_private
,
(
int
)
$node
->
private
->
value
,
'The private status of the node was properly set in the node_access_test table.'
);
if
(
$is_private
)
{
$private_nodes
[]
=
$node
->
id
();
}
...
...
core/modules/rest/tests/src/Functional/CookieResourceTestTrait.php
View file @
2242f4ad
...
...
@@ -71,7 +71,7 @@ protected function initAuthentication() {
$this
->
sessionCookie
=
explode
(
';'
,
$response
->
getHeader
(
'Set-Cookie'
)[
0
],
2
)[
0
];
// Parse and store the CSRF token and logout token.
$data
=
$this
->
serializer
->
decode
((
string
)
$response
->
getBody
(),
static
::
$format
);
$data
=
$this
->
serializer
->
decode
((
string
)
$response
->
getBody
(),
static
::
$format
);
$this
->
csrfToken
=
$data
[
'csrf_token'
];
$this
->
logoutToken
=
$data
[
'logout_token'
];
}
...
...
core/modules/statistics/src/NodeStatisticsDatabaseStorage.php
View file @
2242f4ad
...
...
@@ -131,7 +131,7 @@ public function resetDayCount() {
public
function
maxTotalCount
()
{
$query
=
$this
->
connection
->
select
(
'node_counter'
,
'nc'
);
$query
->
addExpression
(
'MAX(totalcount)'
);
$max_total_count
=
(
int
)
$query
->
execute
()
->
fetchField
();
$max_total_count
=
(
int
)
$query
->
execute
()
->
fetchField
();
return
$max_total_count
;
}
...
...
core/modules/views/src/Plugin/views/cache/CachePluginBase.php
View file @
2242f4ad
...
...
@@ -190,7 +190,7 @@ public function generateResultsKey() {
$query
=
clone
$build_info
[
$index
];
$query
->
preExecute
();
$build_info
[
$index
]
=
[
'query'
=>
(
string
)
$query
,
'query'
=>
(
string
)
$query
,
'arguments'
=>
$query
->
getArguments
(),
];
}
...
...
core/modules/views/src/ViewExecutable.php
View file @
2242f4ad
...
...
@@ -1758,7 +1758,7 @@ public function access($displays = NULL, $account = NULL) {
// We can't use choose_display() here because that function
// calls this one.
$displays
=
(
array
)
$displays
;
$displays
=
(
array
)
$displays
;
foreach
(
$displays
as
$display_id
)
{
if
(
$this
->
displayHandlers
->
has
(
$display_id
))
{
if
((
$display
=
$this
->
displayHandlers
->
get
(
$display_id
))
&&
$display
->
access
(
$account
))
{
...
...
core/phpcs.xml.dist
View file @
2242f4ad
...
...
@@ -113,6 +113,7 @@
<!-- Generic sniffs -->
<rule
ref=
"Generic.Files.ByteOrderMark"
/>
<rule
ref=
"Generic.Files.LineEndings"
/>
<rule
ref=
"Generic.Formatting.SpaceAfterCast"
/>
<rule
ref=
"Generic.Functions.FunctionCallArgumentSpacing"
/>
<rule
ref=
"Generic.NamingConventions.ConstructorName"
/>
<rule
ref=
"Generic.NamingConventions.UpperCaseConstantName"
/>
...
...
core/tests/Drupal/Tests/Core/Render/PlaceholderGeneratorTest.php
View file @
2242f4ad
...
...
@@ -30,7 +30,7 @@ class PlaceholderGeneratorTest extends RendererTestBase {
public
function
testCreatePlaceholderGeneratesValidHtmlMarkup
(
array
$element
)
{
$build
=
$this
->
placeholderGenerator
->
createPlaceholder
(
$element
);
$original_placeholder_markup
=
(
string
)
$build
[
'#markup'
];
$original_placeholder_markup
=
(
string
)
$build
[
'#markup'
];
$processed_placeholder_markup
=
Html
::
serialize
(
Html
::
load
(
$build
[
'#markup'
]));
$this
->
assertEquals
(
$original_placeholder_markup
,
$processed_placeholder_markup
);
...
...
core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php
View file @
2242f4ad
...
...
@@ -85,14 +85,14 @@ public function testEntitySafePrefixes() {
->
with
(
'test'
)
->
willReturn
(
TRUE
);
$result
=
$this
->
twig
->
render
(
'{{ entity.hasLinkTemplate("test") }}'
,
[
'entity'
=>
$entity
]);
$this
->
assertTrue
((
bool
)
$result
,
'Sandbox policy allows has* functions to be called.'
);
$this
->
assertTrue
((
bool
)
$result
,
'Sandbox policy allows has* functions to be called.'
);
$entity
=
$this
->
getMock
(
'Drupal\Core\Entity\EntityInterface'
);
$entity
->
expects
(
$this
->
atLeastOnce
())
->
method
(
'isNew'
)
->
willReturn
(
TRUE
);
$result
=
$this
->
twig
->
render
(
'{{ entity.isNew }}'
,
[
'entity'
=>
$entity
]);
$this
->
assertTrue
((
bool
)
$result
,
'Sandbox policy allows is* functions to be called.'
);
$this
->
assertTrue
((
bool
)
$result
,
'Sandbox policy allows is* functions to be called.'
);
$entity
=
$this
->
getMock
(
'Drupal\Core\Entity\EntityInterface'
);
$entity
->
expects
(
$this
->
atLeastOnce
())
...
...
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