Skip to content

Commit

Permalink
PHP 7.1 required changes (#2269)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwjames committed Feb 18, 2017
1 parent 017364c commit ff2cd37
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion includes/datavalues/SMW_DataValue.php
Expand Up @@ -324,7 +324,7 @@ public function getOption( $key ) {
* @return boolean
*/
public function isEnabledFeature( $feature ) {
return ( $this->getOption( 'smwgDVFeatures' ) & $feature ) != 0;
return ( (int)$this->getOption( 'smwgDVFeatures' ) & $feature ) != 0;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions includes/queryprinters/ListResultPrinter.php
Expand Up @@ -407,7 +407,7 @@ protected function addTemplateContentFields( $row ) {
$fieldName = '';

// {{{?Foo}}}
if ( $this->mNamedArgs || $this->params['template arguments'] === 'legacy' ) {
if ( $this->mNamedArgs || $this->params['template arguments'] === 'legacy' ) {
$fieldName = '?' . $field->getPrintRequest()->getLabel();
}

Expand All @@ -418,7 +418,7 @@ protected function addTemplateContentFields( $row ) {

// {{{1}}}
if ( $fieldName === '' || $fieldName === '?' || $this->params['template arguments'] === 'numbered' ) {
$fieldName = $fieldName . $i + 1;
$fieldName = intval( $i + 1 );
}

while ( ( $text = $field->getNextText( SMW_OUTPUT_WIKI, $this->getLinker( $i == 0 ) ) ) !== false ) {
Expand Down
2 changes: 1 addition & 1 deletion src/SPARQLStore/QueryEngine/CompoundConditionBuilder.php
Expand Up @@ -420,7 +420,7 @@ public function canUseQFeature( $queryFeatureFlag ) {
$canUse = $this->engineOptions->get( 'smwgQSubcategoryDepth' ) > 0;
}

return $this->engineOptions->get( 'smwgSparqlQFeatures' ) === ( $this->engineOptions->get( 'smwgSparqlQFeatures' ) | $queryFeatureFlag ) && $canUse;
return $this->engineOptions->get( 'smwgSparqlQFeatures' ) === ( (int)$this->engineOptions->get( 'smwgSparqlQFeatures' ) | (int)$queryFeatureFlag ) && $canUse;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions tests/autoloader.php
Expand Up @@ -8,8 +8,7 @@
*
* require __DIR__ . '/../../SemanticMediaWiki/tests/autoloader.php'
*/

if ( PHP_SAPI !== 'cli' ) {
if ( PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg' ) {
die( 'Not an entry point' );
}

Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap.php
@@ -1,6 +1,6 @@
<?php

if ( PHP_SAPI !== 'cli' ) {
if ( PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg' ) {
die( 'Not an entry point' );
}

Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/Integration/EncodingIntegrationTest.php
Expand Up @@ -28,7 +28,7 @@ class EncodingIntegrationTest extends \PHPUnit_Framework_TestCase {
*/
public function testBaseTemplateToolboxURLEncoding( $setup, $expected ) {

$toolbox = '';
$toolbox = array();

foreach ( $setup['settings'] as $key => $value) {
ApplicationFactory::getInstance()->getSettings()->set( $key, $value );
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/Integration/JSONScript/TestCases/p-0438.json
Expand Up @@ -43,7 +43,7 @@
"title=\"Property:Has keyword\">KeywordCaption</a>",
"title=\"Property:Has query\">query-displaytitle</a></span><div class=\"smwttcontent\">„query-displaytitle“",
"title=\"Property:Has query\">QueryCaption</a></span><div class=\"smwttcontent\">„query-displaytitle“",
"title=\"Especial:Ask/-5B-5BCategoría:P0438-5D-5D/-3FModification-20date/-3FModification-20date=ModificationSomeLabel/-3FHas-20keyword/-3FHas-20keyword=KeywordCaption/-3FHas-20query/-3FHas-20query=QueryCaption/mainlabel=/limit=1/offset=1/format=table\">"
":Ask/-5B-5BCategoría:P0438-5D-5D/-3FModification-20date/-3FModification-20date=ModificationSomeLabel/-3FHas-20keyword/-3FHas-20keyword=KeywordCaption/-3FHas-20query/-3FHas-20query=QueryCaption/mainlabel=/limit=1/offset=1/format=table\">"
]
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/JsonTestCaseFileHandler.php
Expand Up @@ -200,7 +200,7 @@ public function getSettingsFor( $key ) {
$smwgDVFeatures = '';

foreach ( $settings[$key] as $value ) {
$smwgDVFeatures = constant( $value ) | $smwgDVFeatures;
$smwgDVFeatures = constant( $value ) | (int)$smwgDVFeatures;
}

return $smwgDVFeatures;
Expand All @@ -210,7 +210,7 @@ public function getSettingsFor( $key ) {
$smwgFulltextSearchIndexableDataTypes = '';

foreach ( $settings[$key] as $value ) {
$smwgFulltextSearchIndexableDataTypes = constant( $value ) | $smwgFulltextSearchIndexableDataTypes;
$smwgFulltextSearchIndexableDataTypes = constant( $value ) | (int)$smwgFulltextSearchIndexableDataTypes;
}

return $smwgFulltextSearchIndexableDataTypes;
Expand Down
Expand Up @@ -44,7 +44,7 @@ public function testCanConstruct() {
*/
public function testProcess( $setup, $expected ) {

$toolbox = '';
$toolbox = array();

ApplicationFactory::getInstance()->registerObject(
'Settings',
Expand Down
6 changes: 3 additions & 3 deletions tests/phpunit/Unit/PermissionPthValidatorTest.php
Expand Up @@ -42,7 +42,7 @@ public function testGrantPermissionToMainNamespace() {
->disableOriginalConstructor()
->getMock();

$result = '';
$result = array();

$instance = new PermissionPthValidator(
$this->editProtectionValidator
Expand Down Expand Up @@ -79,7 +79,7 @@ public function testToReturnFalseOnMwNamespacePermissionCheck( $title, $permissi
->with( $this->equalTo( $permission ) )
->will( $this->returnValue( false ) );

$result = '';
$result = array();

$instance = new PermissionPthValidator(
$this->editProtectionValidator
Expand Down Expand Up @@ -132,7 +132,7 @@ public function testToReturnFalseOnNamespaceWithEditPermissionCheck() {
->with( $this->equalTo( $editProtectionRight ) )
->will( $this->returnValue( false ) );

$result = '';
$result = array();

$instance = new PermissionPthValidator(
$this->editProtectionValidator
Expand Down

0 comments on commit ff2cd37

Please sign in to comment.