Skip to content

Commit f6c82c7

Browse files
authored
Merge pull request #39 from helhum/prepare-20
2 parents 9e385e6 + d996718 commit f6c82c7

20 files changed

Lines changed: 417 additions & 806 deletions

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
strategy:
1010
fail-fast: false
1111
matrix:
12-
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
12+
php: ['8.2', '8.3', '8.4', '8.5']
1313

1414
steps:
1515
- uses: actions/checkout@v2

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/.ddev
2-
/.php_cs.cache
2+
/.php-cs-fixer.cache
3+
/.phpunit.cache
34
/.idea
45
/composer.lock
56
/vendor

.php-cs-fixer.php

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
<?php
2+
if (PHP_SAPI !== 'cli') {
3+
die('This script supports command line usage only. Please check your command.');
4+
}
5+
6+
return (new \PhpCsFixer\Config())
7+
->setParallelConfig(\PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
8+
->setFinder(
9+
(new PhpCsFixer\Finder())
10+
->ignoreVCSIgnored(true)
11+
->in(__DIR__)
12+
->exclude('.github')
13+
->exclude('vendor'),
14+
)
15+
->setRiskyAllowed(true)
16+
->setRules([
17+
'@DoctrineAnnotation' => true,
18+
// @todo: Switch to @PER-CS2x0 once php-cs-fixer's todo list is done: https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7247
19+
'@PER-CS1x0' => true,
20+
'array_indentation' => true,
21+
'array_syntax' => ['syntax' => 'short'],
22+
'cast_spaces' => ['space' => 'none'],
23+
// @todo: Can be dropped once we enable @PER-CS2x0
24+
'concat_space' => ['spacing' => 'one'],
25+
'declare_equal_normalize' => ['space' => 'none'],
26+
'declare_parentheses' => true,
27+
'dir_constant' => true,
28+
// @todo: Can be dropped once we enable @PER-CS2x0
29+
'function_declaration' => [
30+
'closure_fn_spacing' => 'none',
31+
],
32+
'function_to_constant' => [
33+
'functions' => [
34+
'get_called_class',
35+
'get_class',
36+
'get_class_this',
37+
'php_sapi_name',
38+
'phpversion',
39+
'pi',
40+
],
41+
],
42+
'type_declaration_spaces' => true,
43+
'global_namespace_import' => [
44+
'import_classes' => false,
45+
'import_constants' => false,
46+
'import_functions' => false,
47+
],
48+
'list_syntax' => ['syntax' => 'short'],
49+
// @todo: Can be dropped once we enable @PER-CS2x0
50+
'method_argument_space' => true,
51+
'modernize_strpos' => true,
52+
'modernize_types_casting' => true,
53+
'native_function_casing' => true,
54+
'native_function_invocation' => [
55+
'include' => [],
56+
'scope' => 'all',
57+
'strict' => true,
58+
],
59+
'no_alias_functions' => true,
60+
'no_blank_lines_after_phpdoc' => true,
61+
'no_empty_phpdoc' => true,
62+
'no_empty_statement' => true,
63+
'no_extra_blank_lines' => true,
64+
'no_leading_namespace_whitespace' => true,
65+
'no_null_property_initialization' => true,
66+
'no_short_bool_cast' => true,
67+
'no_singleline_whitespace_before_semicolons' => true,
68+
'no_superfluous_elseif' => true,
69+
'no_trailing_comma_in_singleline' => true,
70+
'no_unneeded_control_parentheses' => true,
71+
'no_unused_imports' => true,
72+
'no_useless_else' => true,
73+
'no_useless_nullsafe_operator' => true,
74+
'nullable_type_declaration' => [
75+
'syntax' => 'question_mark',
76+
],
77+
'nullable_type_declaration_for_default_null_value' => true,
78+
'ordered_class_elements' => ['order' => ['use_trait', 'case', 'constant', 'property']],
79+
'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'],
80+
'php_unit_construct' => ['assertions' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']],
81+
'php_unit_mock_short_will_return' => true,
82+
'php_unit_test_case_static_method_calls' => [
83+
'call_type' => 'self',
84+
'methods' => [
85+
'any' => 'this',
86+
'atLeast' => 'this',
87+
'atLeastOnce' => 'this',
88+
'atMost' => 'this',
89+
'exactly' => 'this',
90+
'never' => 'this',
91+
'onConsecutiveCalls' => 'this',
92+
'once' => 'this',
93+
'returnArgument' => 'this',
94+
'returnCallback' => 'this',
95+
'returnSelf' => 'this',
96+
'returnValue' => 'this',
97+
'returnValueMap' => 'this',
98+
'throwException' => 'this',
99+
],
100+
],
101+
'phpdoc_no_access' => true,
102+
'phpdoc_no_empty_return' => true,
103+
'phpdoc_no_package' => true,
104+
'phpdoc_scalar' => true,
105+
'phpdoc_trim' => true,
106+
'phpdoc_types' => true,
107+
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
108+
'protected_to_private' => true,
109+
'return_type_declaration' => ['space_before' => 'none'],
110+
'single_quote' => true,
111+
'single_space_around_construct' => true,
112+
'single_line_comment_style' => ['comment_types' => ['hash']],
113+
// @todo: Can be dropped once we enable @PER-CS2x0
114+
'single_line_empty_body' => true,
115+
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
116+
'whitespace_after_comma_in_array' => ['ensure_single_space' => true],
117+
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
118+
]);

.php_cs.dist

Lines changed: 0 additions & 49 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -42,37 +42,8 @@ return array(
4242
);
4343
```
4444

45-
The '::class' constant is not available before PHP 5.5. Under a PHP before 5.5 the mapping file can look like this:
4645

47-
```
48-
<?php
49-
return array(
50-
'Tx_About_Controller_AboutController' => 'TYPO3\\CMS\\About\\Controller\\AboutController',
51-
'Tx_About_Domain_Model_Extension' => 'TYPO3\\CMS\\About\\Domain\\Model\\Extension',
52-
'Tx_About_Domain_Repository_ExtensionRepository' => 'TYPO3\\CMS\\About\\Domain\\Repository\\ExtensionRepository',
53-
'Tx_Aboutmodules_Controller_ModulesController' => 'TYPO3\\CMS\\Aboutmodules\\Controller\\ModulesController',
54-
);
55-
```
56-
57-
In your *root* `composer.json` file, you can decide whether to allow classes to be found that are requested with wrong casing.
58-
Since PHP is case insensitive for class names, but PSR class loading standards bound file names to class names, class names de facto
59-
become case sensitive. For legacy packages it may be useful however to allow class names to be loaded even if wrong casing is provided.
60-
For this to work properly, you need to use the composer [optimize class loading information feature](https://getcomposer.org/doc/03-cli.md#global-options).
61-
62-
63-
You can activate this feature like this:
64-
65-
```
66-
"extra": {
67-
"typo3/class-alias-loader": {
68-
"autoload-case-sensitivity": false
69-
}
70-
},
71-
```
72-
73-
The default value of this option is `true`.
74-
75-
If no alias mapping is found and case sensitivity is set to `true` then by default this package does nothing. It means no additional class loading information is dumped
46+
If no alias mapping is found then by default this package does nothing. It means no additional class loading information is dumped
7647
and the `vendor/autoload.php` is not changed. This enables library vendors to deliver compatibility packages which provide such aliases
7748
for backwards compatibility, but keep the library clean (and faster) for new users.
7849

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,22 @@
2020
"psr-4": { "TYPO3\\ClassAliasLoader\\Test\\": "tests/"}
2121
},
2222
"require": {
23-
"php": ">=7.1",
23+
"php": ">=8.2",
2424
"composer-plugin-api": "^2.0"
2525
},
2626
"require-dev": {
2727
"composer/composer": "^2.0@dev",
2828
"mikey179/vfsstream": "~1.4.0@dev",
29-
"phpunit/phpunit": "^8 || ^9"
29+
"phpunit/phpunit": "^11",
30+
"friendsofphp/php-cs-fixer": "^3.95"
3031
},
3132
"replace": {
3233
"helhum/class-alias-loader": "*"
3334
},
3435
"extra": {
3536
"class": "TYPO3\\ClassAliasLoader\\Plugin",
3637
"branch-alias": {
37-
"dev-main": "1.1.x-dev"
38+
"dev-main": "2.0.x-dev"
3839
}
3940
}
4041
}

phpunit.xml.dist

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,24 @@
1-
<phpunit
2-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
4-
beStrictAboutTestsThatDoNotTestAnything="true"
5-
cacheResult="false"
6-
colors="true"
7-
convertDeprecationsToExceptions="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
failOnRisky="true"
12-
failOnWarning="true"
13-
forceCoversAnnotation="false"
14-
processIsolation="false"
15-
stopOnError="false"
16-
stopOnFailure="false"
17-
stopOnIncomplete="false"
18-
stopOnSkipped="false"
19-
verbose="false"
20-
>
21-
<testsuites>
22-
<testsuite name="Unit tests">
23-
<directory>tests/Unit/</directory>
24-
</testsuite>
25-
</testsuites>
26-
<php>
27-
<ini name="error_reporting" value="E_ALL" />
28-
</php>
1+
<?xml version="1.0"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
4+
beStrictAboutTestsThatDoNotTestAnything="true"
5+
cacheResult="false"
6+
colors="true"
7+
failOnRisky="true"
8+
failOnWarning="true"
9+
processIsolation="false"
10+
stopOnError="false"
11+
stopOnFailure="false"
12+
stopOnIncomplete="false"
13+
stopOnSkipped="false"
14+
cacheDirectory=".phpunit.cache"
15+
requireCoverageMetadata="false">
16+
<testsuites>
17+
<testsuite name="Unit tests">
18+
<directory>tests/Unit/</directory>
19+
</testsuite>
20+
</testsuites>
21+
<php>
22+
<ini name="error_reporting" value="E_ALL"/>
23+
</php>
2924
</phpunit>
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
$composerAutoLoader = require dirname(__DIR__) . '/autoload.php';
46
$classAliasMap = require dirname(__DIR__) . '/composer/autoload_classaliasmap.php';
57
$classAliasLoader = new TYPO3\ClassAliasLoader\ClassAliasLoader($composerAutoLoader);
68
$classAliasLoader->setAliasMap($classAliasMap);
7-
$classAliasLoader->setCaseSensitiveClassLoading('{$sensitive-loading}');
89
$classAliasLoader->register('{$prepend}');
910
TYPO3\ClassAliasLoader\ClassAliasMap::setClassAliasLoader($classAliasLoader);

0 commit comments

Comments
 (0)