Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up use statements #185

Merged
merged 3 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/class-text-parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

namespace PHP_Typography;

use PHP_Typography\Exceptions\Invalid_Encoding_Exception;
use PHP_Typography\Text_Parser\Token;

/**
Expand Down
5 changes: 1 addition & 4 deletions src/fixes/class-default-registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,11 @@

namespace PHP_Typography\Fixes;

use PHP_Typography\Settings;
use PHP_Typography\Hyphenator\Cache;

use PHP_Typography\Fixes\Node_Fix;
use PHP_Typography\Fixes\Token_Fix;

use PHP_Typography\Hyphenator\Cache;


/**
* A registry implementation containing the default fixes for PHP_Typography.
*
Expand Down
1 change: 0 additions & 1 deletion src/fixes/class-registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

use PHP_Typography\Fixes\Node_Fix;
use PHP_Typography\Fixes\Token_Fix;
use PHP_Typography\Fixes\Token_Fixes\Hyphenate_Fix;

/**
* Manages the fixes used by PHP_Typography.
Expand Down
1 change: 0 additions & 1 deletion src/fixes/node-fixes/class-abstract-node-fix.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

use PHP_Typography\Fixes\Node_Fix;
use PHP_Typography\Settings;
use PHP_Typography\Strings;

/**
* All fixes that apply to textnodes should implement this interface.
Expand Down
1 change: 0 additions & 1 deletion src/fixes/node-fixes/class-classes-dependent-fix.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

use PHP_Typography\Settings;
use PHP_Typography\DOM;
use PHP_Typography\Exceptions\Invalid_Encoding_Exception;

/**
* All fixes that depend on certain HTML classes not being present should extend this baseclass.
Expand Down
1 change: 0 additions & 1 deletion src/fixes/node-fixes/class-dash-spacing-fix.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

namespace PHP_Typography\Fixes\Node_Fixes;

use PHP_Typography\DOM;
use PHP_Typography\Settings;
use PHP_Typography\U;

Expand Down
1 change: 0 additions & 1 deletion src/fixes/node-fixes/class-dewidow-fix.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
namespace PHP_Typography\Fixes\Node_Fixes;

use PHP_Typography\DOM;
use PHP_Typography\RE;
use PHP_Typography\Settings;
use PHP_Typography\Strings;
use PHP_Typography\U;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
namespace PHP_Typography\Fixes\Node_Fixes;

use PHP_Typography\DOM;
use PHP_Typography\Exceptions\Invalid_Encoding_Exception;
use PHP_Typography\Settings;
use PHP_Typography\Strings;
use PHP_Typography\U;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

namespace PHP_Typography\Fixes\Node_Fixes;

use PHP_Typography\DOM;
use PHP_Typography\Settings;
use PHP_Typography\U;
use PHP_Typography\RE;
Expand Down
1 change: 0 additions & 1 deletion src/fixes/node-fixes/class-process-words-fix.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

use PHP_Typography\Text_Parser;
use PHP_Typography\Settings;
use PHP_Typography\DOM;
use PHP_Typography\Hyphenator\Cache;
use PHP_Typography\Fixes\Token_Fix;
use PHP_Typography\Fixes\Token_Fixes\Hyphenate_Fix;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
namespace PHP_Typography\Fixes\Node_Fixes;

use PHP_Typography\Settings;
use PHP_Typography\DOM;

/**
* An abstract base class for providing simple fixes via a single regular expression replacement.
Expand Down
1 change: 0 additions & 1 deletion src/fixes/node-fixes/class-simple-style-fix.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

namespace PHP_Typography\Fixes\Node_Fixes;

use PHP_Typography\DOM;
use PHP_Typography\RE;
use PHP_Typography\Settings;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
namespace PHP_Typography\Fixes\Node_Fixes;

use PHP_Typography\DOM;
use PHP_Typography\Exceptions\Invalid_Encoding_Exception;
use PHP_Typography\RE;
use PHP_Typography\Settings;
use PHP_Typography\Strings;
Expand Down
2 changes: 0 additions & 2 deletions src/fixes/node-fixes/class-smart-area-units-fix.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@

namespace PHP_Typography\Fixes\Node_Fixes;

use PHP_Typography\DOM;
use PHP_Typography\Settings;
use PHP_Typography\U;

/**
* Applies smart area units (if enabled).
Expand Down
1 change: 0 additions & 1 deletion src/fixes/node-fixes/class-smart-dashes-fix.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

namespace PHP_Typography\Fixes\Node_Fixes;

use PHP_Typography\DOM;
use PHP_Typography\RE;
use PHP_Typography\Settings;
use PHP_Typography\U;
Expand Down
1 change: 0 additions & 1 deletion src/fixes/node-fixes/class-smart-diacritics-fix.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
namespace PHP_Typography\Fixes\Node_Fixes;

use PHP_Typography\Settings;
use PHP_Typography\DOM;

/**
* Applies smart diacritics (if enabled).
Expand Down
1 change: 0 additions & 1 deletion src/fixes/node-fixes/class-smart-ellipses-fix.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

namespace PHP_Typography\Fixes\Node_Fixes;

use PHP_Typography\DOM;
use PHP_Typography\Settings;
use PHP_Typography\U;

Expand Down
1 change: 0 additions & 1 deletion src/fixes/node-fixes/class-smart-exponents-fix.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

namespace PHP_Typography\Fixes\Node_Fixes;

use PHP_Typography\DOM;
use PHP_Typography\RE;
use PHP_Typography\Settings;

Expand Down
1 change: 0 additions & 1 deletion src/fixes/node-fixes/class-smart-fractions-fix.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

namespace PHP_Typography\Fixes\Node_Fixes;

use PHP_Typography\DOM;
use PHP_Typography\RE;
use PHP_Typography\Settings;
use PHP_Typography\U;
Expand Down
1 change: 0 additions & 1 deletion src/fixes/node-fixes/class-smart-maths-fix.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

namespace PHP_Typography\Fixes\Node_Fixes;

use PHP_Typography\DOM;
use PHP_Typography\Settings;
use PHP_Typography\U;

Expand Down
1 change: 0 additions & 1 deletion src/fixes/node-fixes/class-smart-ordinal-suffix-fix.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

namespace PHP_Typography\Fixes\Node_Fixes;

use PHP_Typography\DOM;
use PHP_Typography\RE;
use PHP_Typography\Settings;
use PHP_Typography\U;
Expand Down
1 change: 0 additions & 1 deletion src/fixes/node-fixes/class-space-collapse-fix.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
use PHP_Typography\DOM;
use PHP_Typography\RE;
use PHP_Typography\Settings;
use PHP_Typography\Strings;
use PHP_Typography\U;

/**
Expand Down
3 changes: 1 addition & 2 deletions src/fixes/node-fixes/class-style-ampersands-fix.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* This file is part of PHP-Typography.
*
* Copyright 2017 Peter Putzer.
* Copyright 2017-2024 Peter Putzer.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -27,7 +27,6 @@
namespace PHP_Typography\Fixes\Node_Fixes;

use PHP_Typography\Settings;
use PHP_Typography\DOM;

/**
* Wraps ampersands in <span class="amp"> (i.e. H&amp;J becomes H<span class="amp">&amp;</span>J),
Expand Down
3 changes: 1 addition & 2 deletions src/fixes/node-fixes/class-style-numbers-fix.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* This file is part of PHP-Typography.
*
* Copyright 2017-2019 Peter Putzer.
* Copyright 2017-2024 Peter Putzer.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -27,7 +27,6 @@
namespace PHP_Typography\Fixes\Node_Fixes;

use PHP_Typography\Settings;
use PHP_Typography\DOM;

/**
* Wraps numbers in <span class="numbers"> (even numbers that appear inside a word,
Expand Down
1 change: 0 additions & 1 deletion src/fixes/node-fixes/class-unit-spacing-fix.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
namespace PHP_Typography\Fixes\Node_Fixes;

use PHP_Typography\Settings;
use PHP_Typography\DOM;
use PHP_Typography\U;

/**
Expand Down
6 changes: 5 additions & 1 deletion src/fixes/token-fixes/class-wrap-urls-fix.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use PHP_Typography\Hyphenator\Cache;
use PHP_Typography\RE;
use PHP_Typography\Settings;
use PHP_Typography\Strings;
use PHP_Typography\Text_Parser;
use PHP_Typography\Text_Parser\Token;
use PHP_Typography\U;
Expand Down Expand Up @@ -190,10 +191,13 @@ private function split_domain( string $domain, Settings $settings ): string {
* @return string The hyphenated domain name.
*/
private function split_path( string $path, Settings $settings ): string {
$str_split = Strings::functions( $path )['str_split'];

// Break up the URL path to individual characters.
$path_parts = \str_split( $path, 1 ); // TODO: Does not work with non-ASCII paths.
$path_parts = $str_split( $path, 1 );
$path_count = \count( $path_parts );
$split_path = '';

foreach ( $path_parts as $index => $part ) {
if ( 0 === $index || $path_count - $index < $settings->min_after_url_wrap ) {
$split_path .= $part;
Expand Down
3 changes: 0 additions & 3 deletions tests/class-php-typography-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@
use PHP_Typography\DOM;
use PHP_Typography\PHP_Typography;
use PHP_Typography\Settings;
use PHP_Typography\Strings;
use PHP_Typography\U;

use PHP_Typography\Settings\Quote_Style;

use PHP_Typography\Fixes\Default_Registry;
use PHP_Typography\Fixes\Node_Fix;
use PHP_Typography\Fixes\Token_Fix;
use PHP_Typography\Fixes\Registry;

use PHP_Typography\Hyphenator\Cache as Hyphenator_Cache;
Expand Down
1 change: 0 additions & 1 deletion tests/class-testcase.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

namespace PHP_Typography\Tests;

use PHP_Typography\Strings;
use PHP_Typography\U;
use PHP_Typography\Text_Parser\Token;

Expand Down
3 changes: 2 additions & 1 deletion tests/class-text-parser-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
namespace PHP_Typography\Tests;

use PHP_Typography\Exceptions\Invalid_Encoding_Exception;
use PHP_Typography\Text_Parser\Token;

use PHP_Typography\Text_Parser;
use PHP_Typography\Text_Parser\Token;

/**
* Unit test for \PHP_Typography\Text_Parser class.
Expand Down
4 changes: 2 additions & 2 deletions tests/fixes/class-default-registry-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* This file is part of PHP-Typography.
*
* Copyright 2017-2022 Peter Putzer.
* Copyright 2017-2024 Peter Putzer.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -42,7 +42,7 @@
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
*/
class Default_Registry_Test extends \PHP_Typography\Tests\Testcase {
class Default_Registry_Test extends Testcase {

/**
* Tests constructor.
Expand Down
8 changes: 3 additions & 5 deletions tests/fixes/class-registry-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* This file is part of PHP-Typography.
*
* Copyright 2017-2022 Peter Putzer.
* Copyright 2017-2024 Peter Putzer.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -24,14 +24,12 @@

namespace PHP_Typography\Tests\Fixes;

use PHP_Typography\Fixes\Registry;
use PHP_Typography\Hyphenator\Cache as Hyphenator_Cache;
use PHP_Typography\Settings;

use PHP_Typography\Fixes\Node_Fix;
use PHP_Typography\Fixes\Token_Fix;
use PHP_Typography\Fixes\Registry;
use PHP_Typography\Fixes\Node_Fixes\Process_Words_Fix;
use PHP_Typography\Strings;
use PHP_Typography\U;

use PHP_Typography\Tests\Testcase;

Expand Down
3 changes: 1 addition & 2 deletions tests/fixes/node-fixes/class-abstract-node-fix-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* This file is part of PHP-Typography.
*
* Copyright 2015-2020 Peter Putzer.
* Copyright 2015-2024 Peter Putzer.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -25,7 +25,6 @@
namespace PHP_Typography\Tests\Fixes\Node_Fixes;

use PHP_Typography\Fixes\Node_Fixes;
use PHP_Typography\Settings;

/**
* Abstract_Node_Fix unit test.
Expand Down
3 changes: 1 addition & 2 deletions tests/fixes/node-fixes/class-classes-dependent-fix-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* This file is part of PHP-Typography.
*
* Copyright 2015-2020 Peter Putzer.
* Copyright 2015-2024 Peter Putzer.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -25,7 +25,6 @@
namespace PHP_Typography\Tests\Fixes\Node_Fixes;

use PHP_Typography\Fixes\Node_Fixes;
use PHP_Typography\Settings;

/**
* Classes_Dependent_Fix unit test.
Expand Down
3 changes: 1 addition & 2 deletions tests/fixes/node-fixes/class-dash-spacing-fix-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* This file is part of PHP-Typography.
*
* Copyright 2015-2019 Peter Putzer.
* Copyright 2015-2024 Peter Putzer.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -25,7 +25,6 @@
namespace PHP_Typography\Tests\Fixes\Node_Fixes;

use PHP_Typography\Fixes\Node_Fixes\Dash_Spacing_Fix;
use PHP_Typography\Settings;

/**
* Dash_Spacing_Fix unit test.
Expand Down
1 change: 0 additions & 1 deletion tests/fixes/node-fixes/class-dewidow-fix-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
namespace PHP_Typography\Tests\Fixes\Node_Fixes;

use PHP_Typography\Fixes\Node_Fixes\Dewidow_Fix;
use PHP_Typography\Settings;
use PHP_Typography\U;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
namespace PHP_Typography\Tests\Fixes\Node_Fixes;

use PHP_Typography\Fixes\Node_Fixes\French_Punctuation_Spacing_Fix;
use PHP_Typography\Settings;

/**
* French_Punctuation_Spacing_Fix unit test.
Expand Down
Loading