Skip to content

Commit 2b24208

Browse files
authored
Merge pull request #105 from perplorm/strict_types
phpcs: Strict types, global functions, annotations cleanup, license block
2 parents 9037672 + d6824ef commit 2b24208

File tree

426 files changed

+2176
-2939
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

426 files changed

+2176
-2939
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ jobs:
152152
check: ['PHPCS', 'Stan']
153153
include:
154154
- check: PHPCS
155-
command: 'cs-check'
155+
command: 'cs-check -- --exclude=SlevomatCodingStandard.TypeHints.DeclareStrictTypes,SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly'
156156
- check: Stan
157157
command: 'stan -- -a autoload.php.dist'
158158
- type: query

.license

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +0,0 @@
1-
/**
2-
* MIT License. This file is part of the Propel package.
3-
* For the full copyright and license information, please view the LICENSE
4-
* file that was distributed with this source code.
5-
*/

phpcs.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,26 @@
2929
<property name="phpVersion" value="8.1"/>
3030
</properties>
3131
</rule>
32+
33+
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes"/>
34+
35+
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly" >
36+
<properties>
37+
<property name="allowFallbackGlobalFunctions" value="false"/>
38+
<property name="allowFallbackGlobalConstants" value="false"/>
39+
</properties>
40+
</rule>
41+
42+
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenAnnotations">
43+
<properties>
44+
<property name="forbiddenAnnotations" type="array">
45+
<element value="@author"/>
46+
<element value="@created"/>
47+
<element value="@copyright"/>
48+
<element value="@license"/>
49+
<element value="@package"/>
50+
<element value="@version"/>
51+
</property>
52+
</properties>
53+
</rule>
3254
</ruleset>

src/Propel/Common/Config/ConfigurationManager.php

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
<?php
22

3-
/**
4-
* MIT License. This file is part of the Propel package.
5-
* For the full copyright and license information, please view the LICENSE
6-
* file that was distributed with this source code.
7-
*/
3+
declare(strict_types = 1);
84

95
namespace Propel\Common\Config;
106

@@ -15,13 +11,32 @@
1511
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException as SymfonyInvalidConfigurationException;
1612
use Symfony\Component\Config\Definition\Processor;
1713
use Symfony\Component\Finder\Finder;
14+
use function array_any;
15+
use function array_filter;
16+
use function array_key_exists;
17+
use function array_key_first;
18+
use function array_keys;
19+
use function array_merge_recursive;
20+
use function array_pop;
21+
use function array_reduce;
22+
use function array_replace_recursive;
23+
use function array_reverse;
24+
use function explode;
25+
use function file_exists;
26+
use function getcwd;
27+
use function implode;
28+
use function in_array;
29+
use function is_dir;
30+
use function is_string;
31+
use function ksort;
32+
use function str_ends_with;
33+
use function var_export;
34+
use const PHP_EOL;
1835

1936
/**
2037
* Class ConfigurationManager
2138
*
2239
* Class to load and process configuration files. Supported formats are: php, ini (or .properties), yaml, xml, json.
23-
*
24-
* @author Cristiano Cinotti
2540
*/
2641
class ConfigurationManager
2742
{
@@ -303,7 +318,7 @@ private function getConfigFileNamesFromDirectory(string $path): array
303318
$orderedConfigFileNames = [];
304319
foreach ($finder as $file) {
305320
$realPath = $file->getRealPath();
306-
$isExecutable = array_any(['propel', 'perpl'], fn ($cmd) => str_ends_with($realPath, "/bin/{$cmd}.php"));
321+
$isExecutable = $realPath && array_any(['propel', 'perpl'], fn ($cmd) => str_ends_with($realPath, "/bin/{$cmd}.php"));
307322
if ($isExecutable) {
308323
continue;
309324
}

src/Propel/Common/Config/Exception/ExceptionInterface.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
<?php
22

3-
/**
4-
* MIT License. This file is part of the Propel package.
5-
* For the full copyright and license information, please view the LICENSE
6-
* file that was distributed with this source code.
7-
*/
3+
declare(strict_types = 1);
84

95
namespace Propel\Common\Config\Exception;
106

src/Propel/Common/Config/Exception/IniParseException.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
<?php
22

3-
/**
4-
* MIT License. This file is part of the Propel package.
5-
* For the full copyright and license information, please view the LICENSE
6-
* file that was distributed with this source code.
7-
*/
3+
declare(strict_types = 1);
84

95
namespace Propel\Common\Config\Exception;
106

src/Propel/Common/Config/Exception/InputOutputException.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
<?php
22

3-
/**
4-
* MIT License. This file is part of the Propel package.
5-
* For the full copyright and license information, please view the LICENSE
6-
* file that was distributed with this source code.
7-
*/
3+
declare(strict_types = 1);
84

95
namespace Propel\Common\Config\Exception;
106

src/Propel/Common/Config/Exception/InvalidArgumentException.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
<?php
22

3-
/**
4-
* MIT License. This file is part of the Propel package.
5-
* For the full copyright and license information, please view the LICENSE
6-
* file that was distributed with this source code.
7-
*/
3+
declare(strict_types = 1);
84

95
namespace Propel\Common\Config\Exception;
106

src/Propel/Common/Config/Exception/InvalidConfigurationException.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
<?php
22

3-
/**
4-
* MIT License. This file is part of the Propel package.
5-
* For the full copyright and license information, please view the LICENSE
6-
* file that was distributed with this source code.
7-
*/
3+
declare(strict_types = 1);
84

95
namespace Propel\Common\Config\Exception;
106

src/Propel/Common/Config/Exception/JsonParseException.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
<?php
22

3-
/**
4-
* MIT License. This file is part of the Propel package.
5-
* For the full copyright and license information, please view the LICENSE
6-
* file that was distributed with this source code.
7-
*/
3+
declare(strict_types = 1);
84

95
namespace Propel\Common\Config\Exception;
106

7+
use function function_exists;
8+
use function json_last_error_msg;
9+
use const JSON_ERROR_CTRL_CHAR;
10+
use const JSON_ERROR_DEPTH;
11+
use const JSON_ERROR_STATE_MISMATCH;
12+
use const JSON_ERROR_SYNTAX;
13+
use const JSON_ERROR_UTF8;
14+
1115
class JsonParseException extends RuntimeException implements ExceptionInterface
1216
{
1317
/**

0 commit comments

Comments
 (0)