Skip to content

Commit 85665db

Browse files
committed
stricter code-sniffing rules
1 parent a065849 commit 85665db

19 files changed

+56
-49
lines changed

config/phpcs_ruleset.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@
44

55
<!-- Include the PSR-2 standard -->
66
<rule ref="PSR2">
7-
<!--
8-
These two sniffs doesn't detect PHP 5.2 namespaces / class names correctly
9-
See: https://pear.php.net/bugs/bug.php?id=19774
10-
-->
11-
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace"/>
12-
<exclude name="Squiz.Classes.ValidClassName"/>
13-
147
<!-- We implement more than one class per file in the tests -->
158
<exclude name="PSR1.Classes.ClassDeclaration.MultipleClasses" />
169

test/EasyRdf/GraphTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
require_once dirname(__DIR__).DIRECTORY_SEPARATOR.'TestHelper.php';
4242

43-
class Mock_RdfParser
43+
class MockRdfParser
4444
{
4545
public function parse($graph, $data, $format, $baseUri)
4646
{
@@ -53,7 +53,7 @@ public function parse($graph, $data, $format, $baseUri)
5353
}
5454
}
5555

56-
class Mock_RdfSerialiser
56+
class MockRdfSerialiser
5757
{
5858
public function serialise($graph, $format = null)
5959
{
@@ -182,7 +182,7 @@ public function testParseUnknownFormat()
182182

183183
public function testMockParser()
184184
{
185-
Format::registerParser('mock', 'EasyRdf\Mock_RdfParser');
185+
Format::registerParser('mock', 'EasyRdf\MockRdfParser');
186186

187187
$graph = new Graph();
188188
$graph->parse('data', 'mock');
@@ -1585,14 +1585,14 @@ public function testPrimaryTopicUnknown()
15851585

15861586
public function testSerialise()
15871587
{
1588-
Format::registerSerialiser('mock', 'EasyRdf\Mock_RdfSerialiser');
1588+
Format::registerSerialiser('mock', 'EasyRdf\MockRdfSerialiser');
15891589
$graph = new Graph();
15901590
$this->assertSame("<rdf></rdf>", $graph->serialise('mock'));
15911591
}
15921592

15931593
public function testSerialiseByMime()
15941594
{
1595-
Format::registerSerialiser('mock', 'EasyRdf\Mock_RdfSerialiser');
1595+
Format::registerSerialiser('mock', 'EasyRdf\MockRdfSerialiser');
15961596
Format::register('mock', 'Mock', null, array('mock/mime' => 1.0));
15971597
$graph = new Graph();
15981598
$this->assertSame(
@@ -1604,7 +1604,7 @@ public function testSerialiseByMime()
16041604
public function testSerialiseByFormatObject()
16051605
{
16061606
$format = Format::register('mock', 'Mock Format');
1607-
$format->setSerialiserClass('EasyRdf\Mock_RdfSerialiser');
1607+
$format->setSerialiserClass('EasyRdf\MockRdfSerialiser');
16081608
$graph = new Graph();
16091609
$this->assertSame("<rdf></rdf>", $graph->serialise($format));
16101610
}

test/EasyRdf/Http/ResponseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
require_once realpath(__DIR__ . '/../../') . '/TestHelper.php';
4545

46-
class EasyRdf_Http_ResponseTest extends TestCase
46+
class ResponseTest extends TestCase
4747
{
4848
public function testGetVersion()
4949
{

test/EasyRdf/LiteralTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
require_once dirname(__DIR__).DIRECTORY_SEPARATOR.'TestHelper.php';
4040

41-
class MyDatatype_Class extends Literal
41+
class MyDatatypeClass extends Literal
4242
{
4343
public function __toString()
4444
{
@@ -416,9 +416,9 @@ public function testDumpValueWithDatatype()
416416

417417
public function testConstructCustomClass()
418418
{
419-
Literal::setDatatypeMapping('ex:mytype', 'EasyRdf\MyDatatype_Class');
420-
$literal = new MyDatatype_Class('foobar');
421-
$this->assertClass('EasyRdf\MyDatatype_Class', $literal);
419+
Literal::setDatatypeMapping('ex:mytype', 'EasyRdf\MyDatatypeClass');
420+
$literal = new MyDatatypeClass('foobar');
421+
$this->assertClass('EasyRdf\MyDatatypeClass', $literal);
422422
$this->assertStringEquals('!foobar!', $literal);
423423
$this->assertSame('foobar', $literal->getValue());
424424
$this->assertSame('ex:mytype', $literal->getDatatype());
@@ -427,9 +427,9 @@ public function testConstructCustomClass()
427427

428428
public function testCreateCustomClass()
429429
{
430-
Literal::setDatatypeMapping('ex:mytype', 'EasyRdf\MyDatatype_Class');
430+
Literal::setDatatypeMapping('ex:mytype', 'EasyRdf\MyDatatypeClass');
431431
$literal = Literal::create('foobar', null, 'ex:mytype');
432-
$this->assertClass('EasyRdf\MyDatatype_Class', $literal);
432+
$this->assertClass('EasyRdf\MyDatatypeClass', $literal);
433433
$this->assertStringEquals('!foobar!', $literal);
434434
$this->assertSame('foobar', $literal->getValue());
435435
$this->assertSame('ex:mytype', $literal->getDatatype());
@@ -442,7 +442,7 @@ public function testSetDatatypeMappingNull()
442442
'InvalidArgumentException',
443443
'$datatype should be a string and cannot be null or empty'
444444
);
445-
Literal::setDatatypeMapping(null, 'EasyRdf\MyDatatype_Class');
445+
Literal::setDatatypeMapping(null, 'EasyRdf\MyDatatypeClass');
446446
}
447447

448448
public function testSetDatatypeMappingEmpty()
@@ -451,7 +451,7 @@ public function testSetDatatypeMappingEmpty()
451451
'InvalidArgumentException',
452452
'$datatype should be a string and cannot be null or empty'
453453
);
454-
Literal::setDatatypeMapping('', 'EasyRdf\MyDatatype_Class');
454+
Literal::setDatatypeMapping('', 'EasyRdf\MyDatatypeClass');
455455
}
456456

457457
public function testSetDatatypeMappingNonString()
@@ -460,7 +460,7 @@ public function testSetDatatypeMappingNonString()
460460
'InvalidArgumentException',
461461
'$datatype should be a string and cannot be null or empty'
462462
);
463-
Literal::setDatatypeMapping(array(), 'EasyRdf\MyDatatype_Class');
463+
Literal::setDatatypeMapping(array(), 'EasyRdf\MyDatatypeClass');
464464
}
465465

466466
public function testSetDatatypeMappingClassNull()

test/EasyRdf/TypeMapperTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
require_once dirname(__DIR__).DIRECTORY_SEPARATOR.'TestHelper.php';
4040

41-
class MyType_Class extends Resource
41+
class MyTypeClass extends Resource
4242
{
4343
public function myMethod()
4444
{
@@ -51,7 +51,7 @@ class TypeMapperTest extends TestCase
5151
{
5252
public function setUp()
5353
{
54-
TypeMapper::set('rdf:mytype', 'EasyRdf\MyType_Class');
54+
TypeMapper::set('rdf:mytype', 'EasyRdf\MyTypeClass');
5555
}
5656

5757
public function tearDown()
@@ -64,15 +64,15 @@ public function tearDown()
6464
public function testGet()
6565
{
6666
$this->assertSame(
67-
'EasyRdf\MyType_Class',
67+
'EasyRdf\MyTypeClass',
6868
TypeMapper::get('rdf:mytype')
6969
);
7070
}
7171

7272
public function testGetUri()
7373
{
7474
$this->assertSame(
75-
'EasyRdf\MyType_Class',
75+
'EasyRdf\MyTypeClass',
7676
TypeMapper::get(
7777
'http://www.w3.org/1999/02/22-rdf-syntax-ns#mytype'
7878
)
@@ -115,11 +115,11 @@ public function testSetUri()
115115
{
116116
TypeMapper::set(
117117
'http://xmlns.com/foaf/0.1/Person',
118-
'EasyRdf\MyType_Class'
118+
'EasyRdf\MyTypeClass'
119119
);
120120

121121
$this->assertSame(
122-
'EasyRdf\MyType_Class',
122+
'EasyRdf\MyTypeClass',
123123
TypeMapper::get('foaf:Person')
124124
);
125125
}
@@ -130,7 +130,7 @@ public function testSetTypeNull()
130130
'InvalidArgumentException',
131131
'$type should be a string and cannot be null or empty'
132132
);
133-
TypeMapper::set(null, 'EasyRdf\MyType_Class');
133+
TypeMapper::set(null, 'EasyRdf\MyTypeClass');
134134
}
135135

136136
public function testSetTypeEmpty()
@@ -139,7 +139,7 @@ public function testSetTypeEmpty()
139139
'InvalidArgumentException',
140140
'$type should be a string and cannot be null or empty'
141141
);
142-
TypeMapper::set('', 'EasyRdf\MyType_Class');
142+
TypeMapper::set('', 'EasyRdf\MyTypeClass');
143143
}
144144

145145
public function testSetTypeNonString()
@@ -148,7 +148,7 @@ public function testSetTypeNonString()
148148
'InvalidArgumentException',
149149
'$type should be a string and cannot be null or empty'
150150
);
151-
TypeMapper::set(array(), 'EasyRdf\MyType_Class');
151+
TypeMapper::set(array(), 'EasyRdf\MyTypeClass');
152152
}
153153

154154
public function testSetClassNull()
@@ -180,7 +180,7 @@ public function testSetClassNonString()
180180

181181
public function testDelete()
182182
{
183-
$this->assertSame('EasyRdf\MyType_Class', TypeMapper::get('rdf:mytype'));
183+
$this->assertSame('EasyRdf\MyTypeClass', TypeMapper::get('rdf:mytype'));
184184
TypeMapper::delete('rdf:mytype');
185185
$this->assertSame(null, TypeMapper::get('rdf:mytype'));
186186
}
@@ -214,15 +214,15 @@ public function testDeleteTypeNonString()
214214

215215
public function testInstantiate()
216216
{
217-
TypeMapper::set('foaf:Person', 'EasyRdf\MyType_Class');
217+
TypeMapper::set('foaf:Person', 'EasyRdf\MyTypeClass');
218218
$data = readFixture('foaf.json');
219219
$graph = new Graph(
220220
'http://www.example.com/joe/foaf.rdf',
221221
$data,
222222
'json'
223223
);
224224
$joe = $graph->resource('http://www.example.com/joe#me');
225-
$this->assertClass('EasyRdf\MyType_Class', $joe);
225+
$this->assertClass('EasyRdf\MyTypeClass', $joe);
226226
$this->assertTrue($joe->myMethod());
227227
}
228228
}

test/examples/ArtistinfoTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
namespace EasyRdf\Examples;
23

34
/**
45
* EasyRdf
@@ -37,7 +38,7 @@
3738

3839
require_once dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'TestHelper.php';
3940

40-
class Examples_ArtistinfoTest extends \EasyRdf\TestCase
41+
class ArtistinfoTest extends \EasyRdf\TestCase
4142
{
4243
public function testNoParams()
4344
{

test/examples/BasicSparqlTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
namespace EasyRdf\Examples;
23

34
/**
45
* EasyRdf
@@ -37,7 +38,7 @@
3738

3839
require_once dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'TestHelper.php';
3940

40-
class Examples_BasicSparqlTest extends \EasyRdf\TestCase
41+
class BasicSparqlTest extends \EasyRdf\TestCase
4142
{
4243
public function testCountries()
4344
{

test/examples/BasicTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
namespace EasyRdf\Examples;
23

34
/**
45
* EasyRdf
@@ -37,7 +38,7 @@
3738

3839
require_once dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'TestHelper.php';
3940

40-
class Examples_BasicTest extends \EasyRdf\TestCase
41+
class BasicTest extends \EasyRdf\TestCase
4142
{
4243
public function testPageRendersCorrectly()
4344
{

test/examples/ConverterTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
namespace EasyRdf\Examples;
23

34
/**
45
* EasyRdf
@@ -37,7 +38,7 @@
3738

3839
require_once dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'TestHelper.php';
3940

40-
class Examples_ConverterTest extends \EasyRdf\TestCase
41+
class ConverterTest extends \EasyRdf\TestCase
4142
{
4243
public function testNoParams()
4344
{

test/examples/DumpTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
namespace EasyRdf\Examples;
23

34
/**
45
* EasyRdf
@@ -37,7 +38,7 @@
3738

3839
require_once dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'TestHelper.php';
3940

40-
class Examples_DumpTest extends \EasyRdf\TestCase
41+
class DumpTest extends \EasyRdf\TestCase
4142
{
4243
public function testNoParams()
4344
{

0 commit comments

Comments
 (0)