Skip to content

Commit a028cf4

Browse files
committed
Apply typed properties
1 parent cf2afed commit a028cf4

8 files changed

+16
-29
lines changed

src/FrontendPublisher.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,15 @@ abstract class FrontendPublisher extends Publisher
1818
/**
1919
* Destination path relative to AssetsConfig::directory.
2020
* Must be set by child classes.
21-
*
22-
* @var string
2321
*/
24-
protected $path;
22+
protected string $path = '';
2523

2624
/**
2725
* Set the real destination.
2826
*/
2927
public function __construct(?string $source = null, ?string $destination = null)
3028
{
31-
if (! is_string($this->path)) {
29+
if ($this->path === '') {
3230
throw new DomainException('Invalid relative destination $path.');
3331
}
3432

src/Publishers/AdminLTEPublisher.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
class AdminLTEPublisher extends FrontendPublisher
88
{
9-
protected $source = 'vendor/almasaeed2010/adminlte/dist';
10-
protected $path = 'adminlte';
9+
protected $source = 'vendor/almasaeed2010/adminlte/dist';
10+
protected string $path = 'adminlte';
1111
}

src/Publishers/BootstrapPublisher.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
class BootstrapPublisher extends FrontendPublisher
88
{
9-
protected $source = 'vendor/twbs/bootstrap/dist';
10-
protected $path = 'bootstrap';
9+
protected $source = 'vendor/twbs/bootstrap/dist';
10+
protected string $path = 'bootstrap';
1111
}

src/Publishers/DataTablesPublisher.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
class DataTablesPublisher extends FrontendPublisher
88
{
9-
protected $source = 'vendor/datatables.net/datatables.net';
10-
protected $path = 'datatables';
9+
protected $source = 'vendor/datatables.net/datatables.net';
10+
protected string $path = 'datatables';
1111

1212
/**
1313
* Reads files from the sources and copies them out to their destinations.

src/Publishers/DataTablesStylePublisher.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
class DataTablesStylePublisher extends FrontendPublisher
88
{
9-
protected $source = 'vendor/datatables.net/datatables.net-bs4';
10-
protected $path = 'datatables';
9+
protected $source = 'vendor/datatables.net/datatables.net-bs4';
10+
protected string $path = 'datatables';
1111

1212
/**
1313
* Reads files from the sources and copies them out to their destinations.

src/Publishers/FontAwesomePublisher.php

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,8 @@
66

77
class FontAwesomePublisher extends FrontendPublisher
88
{
9-
/**
10-
* @var string
11-
*/
12-
protected $source = 'vendor/fortawesome/font-awesome';
13-
14-
/**
15-
* Destination path relative to AssetsConfig::directory.
16-
*
17-
* @see FrontendPublisher::__construct()
18-
*
19-
* @var string
20-
*/
21-
protected $path = 'font-awesome';
9+
protected $source = 'vendor/fortawesome/font-awesome';
10+
protected string $path = 'font-awesome';
2211

2312
/**
2413
* Reads files from the sources and copies them out to their destinations.

src/Publishers/JQueryPublisher.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
class JQueryPublisher extends FrontendPublisher
88
{
9-
protected $source = 'vendor/components/jquery';
10-
protected $path = 'jquery';
9+
protected $source = 'vendor/components/jquery';
10+
protected string $path = 'jquery';
1111
}

tests/FrontendPublisherTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public function testPublisherSetsDestination()
2525
// Allow publishing to the test folder
2626
config('Publisher')->restrictions[SUPPORTPATH] = '*';
2727

28-
$publisher = new class () extends FrontendPublisher {
29-
protected $path = 'foobar';
28+
$publisher = new class () extends FrontendPublisher {
29+
protected string $path = 'foobar';
3030
};
3131

3232
$this->assertSame($this->assets->directory . 'vendor/foobar/', $publisher->getDestination());

0 commit comments

Comments
 (0)