Skip to content

Commit 76b9d2c

Browse files
fxikf3l1x
authored andcommitted
Upgrade skeleton to PHP 8.4 and modern stack
1 parent c33fa5f commit 76b9d2c

28 files changed

Lines changed: 683 additions & 1119 deletions

.docker/php/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM thecodingmachine/php:8.2-v4-fpm
1+
FROM thecodingmachine/php:8.4-v4-fpm
22

33
COPY ./ /var/www/html/
44

.github/workflows/tests.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,9 @@ jobs:
1717
with:
1818
php: "8.5"
1919

20-
test83:
20+
test84:
2121
name: "Nette Tester"
2222
uses: contributte/.github/.github/workflows/nette-tester.yml@v1
2323
with:
24-
php: "8.3"
25-
make: "init tests"
26-
27-
test82:
28-
name: "Nette Tester"
29-
uses: contributte/.github/.github/workflows/nette-tester.yml@v1
30-
with:
31-
php: "8.2"
24+
php: "8.4"
3225
make: "init tests"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Main goal is to provide best prepared API starter-kit project for Nette-Apitte d
3030

3131
Focused on:
3232

33-
- PHP 8.2+
33+
- PHP 8.4+
3434
- `nette/*` packages
3535
- build PSR-7 API via `contributte/apitte`
3636
- Doctrine ORM via `nettrine/*`
@@ -187,7 +187,7 @@ Available options are:
187187
188188
Here is a list of all features you can find in this project.
189189
190-
- PHP 8.2+
190+
- PHP 8.4+
191191
- :package: Packages
192192
- Nette 3+
193193
- Contributte

app/Domain/Api/Facade/UsersFacade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function create(CreateUserReqDto $dto): User
7272
);
7373

7474
$this->em->persist($user);
75-
$this->em->flush($user);
75+
$this->em->flush();
7676

7777
return $user;
7878
}

app/Domain/User/User.php

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
use Doctrine\ORM\Mapping as ORM;
1212
use Nette\Utils\Random;
1313

14-
/**
15-
* @ORM\Entity(repositoryClass="UserRepository")
16-
* @ORM\Table(name="`user`")
17-
* @ORM\HasLifecycleCallbacks
18-
*/
14+
#[ORM\Entity(repositoryClass: UserRepository::class)]
15+
#[ORM\Table(name: '`user`')]
16+
#[ORM\HasLifecycleCallbacks]
1917
class User extends AbstractEntity
2018
{
2119

@@ -32,34 +30,31 @@ class User extends AbstractEntity
3230

3331
public const STATES = [self::STATE_FRESH, self::STATE_BLOCKED, self::STATE_ACTIVATED];
3432

35-
/** @ORM\Column(type="string", length=255, nullable=FALSE, unique=false) */
33+
#[ORM\Column(type: 'string', length: 255, nullable: false, unique: false)]
3634
private string $name;
3735

38-
/** @ORM\Column(type="string", length=255, nullable=FALSE, unique=false) */
36+
#[ORM\Column(type: 'string', length: 255, nullable: false, unique: false)]
3937
private string $surname;
4038

41-
/** @ORM\Column(type="string", length=255, nullable=FALSE, unique=TRUE) */
39+
#[ORM\Column(type: 'string', length: 255, nullable: false, unique: true)]
4240
private string $email;
4341

44-
/** @ORM\Column(type="string", length=255, nullable=FALSE, unique=TRUE) */
42+
#[ORM\Column(type: 'string', length: 255, nullable: false, unique: true)]
4543
private string $username;
4644

47-
/** @ORM\Column(type="integer", length=10, nullable=FALSE) */
45+
#[ORM\Column(type: 'integer', length: 10, nullable: false)]
4846
private int $state;
4947

50-
/** @ORM\Column(type="string", length=255, nullable=FALSE) */
48+
#[ORM\Column(type: 'string', length: 255, nullable: false)]
5149
private string $password;
5250

53-
/** @ORM\Column(type="string", length=255, nullable=FALSE) */
51+
#[ORM\Column(type: 'string', length: 255, nullable: false)]
5452
private string $role;
5553

56-
/** @ORM\Column(type="string", length=255, nullable=FALSE) */
54+
#[ORM\Column(type: 'string', length: 255, nullable: false)]
5755
private string $apikey;
5856

59-
/**
60-
* @var DateTime|NULL
61-
* @ORM\Column(type="datetime", nullable=TRUE)
62-
*/
57+
#[ORM\Column(type: 'datetime', nullable: true)]
6358
private ?DateTime $lastLoggedAt = null;
6459

6560
public function __construct(string $name, string $surname, string $email, string $username, string $passwordHash)

app/Model/Database/Entity/TCreatedAt.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,15 @@
88
trait TCreatedAt
99
{
1010

11-
/** @ORM\Column(type="datetime", nullable=FALSE) */
11+
#[ORM\Column(type: 'datetime', nullable: false)]
1212
protected DateTime $createdAt;
1313

1414
public function getCreatedAt(): DateTime
1515
{
1616
return $this->createdAt;
1717
}
1818

19-
/**
20-
* Doctrine annotation
21-
*
22-
* @ORM\PrePersist
23-
* @internal
24-
*/
19+
#[ORM\PrePersist]
2520
public function setCreatedAt(): void
2621
{
2722
$this->createdAt = new DateTime();

app/Model/Database/Entity/TId.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77
trait TId
88
{
99

10-
/**
11-
* @ORM\Column(type="integer", nullable=FALSE)
12-
* @ORM\Id
13-
* @ORM\GeneratedValue
14-
*/
10+
#[ORM\Column(type: 'integer', nullable: false)]
11+
#[ORM\Id]
12+
#[ORM\GeneratedValue]
1513
private int $id;
1614

1715
public function getId(): int

app/Model/Database/Entity/TUpdatedAt.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,15 @@
88
trait TUpdatedAt
99
{
1010

11-
/**
12-
* @var DateTime|NULL
13-
* @ORM\Column(type="datetime", nullable=TRUE)
14-
*/
11+
#[ORM\Column(type: 'datetime', nullable: true)]
1512
protected ?DateTime $updatedAt = null;
1613

1714
public function getUpdatedAt(): ?DateTime
1815
{
1916
return $this->updatedAt;
2017
}
2118

22-
/**
23-
* Doctrine annotation
24-
*
25-
* @ORM\PreUpdate
26-
* @internal
27-
*/
19+
#[ORM\PreUpdate]
2820
public function setUpdatedAt(): void
2921
{
3022
$this->updatedAt = new DateTime();

app/Module/BaseController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
use Apitte\Core\Annotation\Controller as Apitte;
66
use Apitte\Core\UI\Controller\IController;
77

8-
/**
9-
* @Apitte\Path("/api")
10-
* @Apitte\Id("api")
11-
*/
8+
#[Apitte\Path('/api')]
9+
#[Apitte\Id('api')]
1210
abstract class BaseController implements IController
1311
{
1412

app/Module/BasePubController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
use Apitte\Core\Annotation\Controller as Apitte;
66
use Apitte\Core\UI\Controller\IController;
77

8-
/**
9-
* @Apitte\Path("/api/public")
10-
* @Apitte\Id("api-public")
11-
*/
8+
#[Apitte\Path('/api/public')]
9+
#[Apitte\Id('api-public')]
1210
abstract class BasePubController implements IController
1311
{
1412

0 commit comments

Comments
 (0)