File tree 11 files changed +60
-17
lines changed
11 files changed +60
-17
lines changed Original file line number Diff line number Diff line change
1
+ # These are supported funding model platforms
2
+
3
+ github : byjg
Original file line number Diff line number Diff line change @@ -16,15 +16,15 @@ jobs:
16
16
strategy :
17
17
matrix :
18
18
php-version :
19
+ - " 8.3"
19
20
- " 8.2"
20
21
- " 8.1"
21
- - " 8.0"
22
- - " 7.4"
23
22
24
23
steps :
25
24
- uses : actions/checkout@v4
26
25
- run : composer install
27
26
- run : ./vendor/bin/phpunit
27
+ - run : ./vendor/bin/psalm
28
28
29
29
Documentation :
30
30
if : github.ref == 'refs/heads/master'
Original file line number Diff line number Diff line change
1
+ <component name =" ProjectRunConfigurationManager" >
2
+ <configuration default =" false" name =" PHPUnit" type =" PHPUnitRunConfigurationType" factoryName =" PHPUnit" >
3
+ <TestRunner configuration_file =" $PROJECT_DIR$/phpunit.xml.dist" scope =" XML" use_alternative_configuration_file =" true" />
4
+ <method v =" 2" />
5
+ </configuration >
6
+ </component >
Original file line number Diff line number Diff line change
1
+ <component name =" ProjectRunConfigurationManager" >
2
+ <configuration default =" false" name =" PSalm" type =" PhpLocalRunConfigurationType" factoryName =" PHP Console" path =" $PROJECT_DIR$/vendor/bin/psalm" >
3
+ <method v =" 2" />
4
+ </configuration >
5
+ </component >
Original file line number Diff line number Diff line change 6
6
"ByJG\\ DesignPattern\\ " : " src/"
7
7
}
8
8
},
9
+ "autoload-dev" : {
10
+ "psr-4" : {
11
+ "Tests\\ " : " tests/"
12
+ }
13
+ },
9
14
"require" : {
10
- "php" : " >=7 .4"
15
+ "php" : " >=8.1 <8 .4"
11
16
},
12
17
"require-dev" : {
13
- "phpunit/phpunit" : " 5.7.*|7.4.*|^9.5"
18
+ "phpunit/phpunit" : " ^9.6" ,
19
+ "vimeo/psalm" : " ^5.9"
14
20
},
15
21
"license" : " MIT"
16
22
}
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <psalm
3
+ errorLevel =" 4"
4
+ resolveFromConfigFile =" true"
5
+ findUnusedBaselineEntry =" true"
6
+ findUnusedCode =" false"
7
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
8
+ xmlns =" https://getpsalm.org/schema/config"
9
+ xsi : schemaLocation =" https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
10
+ >
11
+ <projectFiles >
12
+ <directory name =" src" />
13
+ <directory name =" tests" />
14
+ <ignoreFiles >
15
+ <directory name =" vendor" />
16
+ </ignoreFiles >
17
+ </projectFiles >
18
+ </psalm >
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ public function __wakeup()
36
36
/**
37
37
* @return static
38
38
*/
39
- public static function getInstance ()
39
+ public static function getInstance (): static
40
40
{
41
41
static $ instances ;
42
42
Original file line number Diff line number Diff line change 2
2
3
3
namespace ByJG \DesignPattern ;
4
4
5
- class SingletonException extends \Exception
5
+ use Exception ;
6
+
7
+ class SingletonException extends Exception
6
8
{
7
9
8
10
}
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
- require_once __DIR__ . "/../vendor/autoload.php " ;
3
+ namespace Tests ;
4
+
5
+ use ByJG \DesignPattern \Singleton ;
4
6
5
7
class Sample1
6
8
{
7
- use \ ByJG \ DesignPattern \ Singleton;
9
+ use Singleton;
8
10
9
- public $ property ;
11
+ public int $ property ;
10
12
11
13
private function __construct ()
12
14
{
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
- require_once __DIR__ . "/../vendor/autoload.php " ;
3
+ namespace Tests ;
4
+
5
+ use ByJG \DesignPattern \Singleton ;
4
6
5
7
class Sample2
6
8
{
7
- use \ ByJG \ DesignPattern \ Singleton;
9
+ use Singleton;
8
10
9
- public $ property2 ;
11
+ public int $ property2 ;
10
12
}
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
- use ByJG \ DesignPattern \ SingletonException ;
3
+ namespace Tests ;
4
4
5
- require_once __DIR__ . "/../vendor/autoload.php " ;
6
- require_once "Sample1.php " ;
7
- require_once "Sample2.php " ;
5
+ use ByJG \DesignPattern \SingletonException ;
6
+ use PHPUnit \Framework \TestCase ;
8
7
9
- class SingletonTest extends \ PHPUnit \ Framework \ TestCase
8
+ class SingletonTest extends TestCase
10
9
{
11
10
public function testSingleton ()
12
11
{
You can’t perform that action at this time.
0 commit comments