Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
007bc0f
github actions updated
dg Feb 3, 2025
b3776b1
composer: require stable packages outside of nette
dg Jun 5, 2025
9ab27c6
composer: added psr-4 loader
dg Jun 5, 2025
908e6f5
tests: improved descriptions
dg Feb 3, 2025
ca55ed7
tests: merges some tests
dg Jun 18, 2025
5c1ce07
ConnectionPanel: convert templates to Latte-like syntax
dg Jan 12, 2025
6db42d6
used generics for Container::createInstance() (#323)
vojtech-dobes Jun 18, 2025
01b29b0
exception: use natural explanatory style
dg Dec 12, 2024
39accab
optimized global function calls
dg Jun 19, 2025
7cdef71
opened 3.3-dev
dg Jun 18, 2025
8990bb8
uses nette/schema 1.3
dg Jun 18, 2025
499e744
uses nette/neon 3.4
dg Jun 18, 2025
4563395
used attribute Deprecated
dg Nov 29, 2024
6f68661
Definition::generateMethod() replaced with generateCode()
dg Dec 1, 2024
a8eb347
Resolver: used withCurrentServiceAvailable() to control $currentServi…
dg Dec 1, 2024
eb6f8df
added Definitions\Expression
dg Dec 2, 2024
ed2b60a
PhpGenerator::formatStatement() moved to Statement & Reference
dg Dec 1, 2024
06a2a70
Resolver::resolve*Type() moved to Statement & Reference
dg Dec 1, 2024
decab76
Resolver::completeStatement() moved to Statement & Reference
dg Dec 1, 2024
f36eb1d
NeonAdapter: processing of 'prevent merging' and 'entity to statement…
dg Dec 2, 2024
9c7619c
added FunctionCallable & MethodCallable, expressions representing fir…
dg Dec 2, 2024
1852e21
opened 4.0-dev
dg Sep 12, 2021
b95b0b0
exception messages use [Service ...]\n format [WIP]
dg Dec 2, 2024
f7bd6c0
annotations @return are no longer supported (BC break)
dg Dec 1, 2024
9fb7893
annotations @var are no longer supported (BC break)
dg Dec 14, 2023
314762d
removed Definition::generateMethod() (BC break)
dg Dec 1, 2024
73c5d17
removed support for three ... dots
dg Dec 11, 2023
d01239d
removed compatibility for old class names
dg Dec 19, 2022
a77b990
deprecated magic properties (BC break)
dg Sep 24, 2021
f8e5082
annotations @inject is deprecated (BC break)
dg Apr 6, 2024
7eda978
used attribute Deprecated
dg Nov 29, 2024
1177415
CI: cover PHP 8.5
staabm Aug 13, 2025
52e6155
Allow PHP 8.5
staabm Aug 13, 2025
c57bd1a
Fix SplObjectStorage->(contains|attach|detach) deprecation
staabm Aug 13, 2025
e771274
Method ReflectionProperty::setAccessible() is a no-op since PHP 8.1+
staabm Aug 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/coding-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: 8.3
coverage: none

- run: composer create-project nette/code-checker temp/code-checker ^3 --no-progress
Expand All @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: 8.3
coverage: none

- run: composer create-project nette/coding-standard temp/coding-standard ^3 --no-progress
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['8.1', '8.2', '8.3', '8.4']
php: ['8.1', '8.2', '8.3', '8.4', '8.5']

fail-fast: false

Expand All @@ -22,9 +22,9 @@ jobs:
- run: composer install --no-progress --prefer-dist
- run: vendor/bin/tester tests -s -C
- if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: output
name: output-${{ matrix.php }}
path: tests/**/output


Expand Down
15 changes: 9 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,25 @@
}
],
"require": {
"php": "8.1 - 8.4",
"php": "8.1 - 8.5",
"ext-tokenizer": "*",
"ext-ctype": "*",
"nette/neon": "^3.3",
"nette/neon": "^3.4",
"nette/php-generator": "^4.1.6",
"nette/robot-loader": "^4.0",
"nette/schema": "^1.2.5",
"nette/schema": "^1.3",
"nette/utils": "^4.0"
},
"require-dev": {
"nette/tester": "^2.5.2",
"tracy/tracy": "^2.9",
"phpstan/phpstan": "^1.0"
"phpstan/phpstan-nette": "^2.0@stable"
},
"autoload": {
"classmap": ["src/"]
"classmap": ["src/"],
"psr-4": {
"Nette\\": "src"
}
},
"minimum-stability": "dev",
"scripts": {
Expand All @@ -39,7 +42,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "3.2-dev"
"dev-master": "4.0-dev"
}
}
}
5 changes: 3 additions & 2 deletions src/Bridges/DITracy/ContainerPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Nette;
use Nette\DI\Container;
use Tracy;
use const SORT_NATURAL;


/**
Expand Down Expand Up @@ -40,7 +41,7 @@ public function getTab(): string
{
return Nette\Utils\Helpers::capture(function () {
$elapsedTime = $this->elapsedTime;
require __DIR__ . '/templates/ContainerPanel.tab.phtml';
require __DIR__ . '/dist/tab.phtml';
});
}

Expand Down Expand Up @@ -76,7 +77,7 @@ public function getPanel(): string
$parameters = $rc->getMethod('getStaticParameters')->getDeclaringClass()->getName() === Container::class
? null
: $container->getParameters();
require __DIR__ . '/templates/ContainerPanel.panel.phtml';
require __DIR__ . '/dist/panel.phtml';
});
}
}
87 changes: 87 additions & 0 deletions src/Bridges/DITracy/dist/panel.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?php
declare(strict_types=1);
?>
<?php use Tracy\Dumper ?>
<style class="tracy-debug">
#tracy-debug .nette-ContainerPanel table {
width: 100%;
white-space: nowrap;
}

#tracy-debug .nette-ContainerPanel .created {
font-weight: bold;
}

#tracy-debug .nette-ContainerPanel .yes {
color: green;
font-weight: bold;
}

#tracy-debug .nette-ContainerPanel table pre {
display: inline;
background: transparent;
padding: 0;
word-break: normal;
}
</style>

<h1>Nette DI Container</h1>

<div class="tracy-inner nette-ContainerPanel">
<div class="tracy-inner-container">
<p>Source: <?= Tracy\Helpers::editorLink($file) ?>
</p>

<table class="tracy-sortable">
<thead>
<tr>
<th>Name</th>
<th>Autowired</th>
<th>Service</th>
<th>Tags</th>
</tr>
</thead>
<tbody>
<?php foreach ($services as $name => $type): ?><?php $name = (string) $name ?><?php $autowired = in_array($name, array_merge($wiring[$type][0] ?? [], $wiring[$type][1] ?? []), strict: true) ?> <tr>
<td class="<?= Tracy\Helpers::escapeHtml(isset($instances[$name]) ? 'created' : '') ?>
">
<?php if (is_numeric($name)): ?>
<small><?= Tracy\Helpers::escapeHtml($name) ?>
</small><?php else: ?>
<?= Tracy\Helpers::escapeHtml($name) ?>

<?php endif ?>
</td>
<td class="<?= Tracy\Helpers::escapeHtml($autowired ? 'yes' : '') ?>
">
<?= Tracy\Helpers::escapeHtml($autowired ? 'yes' : (isset($wiring[$type]) ? 'no' : '?')) ?>

</td>
<td>
<?php if (isset($instances[$name]) && !$instances[$name] instanceof Nette\DI\Container): ?> <?= Dumper::toHtml($instances[$name], [Dumper::COLLAPSE => true, Dumper::LIVE => true, Dumper::DEPTH => 5]) ?>

<?php elseif (isset($instances[$name])): ?> <code><?= Tracy\Helpers::escapeHtml(get_class($instances[$name])) ?>
</code>
<?php elseif (is_string($type)): ?> <code><?= Tracy\Helpers::escapeHtml($type) ?>
</code>
<?php endif ?> </td>
<td>
<?php if (!isset($tags[$name])): ?><?php elseif (count($tags[$name]) === 1): ?> <?= Tracy\Helpers::escapeHtml(key($tags[$name])) ?>
 = <?= Dumper::toHtml(current($tags[$name]), [Dumper::COLLAPSE => true]) ?>

<?php else: ?> <?= Dumper::toHtml($tags[$name], [Dumper::COLLAPSE => true]) ?>

<?php endif ?> </td>
</tr>
<?php endforeach ?> </tbody>
</table>

<h2>Parameters</h2>

<div class="nette-ContainerPanel-parameters">
<?php if ($parameters === null): ?> <i>disabled via 'di › export › parameters'</i>
<?php else: ?> <?= Dumper::toHtml($parameters) ?>

<?php endif ?> </div>
</div>
</div>
10 changes: 10 additions & 0 deletions src/Bridges/DITracy/dist/tab.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
?>
<span title="Nette DI Container">
<svg viewBox="0 0 2048 2048">
<path fill="#ae7c21" d="m1675 690.55v-125c0-36-4-60-13-71-9-12-26-18-52-18s-43 6-52 17c-8 11-12 36-12 72v910.62c0 37 4 61 12 72 9 11 26 17 52 17s44-6 52-17c9-12 13-36 13-72v-207h243v165c0 86-4 148-12 187-8 38-21 70-39 96-20 28-45 48-77 59-31 11-87 16-170 16-96 0-161-5-196-16-34-11-63-31-86-59-21-26-36-59-45-97-9-39-14-101-14-186v-826.62c0-85 4-147 13-185s25-71 46-97c23-29 54-49 92-60s102-17 189-17c75 0 130 6 164 17s61 30 81 59c19 26 33 59 41 99 8 39 12 101 12 185v84zm-524 1086.6h-254v-1514.6h254zm-1025 0v-1514.6h316c127 0 212 27 257 81 44 53 66 159 66 316v721.62c0 157-22 263-66 317-44 53-130 80-257 80zm388-314v-884.62c0-35-4-58-13-70-9-11-26-17-53-17h-66v1058.6h66c26 0 44-6 53-17 9-12 14-35 14-70z"/>
</svg
><span class="tracy-label"><?= Tracy\Helpers::escapeHtml($elapsedTime ? sprintf('%0.1f ms', $elapsedTime * 1000) : '') ?>
</span>
</span>
84 changes: 84 additions & 0 deletions src/Bridges/DITracy/panel.latte
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{use Tracy\Dumper}

<style class="tracy-debug">
#tracy-debug .nette-ContainerPanel table {
width: 100%;
white-space: nowrap;
}

#tracy-debug .nette-ContainerPanel .created {
font-weight: bold;
}

#tracy-debug .nette-ContainerPanel .yes {
color: green;
font-weight: bold;
}

#tracy-debug .nette-ContainerPanel table pre {
display: inline;
background: transparent;
padding: 0;
word-break: normal;
}
</style>

<h1>Nette DI Container</h1>

<div class="tracy-inner nette-ContainerPanel">
<div class="tracy-inner-container">
<p>Source: {Tracy\Helpers::editorLink($file)}</p>

<table class="tracy-sortable">
<thead>
<tr>
<th>Name</th>
<th>Autowired</th>
<th>Service</th>
<th>Tags</th>
</tr>
</thead>
<tbody>
{foreach $services as $name => $type}
{do $name = (string) $name}
{do $autowired = in_array($name, array_merge($wiring[$type][0] ?? [], $wiring[$type][1] ?? []), strict: true)}
<tr>
<td class="{isset($instances[$name]) ? created : ''}">
{if is_numeric($name)}<small>{$name}</small>{else}{$name}{/if}
</td>
<td class="{$autowired ? yes : ''}">
{$autowired ? yes : (isset($wiring[$type]) ? no : '?')}
</td>
<td>
{if isset($instances[$name]) && !$instances[$name] instanceof Nette\DI\Container}
{Dumper::toHtml($instances[$name], [Dumper::COLLAPSE => true, Dumper::LIVE => true, Dumper::DEPTH => 5])}
{elseif isset($instances[$name])}
<code>{get_class($instances[$name])}</code>
{elseif is_string($type)}
<code>{$type}</code>
{/if}
</td>
<td>
{if !isset($tags[$name])}
{elseif count($tags[$name]) === 1}
{key($tags[$name])} = {Dumper::toHtml(current($tags[$name]), [Dumper::COLLAPSE => true])}
{else}
{Dumper::toHtml($tags[$name], [Dumper::COLLAPSE => true])}
{/if}
</td>
</tr>
{/foreach}
</tbody>
</table>

<h2>Parameters</h2>

<div class="nette-ContainerPanel-parameters">
{if $parameters === null}
<i>disabled via 'di › export › parameters'</i>
{else}
{Dumper::toHtml($parameters)}
{/if}
</div>
</div>
</div>
6 changes: 6 additions & 0 deletions src/Bridges/DITracy/tab.latte
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<span title="Nette DI Container">
<svg viewBox="0 0 2048 2048">
<path fill="#ae7c21" d="m1675 690.55v-125c0-36-4-60-13-71-9-12-26-18-52-18s-43 6-52 17c-8 11-12 36-12 72v910.62c0 37 4 61 12 72 9 11 26 17 52 17s44-6 52-17c9-12 13-36 13-72v-207h243v165c0 86-4 148-12 187-8 38-21 70-39 96-20 28-45 48-77 59-31 11-87 16-170 16-96 0-161-5-196-16-34-11-63-31-86-59-21-26-36-59-45-97-9-39-14-101-14-186v-826.62c0-85 4-147 13-185s25-71 46-97c23-29 54-49 92-60s102-17 189-17c75 0 130 6 164 17s61 30 81 59c19 26 33 59 41 99 8 39 12 101 12 185v84zm-524 1086.6h-254v-1514.6h254zm-1025 0v-1514.6h316c127 0 212 27 257 81 44 53 66 159 66 316v721.62c0 157-22 263-66 317-44 53-130 80-257 80zm388-314v-884.62c0-35-4-58-13-70-9-11-26-17-53-17h-66v1058.6h66c26 0 44-6 53-17 9-12 14-35 14-70z"/>
</svg
><span class="tracy-label">{$elapsedTime ? sprintf('%0.1f ms', $elapsedTime * 1000) : ''}</span>
</span>
81 changes: 0 additions & 81 deletions src/Bridges/DITracy/templates/ContainerPanel.panel.phtml

This file was deleted.

11 changes: 0 additions & 11 deletions src/Bridges/DITracy/templates/ContainerPanel.tab.phtml

This file was deleted.

2 changes: 2 additions & 0 deletions src/DI/Autowiring.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

namespace Nette\DI;

use function array_merge, class_exists, class_implements, class_parents, count, implode, interface_exists, is_a, is_array, natsort, sprintf, str_contains;


/**
* Autowiring.
Expand Down
Loading
Loading