Questions tagged [php-8.2]

For questions specific to the usage and new features of PHP 8.2. Also, include the more generic [php] tag when using this tag.

PHP 8.2 was released in November 2022

A list of features and changes can be found in the migration guide

80 questions
1
vote
2 answers

Troubles with mocking new PHP 8.2 readonly classes with PHPUnit test doubles

I try to mock readonly class from PHP 8.2 in PHPUnit and got next error: Symfony\Component\ErrorHandler\Error\FatalError^ {#7 #message: "Compile Error: Non-readonly class Mock_Provider_f80b7c4d cannot extend readonly class…
1
vote
0 answers

declare(strict_types=1) globally in PHP 8.2

With all the new upgrades released in PHP 8.2 with readonly classes, is it possible to do: declare(strict_types=1); globally in a project?
RG Servers
  • 1,726
  • 2
  • 11
  • 27
1
vote
0 answers

Installing pdo_pgsql and pgsql on macOS Ventura Version 13.1

I want to use postgresql on my laravel project, and I have enabled extensions for pdo_pgsql and pgsql in php.ini (php 8.2); however, I face two problems below: Warning: PHP Startup: Unable to load dynamic library 'pdo_pgsql' Warning: PHP Startup:…
0
votes
1 answer

Does PHP8 Reflection more bad performance versus PHP7 without reflection

I have re write my code from old php 7.4 scripts. And i see my code be more slower than old version My old models export data from method toArray And his representation was like that public function toArray() { return [ "id" => $this->id; …
Rocket
  • 93
  • 2
  • 10
0
votes
0 answers

Initialize user_id globally if user is authenticated in laravel 10

I'm using Setting package (https://packagist.org/packages/anlutro/l4-settings) in laravel 10 project and there is a feature to use custom settings for each individual user using this method:
0
votes
0 answers

Route [posts.category] not defined

I'm learning Laravel 10 and trying to make a sub Route of my Route ressource posts. in my web.php : *// path: routes/web.php* ... Route::ressource('posts', PostController::class) ->only(['index', 'store', 'category']) ->middleware(['auth',…
0
votes
0 answers

MAMP and PHP new versions

Do you know if MAMP (free) can support versions of PHP newer than 8.2.0, like 8.2.8? I have installed the 8.2.8 version, it appears in the switcher options of the dialog box of MAMP (together with the 8.2.0, the other available version), I use it,…
limakid
  • 71
  • 11
0
votes
1 answer

Routes Resources problems on laravel 10-php 8.2

I have problem with routes if using resource. I upgrade from php 7.4/laravel 7 to php 8.2/laravel 10. After upgrade all routes error. target class controller does not exist laravel 7 code Route::get('home',…
sql query
  • 7
  • 1
0
votes
1 answer

is this the correct way to doc block a callable's output in php 8.2?

I would like to properly document a PHP 8.2 inline callable's output for an array of strings. here's an example: /** @var callable $params : Array */ $params = fn() : array => array_map( $format(...), [ $fieldId, …
Shawn Naquin
  • 73
  • 10
0
votes
0 answers

PHP built in web server on network

sudo ufw status Status: active To Action From -- ------ ---- 8080 ALLOW Anywhere 8080 (v6) ALLOW Anywhere (v6) …
alex
  • 51
  • 5
0
votes
1 answer

PHP-8.2 insert_id returns 0

I know this question has been asked many times before and I feel kinda stupid, but I can't get it to work. So I'm trying to get the insert_id after calling a prepared statement that inserts a single row of data. The return value is always 0. What am…
mannaris
  • 63
  • 8
0
votes
0 answers

yii2 advanced template with docker/nginx/php8.2

I want to install Yii2 advanced template with nginx server , mysql 8 DB , php 8.2 , and to enable xdebug also inside I tried to install template from official website here, & from git here, or here in Dockerfile : FROM…
Toqa Abbas
  • 11
  • 3
0
votes
0 answers

Publishing a Tarball to NPM Missing Cache

I have am building a new NPM package to be published. In doing so am generating files that will be included via PHP. These are added to a tarball as in the following snippet. $disk = 'local'; $path = '/'; $tarball = new…
Marshall Davis
  • 3,337
  • 5
  • 39
  • 47
0
votes
1 answer

How to document a Laravel model attribute as deprecated?

I have an eloquent model in Laravel that I would like to mark an user_id attribute as deprecated using the @deprectated tag in PHPDoc. I can add the @property tag to my model to document user_id but if I try to add the deprecated tag my IDE (vscode)…
Jamie Woods
  • 517
  • 2
  • 10
  • 25
0
votes
0 answers

Change layout in EasyAdmin4 CollectionField

I'm new into Symfony(5.4) + EasyAdmin(4) bundle. I need to display a CollectionField in full-screen mode and display all the fields in one row, maximum two rows. Click here for the screenshot I tried to achieve this by modifying only the CSS, but…
Juls
  • 1
  • 1