Skip to content

Commit

Permalink
Clean up namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
JeroenDeDauw committed Feb 16, 2021
1 parent ad98c2f commit 04fef9a
Show file tree
Hide file tree
Showing 39 changed files with 60 additions and 79 deletions.
3 changes: 1 addition & 2 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
<directory name="tests/Unit/Humanize" />

<ignoreFiles>
<file name="src/PackagePrivate/Parser.php" />
<file name="src/PackagePrivate/RegexMatchesMapper.php" />
<directory name="src/PackagePrivate/Carbon" />
<directory name="src/PackagePrivate/Parser" />

<directory name="vendor" />

Expand Down
2 changes: 1 addition & 1 deletion src/ExtDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace EDTF;

use EDTF\PackagePrivate\CoversTrait;
use EDTF\Exceptions\ExtDateException;
use EDTF\PackagePrivate\Carbon\CarbonFactory;
use EDTF\PackagePrivate\Carbon\DatetimeFactoryException;
use EDTF\PackagePrivate\Carbon\DatetimeFactoryInterface;
use EDTF\PackagePrivate\CoversTrait;

class ExtDate implements EdtfValue
{
Expand Down
2 changes: 0 additions & 2 deletions src/PackagePrivate/Carbon/CarbonFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

use Carbon\Carbon;
use Carbon\Exceptions\InvalidFormatException;
use EDTF\PackagePrivate\Carbon\DatetimeFactoryException;
use EDTF\PackagePrivate\Carbon\DatetimeFactoryInterface;

/**
* This factory allows us to avoid calling Carbon static methods (i.e. Carbon::create(...)) from code.
Expand Down
2 changes: 0 additions & 2 deletions src/PackagePrivate/Carbon/DatetimeFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace EDTF\PackagePrivate\Carbon;

use EDTF\PackagePrivate\Carbon\DatetimeFactoryException;

/**
* FIXME: return type missing
* TODO: what value does this interface bring?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace EDTF\PackagePrivate\ParserState;
namespace EDTF\PackagePrivate\Parser;

use Carbon\Carbon;
use \InvalidArgumentException;
use InvalidArgumentException;

class Date
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
<?php

namespace EDTF\PackagePrivate\ParserState;

use EDTF\PackagePrivate\ParserState\Date;
use EDTF\PackagePrivate\ParserState\Qualification;
use EDTF\PackagePrivate\ParserState\Time;
use EDTF\PackagePrivate\ParserState\Timezone;
namespace EDTF\PackagePrivate\Parser;

class ParsedData
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

declare(strict_types = 1);

namespace EDTF\PackagePrivate;
namespace EDTF\PackagePrivate\Parser;

use EDTF\EdtfValue;
use EDTF\ExtDate;
use EDTF\ExtDateTime;
use EDTF\Interval;
use EDTF\IntervalSide;
use EDTF\PackagePrivate\ParserState\ParsedData;
use EDTF\Qualification;
use EDTF\Season;
use EDTF\Set;
Expand All @@ -36,7 +35,7 @@ class Parser
public function __construct()
{
// TODO: avoid file read every time an instance is created
$patterns = file_get_contents(__DIR__.'/../../config/regex.txt');
$patterns = file_get_contents(__DIR__.'/../../../config/regex.txt');
$this->regexPattern = '/'.$patterns.'/';

$this->mapper = new RegexMatchesMapper();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types = 1);

namespace EDTF\PackagePrivate;
namespace EDTF\PackagePrivate\Parser;

/**
* @internal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace EDTF\PackagePrivate\ParserState;
namespace EDTF\PackagePrivate\Parser;

class Qualification
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<?php

namespace EDTF\PackagePrivate;

use EDTF\PackagePrivate\ParserState\Qualification;
use EDTF\PackagePrivate\ParserState\Time;
use EDTF\PackagePrivate\ParserState\Timezone;
use EDTF\PackagePrivate\ParserState\ParsedData;
use EDTF\PackagePrivate\ParserState\Date;
namespace EDTF\PackagePrivate\Parser;

class RegexMatchesMapper
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace EDTF\PackagePrivate\ParserState;
namespace EDTF\PackagePrivate\Parser;

class Time
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace EDTF\PackagePrivate\ParserState;
namespace EDTF\PackagePrivate\Parser;

class Timezone
{
Expand Down
1 change: 1 addition & 0 deletions src/PackagePrivate/SaneParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace EDTF\PackagePrivate;

use EDTF\EdtfParser;
use EDTF\PackagePrivate\Parser\Parser;
use EDTF\ParsingResult;

class SaneParser implements EdtfParser {
Expand Down
2 changes: 1 addition & 1 deletion src/Season.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace EDTF;

use EDTF\PackagePrivate\CoversTrait;
use EDTF\PackagePrivate\Parser;
use EDTF\PackagePrivate\Parser\Parser;

class Season implements EdtfValue
{
Expand Down
6 changes: 3 additions & 3 deletions tests/Functional/EdtfParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

namespace EDTF\Tests\Functional;

use EDTF\PackagePrivate\SaneParser;
use EDTF\ExampleData\ValidEdtfStrings;
use EDTF\PackagePrivate\SaneParser;
use PHPUnit\Framework\TestCase;

/**
* @covers \EDTF\PackagePrivate\SaneParser
* @covers \EDTF\ParsingResult
* @covers \EDTF\ExampleData\ValidEdtfStrings
* @covers \EDTF\PackagePrivate\Parser
* @covers \EDTF\PackagePrivate\ParserValidator
* @covers \EDTF\PackagePrivate\Parser\Parser
* @covers \EDTF\PackagePrivate\Parser\ParserValidator
*/
class EdtfParserTest extends TestCase {

Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/EdtfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
namespace EDTF\Tests\Functional;

use EDTF\EdtfValue;
use EDTF\PackagePrivate\Parser;
use EDTF\PackagePrivate\Parser\Parser;
use PHPUnit\Framework\TestCase;

/**
* @covers \EDTF\PackagePrivate\Parser
* @covers \EDTF\PackagePrivate\Parser\Parser
* @package EDTF\Tests\Functional
*/
class EdtfTest extends TestCase
Expand Down
6 changes: 3 additions & 3 deletions tests/Functional/EdtfValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

namespace EDTF\Tests\Functional;

use EDTF\PackagePrivate\Validator;
use EDTF\ExampleData\ValidEdtfStrings;
use EDTF\PackagePrivate\Validator;
use PHPUnit\Framework\TestCase;

/**
* @covers \EDTF\PackagePrivate\Validator
* @covers \EDTF\ExampleData\ValidEdtfStrings
* @covers \EDTF\PackagePrivate\Parser
* @covers \EDTF\PackagePrivate\ParserValidator
* @covers \EDTF\PackagePrivate\Parser\Parser
* @covers \EDTF\PackagePrivate\Parser\ParserValidator
*/
class EdtfValidatorTest extends TestCase {

Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Level0/DateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use PHPUnit\Framework\TestCase;

/**
* @covers \EDTF\PackagePrivate\Parser
* @covers \EDTF\PackagePrivate\Parser\Parser
* @covers \EDTF\ExtDate
* @package EDTF\Tests\Unit
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Level0/DateTimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use PHPUnit\Framework\TestCase;

/**
* @covers \EDTF\PackagePrivate\Parser
* @covers \EDTF\PackagePrivate\Parser\Parser
* @covers \EDTF\ExtDateTime
* @package EDTF\Tests\Unit
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Level0/IntervalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

/**
* @covers \EDTF\Interval
* @covers \EDTF\PackagePrivate\Parser
* @covers \EDTF\PackagePrivate\Parser\Parser
* @package EDTF\Tests\Unit
*/
class IntervalTest extends TestCase
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Level1/ExtendedIntervalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use PHPUnit\Framework\TestCase;

/**
* @covers \EDTF\PackagePrivate\Parser
* @covers \EDTF\PackagePrivate\Parser\Parser
* @covers \EDTF\Interval
* @package EDTF\Tests\Unit
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Level1/PrefixedYearTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

/**
* @covers \EDTF\ExtDateTime
* @covers \EDTF\PackagePrivate\Parser
* @covers \EDTF\PackagePrivate\Parser\Parser
* @package EDTF\Tests\Unit
*/
class PrefixedYearTest extends TestCase
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Level1/QualificationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use PHPUnit\Framework\TestCase;

/**
* @covers \EDTF\PackagePrivate\Parser
* @covers \EDTF\PackagePrivate\Parser\Parser
* @covers \EDTF\Interval
* @covers \EDTF\ExtDateTime
*
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Level1/SeasonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

/**
* @covers \EDTF\Season
* @covers \EDTF\PackagePrivate\Parser
* @covers \EDTF\PackagePrivate\Parser\Parser
*/
class SeasonTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Level2/ExponentialYearTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use PHPUnit\Framework\TestCase;

/**
* @covers \EDTF\PackagePrivate\Parser
* @covers \EDTF\PackagePrivate\Parser\Parser
* @package EDTF\Tests\Functional
*/
class ExponentialYearTest extends TestCase
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Level2/IntervalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

/**
* @covers \EDTF\Interval
* @covers \EDTF\PackagePrivate\Parser
* @covers \EDTF\PackagePrivate\Parser\Parser
* @package EDTF\Tests\Functional
*/
class IntervalTest extends TestCase
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Level2/QualificationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use PHPUnit\Framework\TestCase;

/**
* @covers \EDTF\PackagePrivate\Parser
* @covers \EDTF\PackagePrivate\Parser\Parser
* @covers \EDTF\ExtDate
* @package EDTF\Tests\Functional
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Level2/SetRepresentationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use PHPUnit\Framework\TestCase;

/**
* @covers \EDTF\PackagePrivate\Parser
* @covers \EDTF\PackagePrivate\Parser\Parser
* @covers \EDTF\Set
* @package EDTF\Tests\Functional
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Level2/SignificantDigitsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use PHPUnit\Framework\TestCase;

/**
* @covers \EDTF\PackagePrivate\Parser
* @covers \EDTF\PackagePrivate\Parser\Parser
* @package EDTF\Tests\Functional
*/
class SignificantDigitsTest extends TestCase
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Level2/UnspecifiedDigitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use PHPUnit\Framework\TestCase;

/**
* @covers \EDTF\PackagePrivate\Parser
* @covers \EDTF\PackagePrivate\Parser\Parser
* @covers \EDTF\ExtDate
* @package EDTF\Tests\Functional
*/
Expand Down
5 changes: 1 addition & 4 deletions tests/Functional/StringHumanizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
namespace EDTF\Tests\Functional;

use EDTF\EdtfFactory;
use EDTF\PackagePrivate\SaneParser;
use EDTF\EdtfValue;
use EDTF\Humanizer;
use EDTF\PackagePrivate\Humanize\HumanizerFactory;
use EDTF\PackagePrivate\Humanize\PrivateStringHumanizer;
use PHPUnit\Framework\TestCase;

/**
* @covers \EDTF\PackagePrivate\EnglishHumanizer
* @covers \EDTF\PackagePrivate\Parser
* @covers \EDTF\PackagePrivate\Parser\Parser
* @covers \EDTF\Interval
* @covers \EDTF\IntervalSide
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace EDTF\Tests\Unit\Contracts;
namespace EDTF\Tests\Unit;

use EDTF\ExtDate;
use PHPUnit\Framework\TestCase;
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/ExtDateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
use Carbon\Carbon;
use EDTF\Exceptions\ExtDateException;
use EDTF\ExtDate;
use EDTF\Qualification;
use EDTF\UnspecifiedDigit;
use EDTF\PackagePrivate\Carbon\CarbonFactory;
use EDTF\PackagePrivate\Carbon\DatetimeFactoryException;
use EDTF\Qualification;
use EDTF\UnspecifiedDigit;
use PHPUnit\Framework\TestCase;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/FactoryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use EDTF\ExtDate;
use EDTF\ExtDateTime;
use EDTF\Interval;
use EDTF\PackagePrivate\Parser;
use EDTF\PackagePrivate\Parser\Parser;
use EDTF\Season;
use EDTF\Set;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

declare(strict_types=1);

namespace EDTF\Tests\Unit\PackagePrivate;
namespace EDTF\Tests\Unit\PackagePrivate\Parser;

use EDTF\ExtDate;
use EDTF\Interval;
use EDTF\PackagePrivate\Parser;
use EDTF\PackagePrivate\Parser\Parser;
use PHPUnit\Framework\TestCase;

/**
* @covers \EDTF\PackagePrivate\Parser
* @covers \EDTF\PackagePrivate\Parser\Parser
* @package EDTF\Tests\Unit
*/
class ParserTest extends TestCase
Expand Down
Loading

0 comments on commit 04fef9a

Please sign in to comment.